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


Python GravityWalker.setWallBitMask方法代碼示例

本文整理匯總了Python中direct.controls.GravityWalker.GravityWalker.setWallBitMask方法的典型用法代碼示例。如果您正苦於以下問題:Python GravityWalker.setWallBitMask方法的具體用法?Python GravityWalker.setWallBitMask怎麽用?Python GravityWalker.setWallBitMask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在direct.controls.GravityWalker.GravityWalker的用法示例。


在下文中一共展示了GravityWalker.setWallBitMask方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setupControls

# 需要導入模塊: from direct.controls.GravityWalker import GravityWalker [as 別名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWallBitMask [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()
開發者ID:v1tal,項目名稱:Toontown-Pulse,代碼行數:36,代碼來源:LocalAvatar.py

示例2: setupControls

# 需要導入模塊: from direct.controls.GravityWalker import GravityWalker [as 別名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWallBitMask [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()
開發者ID:masterbate,項目名稱:AIPractive,代碼行數:22,代碼來源:LocalToon.py

示例3: BitMask32

# 需要導入模塊: from direct.controls.GravityWalker import GravityWalker [as 別名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWallBitMask [as 別名]
 
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)
            keyMap[keyMapName] = 0
開發者ID:son36,項目名稱:Cog-World,代碼行數:33,代碼來源:Cog+World.py

示例4: LocalToon

# 需要導入模塊: from direct.controls.GravityWalker import GravityWalker [as 別名]
# 或者: from direct.controls.GravityWalker.GravityWalker import setWallBitMask [as 別名]

#.........這裏部分代碼省略.........
                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()

    def setMoney(self, money):
開發者ID:coginvasion,項目名稱:src,代碼行數:70,代碼來源:LocalToon.py


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