本文整理汇总了Python中direct.controls.GravityWalker.GravityWalker类的典型用法代码示例。如果您正苦于以下问题:Python GravityWalker类的具体用法?Python GravityWalker怎么用?Python GravityWalker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GravityWalker类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initializeCollisions
def initializeCollisions(self, collisionTraverser, avatarNodePath, avatarRadius = 1.4, floorOffset = 1.0, reach = 1.0):
self.cHeadSphereNodePath = None
self.cFloorEventSphereNodePath = None
self.setupHeadSphere(avatarNodePath)
self.setupFloorEventSphere(avatarNodePath, ToontownGlobals.FloorEventBitmask, avatarRadius)
GravityWalker.initializeCollisions(self, collisionTraverser, avatarNodePath, avatarRadius, floorOffset, reach)
return
示例2: setupControls
def setupControls(self, avatarRadius = 1.4, floorOffset = OTPGlobals.FloorOffset, reach = 4.0, wallBitmask = OTPGlobals.WallBitmask, floorBitmask = OTPGlobals.FloorBitmask, ghostBitmask = OTPGlobals.GhostBitmask):
walkControls = GravityWalker(legacyLifter=self.wantLegacyLifter())
walkControls.setWallBitMask(wallBitmask)
walkControls.setFloorBitMask(floorBitmask)
walkControls.initializeCollisions(self.cTrav, self, avatarRadius, floorOffset, reach)
walkControls.setAirborneHeightFunc(self.getAirborneHeight)
self.controlManager.add(walkControls, 'walk')
self.physControls = walkControls
twoDControls = TwoDWalker()
twoDControls.setWallBitMask(wallBitmask)
twoDControls.setFloorBitMask(floorBitmask)
twoDControls.initializeCollisions(self.cTrav, self, avatarRadius, floorOffset, reach)
twoDControls.setAirborneHeightFunc(self.getAirborneHeight)
self.controlManager.add(twoDControls, 'twoD')
swimControls = SwimWalker()
swimControls.setWallBitMask(wallBitmask)
swimControls.setFloorBitMask(floorBitmask)
swimControls.initializeCollisions(self.cTrav, self, avatarRadius, floorOffset, reach)
swimControls.setAirborneHeightFunc(self.getAirborneHeight)
self.controlManager.add(swimControls, 'swim')
ghostControls = GhostWalker()
ghostControls.setWallBitMask(ghostBitmask)
ghostControls.setFloorBitMask(floorBitmask)
ghostControls.initializeCollisions(self.cTrav, self, avatarRadius, floorOffset, reach)
ghostControls.setAirborneHeightFunc(self.getAirborneHeight)
self.controlManager.add(ghostControls, 'ghost')
observerControls = ObserverWalker()
observerControls.setWallBitMask(ghostBitmask)
observerControls.setFloorBitMask(floorBitmask)
observerControls.initializeCollisions(self.cTrav, self, avatarRadius, floorOffset, reach)
observerControls.setAirborneHeightFunc(self.getAirborneHeight)
self.controlManager.add(observerControls, 'observer')
self.controlManager.use('walk', self)
self.controlManager.disable()
示例3: setCollisionsActive
def setCollisionsActive(self, active = 1):
if self.collisionsActive != active:
if self.cHeadSphereNodePath != None:
base.cTrav.removeCollider(self.cHeadSphereNodePath)
if active:
base.cTrav.addCollider(self.cHeadSphereNodePath, self.headCollisionEvent)
if self.cFloorEventSphereNodePath != None:
base.cTrav.removeCollider(self.cFloorEventSphereNodePath)
if active:
base.cTrav.addCollider(self.cFloorEventSphereNodePath, self.floorCollisionEvent)
GravityWalker.setCollisionsActive(self, active)
示例4: deleteCollisions
def deleteCollisions(self):
GravityWalker.deleteCollisions(self)
if self.cHeadSphereNodePath != None:
base.cTrav.removeCollider(self.cHeadSphereNodePath)
self.cHeadSphereNodePath.detachNode()
self.cHeadSphereNodePath = None
self.headCollisionsEvent = None
if self.cFloorEventSphereNodePath != None:
base.cTrav.removeCollider(self.cFloorEventSphereNodePath)
self.cFloorEventSphereNodePath.detachNode()
self.cFloorEventSphereNodePath = None
self.floorCollisionEvent = None
self.cRayNodePath.detachNode()
del self.cRayNodePath
self.cEventSphereNodePath.detachNode()
del self.cEventSphereNodePath
示例5: setupControls
def setupControls(self):
self.walkControls = GravityWalker(legacyLifter=False)
self.walkControls.setWallBitMask(CIGlobals.WallBitmask)
self.walkControls.setFloorBitMask(CIGlobals.FloorBitmask)
self.walkControls.setWalkSpeed(CIGlobals.ToonForwardSpeed, CIGlobals.ToonJumpForce, CIGlobals.ToonReverseSpeed, CIGlobals.ToonRotateSpeed)
self.walkControls.initializeCollisions(base.cTrav, self, floorOffset=0.025, reach=4.0)
self.walkControls.setAirborneHeightFunc(self.getAirborneHeight)
示例6: setupControls
def setupControls(self):
walkControls = GravityWalker(legacyLifter=self.wantLegacyLifter())
walkControls.setWallBitMask(WallBitmask)
walkControls.setFloorBitMask(FloorBitmask)
walkControls.initializeCollisions(
self.cTrav, self, avatarRadius=AvatarDefaultRadius, floorOffset=FloorOffset, reach=4
)
walkControls.setAirborneHeightFunc(self.getAirborneHeight)
self.physControls = walkControls
self.controlManager.add(walkControls, 'walk')
swimControls = SwimWalker()
swimControls.setWallBitMask(WallBitmask)
swimControls.setFloorBitMask(FloorBitmask)
swimControls.initializeCollisions(
self.cTrav, self, avatarRadius=AvatarDefaultRadius, floorOffset=FloorOffset, reach=4
)
swimControls.setAirborneHeightFunc(self.getAirborneHeight)
self.controlManager.add(swimControls, 'swim')
self.controlManager.use('walk', self)
self.controlManager.disable()
示例7: BitMask32
duckBody.reparentTo(render)
geom = duckBody.getGeomNode()
geom.getChild(0).setSx(0.730000019073)
geom.getChild(0).setSz(0.730000019073)
offset = 3.2375
base.camera.reparentTo(duckBody)
base.camera.setPos(0, -10.0 - offset, offset)
wallBitmask = BitMask32(1)
floorBitmask = BitMask32(2)
base.cTrav = CollisionTraverser()
def getAirborneHeight():
return offset + 0.025000000000000001
walkControls = GravityWalker(legacyLifter=True)
walkControls.setWallBitMask(wallBitmask)
walkControls.setFloorBitMask(floorBitmask)
walkControls.setWalkSpeed(16.0, 24.0, 8.0, 80.0)
walkControls.initializeCollisions(base.cTrav, duckBody, floorOffset=0.025, reach=4.0)
walkControls.setAirborneHeightFunc(getAirborneHeight)
walkControls.enableAvatarControls()
duckBody.physControls = walkControls
def setWatchKey(key, input, keyMapName):
def watchKey(active=True):
if active == True:
inputState.set(input, True)
keyMap[keyMapName] = 1
else:
inputState.set(input, False)
示例8: __init__
def __init__(self):
GravityWalker.__init__(self, gravity=0.0)
示例9: disableAvatarControls
def disableAvatarControls(self):
GravityWalker.disableAvatarControls(self)
self.abortJump()
示例10: reset
def reset(self):
GravityWalker.reset(self)
self.abortJump()
示例11: __init__
def __init__(self, *args, **kwargs):
GravityWalker.__init__(self, *args, **kwargs)
self.predicting = 0
示例12: LocalToon
#.........这里部分代码省略.........
except:
pass
def getBackpack(self):
return DistributedToon.getBackpack(self)
def setMyBattle(self, battle):
self.myBattle = battle
def getMyBattle(self):
return self.myBattle
def ghostOn(self):
self.getGeomNode().setTransparency(1)
self.getGeomNode().setColorScale(1, 1, 1, 0.25)
def ghostOff(self):
self.getGeomNode().setColorScale(1, 1, 1, 1)
self.getGeomNode().setTransparency(0)
def enterReadBook(self, ts = 0, callback = None, extraArgs = []):
self.stopLookAround()
self.b_lookAtObject(0, -45, 0)
DistributedToon.enterReadBook(self, ts, callback, extraArgs)
def exitReadBook(self):
DistributedToon.exitReadBook(self)
self.startLookAround()
def getAirborneHeight(self):
return self.offset + 0.025
def setupControls(self):
self.walkControls = GravityWalker(legacyLifter=False)
self.walkControls.setWallBitMask(CIGlobals.WallBitmask)
self.walkControls.setFloorBitMask(CIGlobals.FloorBitmask)
self.walkControls.setWalkSpeed(CIGlobals.ToonForwardSpeed, CIGlobals.ToonJumpForce, CIGlobals.ToonReverseSpeed, CIGlobals.ToonRotateSpeed)
self.walkControls.initializeCollisions(base.cTrav, self, floorOffset=0.025, reach=4.0)
self.walkControls.setAirborneHeightFunc(self.getAirborneHeight)
def setWalkSpeedNormal(self):
self.walkControls.setWalkSpeed(CIGlobals.ToonForwardSpeed, CIGlobals.ToonJumpForce, CIGlobals.ToonReverseSpeed, CIGlobals.ToonRotateSpeed)
def setWalkSpeedSlow(self):
self.walkControls.setWalkSpeed(CIGlobals.ToonForwardSlowSpeed, CIGlobals.ToonJumpSlowForce, CIGlobals.ToonReverseSlowSpeed, CIGlobals.ToonRotateSlowSpeed)
def setupCamera(self):
base.camLens.setMinFov(CIGlobals.DefaultCameraFov / (4.0 / 3.0))
base.camLens.setNearFar(CIGlobals.DefaultCameraNear, CIGlobals.DefaultCameraFar)
camHeight = max(self.getHeight(), 3.0)
heightScaleFactor = camHeight * 0.3333333333
defLookAt = Point3(0.0, 1.5, camHeight)
camPos = (Point3(0.0, -9.0 * heightScaleFactor, camHeight),
defLookAt,
Point3(0.0, camHeight, camHeight * 4.0),
Point3(0.0, camHeight, camHeight * -1.0),
0)
self.smartCamera.initializeSmartCamera()
self.smartCamera.setIdealCameraPos(camPos[0])
self.smartCamera.setLookAtPoint(defLookAt)
def setDNAStrand(self, dnaStrand):
DistributedToon.setDNAStrand(self, dnaStrand)
self.initCollisions()
self.setupCamera()