當前位置: 首頁>>代碼示例>>Python>>正文


Python GravityWalker.GravityWalker類代碼示例

本文整理匯總了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
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leaked-Source,代碼行數:7,代碼來源:CogdoFlyingCollisions.py

示例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()
開發者ID:v1tal,項目名稱:Toontown-Pulse,代碼行數:34,代碼來源:LocalAvatar.py

示例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)
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leak,代碼行數:11,代碼來源:CogdoFlyingCollisions.py

示例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
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leak,代碼行數:16,代碼來源:CogdoFlyingCollisions.py

示例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)
開發者ID:coginvasion,項目名稱:src,代碼行數:7,代碼來源:LocalToon.py

示例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()
開發者ID:masterbate,項目名稱:AIPractive,代碼行數:20,代碼來源:LocalToon.py

示例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)
開發者ID:son36,項目名稱:Cog-World,代碼行數:31,代碼來源:Cog+World.py

示例8: __init__

 def __init__(self):
     GravityWalker.__init__(self, gravity=0.0)
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leak,代碼行數:2,代碼來源:CogdoFlyingCollisions.py

示例9: disableAvatarControls

 def disableAvatarControls(self):
     GravityWalker.disableAvatarControls(self)
     self.abortJump()
開發者ID:Puggyblue999,項目名稱:PiratesOfTheCarribeanOnline,代碼行數:3,代碼來源:PiratesGravityWalker.py

示例10: reset

 def reset(self):
     GravityWalker.reset(self)
     self.abortJump()
開發者ID:Puggyblue999,項目名稱:PiratesOfTheCarribeanOnline,代碼行數:3,代碼來源:PiratesGravityWalker.py

示例11: __init__

 def __init__(self, *args, **kwargs):
     GravityWalker.__init__(self, *args, **kwargs)
     self.predicting = 0
開發者ID:Puggyblue999,項目名稱:PiratesOfTheCarribeanOnline,代碼行數:3,代碼來源:PiratesGravityWalker.py

示例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()
開發者ID:coginvasion,項目名稱:src,代碼行數:66,代碼來源:LocalToon.py


注:本文中的direct.controls.GravityWalker.GravityWalker類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。