本文整理汇总了Python中direct.controls.GravityWalker.GravityWalker.initializeCollisions方法的典型用法代码示例。如果您正苦于以下问题:Python GravityWalker.initializeCollisions方法的具体用法?Python GravityWalker.initializeCollisions怎么用?Python GravityWalker.initializeCollisions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.controls.GravityWalker.GravityWalker
的用法示例。
在下文中一共展示了GravityWalker.initializeCollisions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupControls
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import initializeCollisions [as 别名]
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()
示例2: initializeCollisions
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import initializeCollisions [as 别名]
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
示例3: setupControls
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import initializeCollisions [as 别名]
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()
示例4: BitMask32
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import initializeCollisions [as 别名]
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)
keyMap[keyMapName] = 0
base.accept(key, watchKey, [True])
base.accept(key+'-up', watchKey, [False])
示例5: LocalToon
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import initializeCollisions [as 别名]
#.........这里部分代码省略.........
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()
def setMoney(self, money):
DistributedToon.setMoney(self, money)
self.moneyGui.update(money)