本文整理汇总了Python中direct.controls.GravityWalker.GravityWalker.setWalkSpeed方法的典型用法代码示例。如果您正苦于以下问题:Python GravityWalker.setWalkSpeed方法的具体用法?Python GravityWalker.setWalkSpeed怎么用?Python GravityWalker.setWalkSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.controls.GravityWalker.GravityWalker
的用法示例。
在下文中一共展示了GravityWalker.setWalkSpeed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BitMask32
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWalkSpeed [as 别名]
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)
keyMap[keyMapName] = 0
base.accept(key, watchKey, [True])
base.accept(key+'-up', watchKey, [False])
示例2: BitMask32
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWalkSpeed [as 别名]
offset = 3.2375
base.camera.reparentTo(DuckBody)
base.camera.setPos(0, -10.0 - offset, offset)
wallBitmask = BitMask32(1)
floorBitmask = BitMask32(2)
base.cTrav = CollisionTraverser()
base.camera.hide()
def getAirborneHeight():
return offset + 0.025000000000000001
walkControls = GravityWalker(legacyLifter=True)
walkControls.setWallBitMask(wallBitmask)
walkControls.setFloorBitMask(floorBitmask)
walkControls.setWalkSpeed(40.0, 30.0, 30.0, 20.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])
示例3: BitMask32
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWalkSpeed [as 别名]
base.camera.reparentTo(Player)
base.camera.setPos(0, -12.0 - cameraOffset, cameraOffset)
base.disableMouse()
wallBitmask = BitMask32(1)
floorBitmask = BitMask32(2)
base.cTrav = CollisionTraverser()
def getAirborneHeight():
return cameraOffset + 0.025000000000000001
#Setting walk speed and collisions
walkControls = GravityWalker(legacyLifter=True)
walkControls.setWallBitMask(wallBitmask)
walkControls.setFloorBitMask(floorBitmask)
walkControls.setWalkSpeed(30.0, 30.0, 15.0, 80.0)
walkControls.initializeCollisions(base.cTrav, Player, floorOffset=0.025, reach=4.0)
walkControls.setAirborneHeightFunc(getAirborneHeight)
walkControls.enableAvatarControls()
Player.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])
示例4: LocalToon
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWalkSpeed [as 别名]
#.........这里部分代码省略.........
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()
def setMoney(self, money):
DistributedToon.setMoney(self, money)
self.moneyGui.update(money)