mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
controls: Don't make scene graph assumptions when setting the CollisionRay's height
This commit is contained in:
parent
dafae50ce2
commit
946f273ebb
@ -179,9 +179,9 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
# a higher or lower value depending on whether you want an avatar
|
# a higher or lower value depending on whether you want an avatar
|
||||||
# that is outside of the world to step up to the floor when they
|
# that is outside of the world to step up to the floor when they
|
||||||
# get under valid floor:
|
# get under valid floor:
|
||||||
cRay = CollisionRay(0.0, 0.0, CollisionHandlerRayStart, 0.0, 0.0, -1.0)
|
self.cRay = CollisionRay(0.0, 0.0, CollisionHandlerRayStart, 0.0, 0.0, -1.0)
|
||||||
cRayNode = CollisionNode('GW.cRayNode')
|
cRayNode = CollisionNode('GW.cRayNode')
|
||||||
cRayNode.addSolid(cRay)
|
cRayNode.addSolid(self.cRay)
|
||||||
self.cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)
|
self.cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)
|
||||||
cRayNode.setFromCollideMask(bitmask)
|
cRayNode.setFromCollideMask(bitmask)
|
||||||
cRayNode.setIntoCollideMask(BitMask32.allOff())
|
cRayNode.setIntoCollideMask(BitMask32.allOff())
|
||||||
@ -697,8 +697,4 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
# There are sometimes issues if the collision ray height is
|
# There are sometimes issues if the collision ray height is
|
||||||
# so tall that it collides with multiple levels of floors.
|
# so tall that it collides with multiple levels of floors.
|
||||||
def setCollisionRayHeight(self, height):
|
def setCollisionRayHeight(self, height):
|
||||||
oldNode = self.avatarNodePath.getNode(0)
|
self.cRay.setOrigin(0.0, 0.0, height)
|
||||||
cRayNode = oldNode.getChild(2)
|
|
||||||
cRayNode.removeSolid(0)
|
|
||||||
cRay = CollisionRay(0.0, 0.0, height, 0.0, 0.0, -1.0)
|
|
||||||
cRayNode.addSolid(cRay)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user