本文整理汇总了Python中pandac.PandaModules.BitMask32.allOff方法的典型用法代码示例。如果您正苦于以下问题:Python BitMask32.allOff方法的具体用法?Python BitMask32.allOff怎么用?Python BitMask32.allOff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.BitMask32
的用法示例。
在下文中一共展示了BitMask32.allOff方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addDropCollision
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def addDropCollision(self, drop):
collSph = drop.attachNewNode(CollisionNode('coll_drop'))
collSph.node().addSolid(CollisionSphere(0, 0, 0, 1))
collSph.node().setIntoCollideMask(BitMask32.allOff())
collSph.node().setFromCollideMask(Globals.DropBitmask)
collGround = drop.attachNewNode(CollisionNode('coll_drop_ground'))
collGround.node().addSolid(CollisionRay(0, 0, 0, 0, 0, -1))
collGround.node().setIntoCollideMask(BitMask32.allOff())
collGround.node().setFromCollideMask(Globals.WallBitmask)
collGround.show()
collHdlF.addCollider(collGround, drop)
base.cTrav.addCollider(collSph, collHdl)
base.cTrav.addCollider(collGround, collHdlF)
self.accept("coll_drop-into", self.handleDropCollision)
self.accept("coll_drop-out", self.completeCollision)
示例2: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def __init__(self, parserClass, mainClass, mapLoaderClass, modelLoaderClass):
self.switchState = False
# self.t = Timer()
self.keyMap = {"left": 0, "right": 0, "forward": 0, "backward": 0}
self.ralph = Actor(
"data/models/units/ralph/ralph",
{"run": "data/models/units/ralph/ralph-run", "walk": "data/models/units/ralph/ralph-walk"},
)
self.ralph.reparentTo(render)
# self.ralph.setPos(42, 30, 0)
self.ralph.setPos(6, 10, 0)
self.ralph.setScale(0.1)
self.accept("escape", sys.exit)
self.accept("arrow_left", self.setKey, ["left", 1])
self.accept("arrow_left-up", self.setKey, ["left", 0])
self.accept("arrow_right", self.setKey, ["right", 1])
self.accept("arrow_right-up", self.setKey, ["right", 0])
self.accept("arrow_up", self.setKey, ["forward", 1])
self.accept("arrow_up-up", self.setKey, ["forward", 0])
self.accept("arrow_down", self.setKey, ["backward", 1])
self.accept("arrow_down-up", self.setKey, ["backward", 0])
self.isMoving = False
self.cTrav = CollisionTraverser()
self.ralphGroundRay = CollisionRay()
self.ralphGroundRay.setOrigin(0, 0, 1000)
self.ralphGroundRay.setDirection(0, 0, -1)
self.ralphGroundCol = CollisionNode("ralphRay")
self.ralphGroundCol.addSolid(self.ralphGroundRay)
self.ralphGroundCol.setFromCollideMask(BitMask32.bit(0))
self.ralphGroundCol.setIntoCollideMask(BitMask32.allOff())
self.ralphGroundColNp = self.ralph.attachNewNode(self.ralphGroundCol)
self.ralphGroundHandler = CollisionHandlerQueue()
self.cTrav.addCollider(self.ralphGroundColNp, self.ralphGroundHandler)
# self.ralphGroundCol.show()
base.cam.reparentTo(self.ralph)
base.cam.setPos(0, 9, 7)
self.floater2 = NodePath(PandaNode("floater2"))
self.floater2.reparentTo(self.ralph)
self.floater2.setZ(self.floater2.getZ() + 6)
base.cam.lookAt(self.floater2)
# Uncomment this line to see the collision rays
# self.ralphGroundColNp.show()
# self.camGroundColNp.show()
# Uncomment this line to show a visual representation of the
# collisions occuring
# self.cTrav.showCollisions(render)
self.floater = NodePath(PandaNode("floater"))
self.floater.reparentTo(render)
taskMgr.add(self.move, "movingTask", extraArgs=[mainClass, parserClass, mapLoaderClass, modelLoaderClass])
示例3: addToonCollision
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def addToonCollision(self):
toon = render.find('**/Toon')
collTube = toon.attachNewNode(CollisionNode('coll_toon'))
collTube.node().addSolid(CollisionTube(0, 0, 0.5, 0, 0, 8, 2))
collTube.node().setIntoCollideMask(Globals.DropBitmask | Globals.ProjBitmask)
collTube.node().setFromCollideMask(BitMask32.allOff())
base.cTrav.addCollider(collTube, collHdl)
示例4: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def __init__(self, model, run, walk, startPos, scale, select,ralph,saysome):
self.actor = Actor(model, {"run":run, "walk":walk})
self.actor.reparentTo(render)
self.actor.setScale(scale)
self.actor.setPos(startPos)
self.actor.setHpr(90,0,0)
self.playerGUI = saysome
self.myralph = ralph
self.setAI()
self.cTrav = CollisionTraverser()
self.groundRay = CollisionRay(0,0,1000,0,0,-1)
self.groundCol = CollisionNode('dinoRay')
self.groundCol.addSolid(self.groundRay)
self.groundCol.setFromCollideMask(BitMask32.bit(1))
self.groundCol.setIntoCollideMask(BitMask32.allOff())
self.groundColNp = self.actor.attachNewNode(self.groundCol)
self.groundHandler = CollisionHandlerQueue()
self.cTrav.addCollider(self.groundColNp, self.groundHandler)
self.sphere = CollisionSphere(0,0,5,13)
self.spherecol = CollisionNode('dinoSphere')
self.spherecol.addSolid(self.sphere)
self.spherecol.setCollideMask(BitMask32.bit(1))
self.dinocolhs = self.actor.attachNewNode(self.spherecol)
示例5: placeItem
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def placeItem(self, item):
# Add ground collision detector to the health item
self.cTrav1 = CollisionTraverser()
self.collectGroundRay = CollisionRay()
self.collectGroundRay.setOrigin(0,0,300)
self.collectGroundRay.setDirection(0,0,-1)
self.collectGroundCol = CollisionNode('colRay')
self.collectGroundCol.addSolid(self.collectGroundRay)
self.collectGroundCol.setFromCollideMask(BitMask32.bit(1))
self.collectGroundCol.setIntoCollideMask(BitMask32.allOff())
self.collectGroundColNp = item.attachNewNode(self.collectGroundCol)
self.collectGroundHandler = CollisionHandlerQueue()
base.cTrav1.addCollider(self.collectGroundColNp, self.collectGroundHandler)
placed = False;
while placed == False:
# re-randomize position
item.setPos(-random.randint(-350,300),-random.randint(-100,150),0)
base.cTrav1.traverse(render)
# Get Z position from terrain collision
entries = []
for j in range(self.collectGroundHandler.getNumEntries()):
entry = self.collectGroundHandler.getEntry(j)
entries.append(entry)
entries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(),
x.getSurfacePoint(render).getZ()))
if (len(entries)>0) and (entries[0].getIntoNode().getName() == "terrain"):
item.setZ(entries[0].getSurfacePoint(render).getZ()+4)
placed = True
示例6: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def __init__( self, *args, **kwargs ):
p3d.SingleTask.__init__( self, *args, **kwargs )
self.fromCollideMask = kwargs.pop( 'fromCollideMask', None )
self.node = None
self.collEntry = None
# Create collision nodes
self.collTrav = CollisionTraverser()
#self.collTrav.showCollisions( render )
self.collHandler = CollisionHandlerQueue()
self.pickerRay = CollisionRay()
# Create collision ray
pickerNode = CollisionNode( self.name )
pickerNode.addSolid( self.pickerRay )
pickerNode.setIntoCollideMask( BitMask32.allOff() )
pickerNp = self.camera.attachNewNode( pickerNode )
self.collTrav.addCollider( pickerNp, self.collHandler )
# Create collision mask for the ray if one is specified
if self.fromCollideMask is not None:
pickerNode.setFromCollideMask( self.fromCollideMask )
# Bind mouse button events
eventNames = ['mouse1', 'control-mouse1', 'mouse1-up']
for eventName in eventNames:
self.accept( eventName, self.FireEvent, [eventName] )
示例7: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def __init__( self, name, camera=None, rootNp=None, fromCollideMask=None, pickTag=None ):
gizmo_core.Object.__init__( self, name, camera, rootNp )
self.fromCollideMask = fromCollideMask
self.pickTag = pickTag
self.selection = []
self.node = None
self.collEntry = None
# Create a marquee
self.marquee = gizmo_core.Marquee( '%sMarquee' % self.name )
# Create collision nodes
self.collTrav = CollisionTraverser()
#self.collTrav.showCollisions( render )
self.collHandler = CollisionHandlerQueue()
self.pickerRay = CollisionRay()
# Create collision ray
pickerNode = CollisionNode( self.name )
pickerNode.addSolid( self.pickerRay )
pickerNode.setIntoCollideMask( BitMask32.allOff() )
pickerNp = camera.attachNewNode( pickerNode )
self.collTrav.addCollider( pickerNp, self.collHandler )
# Create collision mask for the ray if one is specified
if self.fromCollideMask is not None:
pickerNode.setFromCollideMask( self.fromCollideMask )
# Bind mouse button events
eventNames = ['mouse1', 'control-mouse1', 'mouse1-up']
for eventName in eventNames:
self.accept( eventName, self.FireEvent, [eventName] )
示例8: addAttackCollision
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def addAttackCollision(self, proj):
collSph = proj.attachNewNode(CollisionNode('coll_attack'))
collSph.node().addSolid(CollisionSphere(0, 0, 0, 1))
collSph.node().setIntoCollideMask(BitMask32.allOff())
collSph.node().setFromCollideMask(Globals.ProjBitmask)
base.cTrav.addCollider(collSph, collHdl)
self.accept("coll_attack-into", self.handleAttackCollision)
self.accept("coll_attack-out", self.completeAttackCollision)
示例9: setCollisions
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def setCollisions(self):
# Add physical collision object to player
self.playerCollider = self.player.attachNewNode(CollisionNode('playercnode'))
self.playerCollider.node().addSolid(CollisionSphere(0, 0, 0, 1))
# Adding to trav turns it into a from object( moving object )
#base.cTrav.addCollider(self.playerCollider, self.collisionHandler)
self.playerCollider.node().setFromCollideMask(WALL_MASK)
self.playerCollider.node().setIntoCollideMask(BitMask32.allOff())
# Sensor collision
self.playerSensor = self.player.attachNewNode(CollisionNode('playersensor'))
cs=CollisionSphere(0, 0, 0, 1.2)
self.playerSensor.node().addSolid(cs)
self.playerSensor.node().setFromCollideMask(DOOR_MASK)
self.playerSensor.node().setIntoCollideMask(BitMask32.allOff())
# as said above, to act correctly we need to make clear to the system that this is just a sensor, with no solid parts
cs.setTangible(0)
示例10: addCogGroundCollision
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def addCogGroundCollision(self, cog = None, ent = None):
if ent == None:
ent = cog.getCog()
collGround = ent.attachNewNode(CollisionNode('coll_ground'))
collGround.node().addSolid(CollisionRay(0, 0, 2, 0, 0, -1))
collGround.node().setIntoCollideMask(BitMask32.allOff())
collGround.node().setFromCollideMask(Globals.WallBitmask)
collHdlF.addCollider(collGround, ent)
base.cTrav.addCollider(collGround, collHdlF)
示例11: addGagCollision
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def addGagCollision(self, gag):
collNode = gag.attachNewNode(CollisionNode('coll_gag'))
collNode.node().addSolid(CollisionSphere(0, 0, 0, 2))
collNode.node().setIntoCollideMask(BitMask32.allOff())
collNode.node().setFromCollideMask(Globals.GagBitmask | Globals.WallBitmask | Globals.FloorBitmask)
base.cTrav.addCollider(collNode, collHdl)
collHdl.addInPattern('%fn-into')
collHdl.addOutPattern('%fn-out')
self.accept("coll_gag-into", self.handleInCollisions)
self.accept("coll_gag-out", self.completeCollision)
示例12: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def __init__(self):
self.picker = CollisionTraverser()
self.pickerQ = CollisionHandlerQueue()
pickerCollN = CollisionNode('heightChecker')
self.pickerNode = render.attachNewNode(pickerCollN)
pickerCollN.setFromCollideMask(BitMask32.bit(1))
pickerCollN.setIntoCollideMask(BitMask32.allOff())
self.pickerRay = CollisionRay(0,0,300,0,0,-1)
pickerCollN.addSolid(self.pickerRay)
self.picker.addCollider(self.pickerNode, self.pickerQ)
示例13: getFlyBallBubble
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def getFlyBallBubble(self):
if self.__flyBallBubble == None:
bubble = CollisionSphere(0, 0, 0, GolfGlobals.GOLF_BALL_RADIUS)
node = CollisionNode('flyBallBubble')
node.addSolid(bubble)
node.setFromCollideMask(ToontownGlobals.PieBitmask | ToontownGlobals.CameraBitmask | ToontownGlobals.FloorBitmask)
node.setIntoCollideMask(BitMask32.allOff())
self.__flyBallBubble = NodePath(node)
self.flyBallHandler = CollisionHandlerEvent()
self.flyBallHandler.addInPattern('flyBallHit-%d' % self.index)
return self.__flyBallBubble
示例14: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def __init__(self, model, run, walk, startPos, scale):
"""Initialise the character.
Arguments:
model -- The path to the character's model file (string)
run : The path to the model's run animation (string)
walk : The path to the model's walk animation (string)
startPos : Where in the world the character will begin (pos)
scale : The amount by which the size of the model will be scaled
(float)
"""
self.controlMap = {"left":0, "right":0, "up":0, "down":0}
self.actor = Actor(Config.MYDIR+model,
{"run":Config.MYDIR+run,
"walk":Config.MYDIR+walk})
self.actor.reparentTo(render)
self.actor.setScale(scale)
self.actor.setPos(startPos)
self.controller = Controller.LocalController(self)
taskMgr.add(self.move,"moveTask") # Note: deriving classes DO NOT need
# to add their own move tasks to the
# task manager. If they override
# self.move, then their own self.move
# function will get called by the
# task manager (they must then
# explicitly call Character.move in
# that function if they want it).
self.prevtime = 0
self.isMoving = False
# We will detect the height of the terrain by creating a collision
# ray and casting it downward toward the terrain. One ray will
# start above ralph's head, and the other will start above the camera.
# A ray may hit the terrain, or it may hit a rock or a tree. If it
# hits the terrain, we can detect the height. If it hits anything
# else, we rule that the move is illegal.
self.cTrav = CollisionTraverser()
self.groundRay = CollisionRay()
self.groundRay.setOrigin(0,0,1000)
self.groundRay.setDirection(0,0,-1)
self.groundCol = CollisionNode('ralphRay')
self.groundCol.addSolid(self.groundRay)
self.groundCol.setFromCollideMask(BitMask32.bit(1))
self.groundCol.setIntoCollideMask(BitMask32.allOff())
self.groundColNp = self.actor.attachNewNode(self.groundCol)
self.groundHandler = CollisionHandlerQueue()
self.cTrav.addCollider(self.groundColNp, self.groundHandler)
示例15: setupFloorEventSphere
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOff [as 别名]
def setupFloorEventSphere(self, avatarNodePath, bitmask, avatarRadius):
cSphere = CollisionSphere(0.0, 0.0, 0.0, 0.75)
cSphereNode = CollisionNode('Flyer.cFloorEventSphere')
cSphereNode.addSolid(cSphere)
cSphereNodePath = avatarNodePath.attachNewNode(cSphereNode)
cSphereNode.setFromCollideMask(bitmask)
cSphereNode.setIntoCollideMask(BitMask32.allOff())
self.floorCollisionEvent = CollisionHandlerEvent()
self.floorCollisionEvent.addInPattern('%fn-enter-%in')
self.floorCollisionEvent.addAgainPattern('%fn-again-%in')
self.floorCollisionEvent.addOutPattern('%fn-exit-%in')
base.cTrav.addCollider(cSphereNodePath, self.floorCollisionEvent)
self.cFloorEventSphereNodePath = cSphereNodePath