controls: Don't make scene graph assumptions when setting the CollisionRay's height

This commit is contained in:
Jeremy Koletar 2015-07-17 13:39:41 -05:00
parent dafae50ce2
commit 946f273ebb

View File

@ -179,9 +179,9 @@ class GravityWalker(DirectObject.DirectObject):
# 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
# 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.addSolid(cRay)
cRayNode.addSolid(self.cRay)
self.cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)
cRayNode.setFromCollideMask(bitmask)
cRayNode.setIntoCollideMask(BitMask32.allOff())
@ -697,8 +697,4 @@ class GravityWalker(DirectObject.DirectObject):
# There are sometimes issues if the collision ray height is
# so tall that it collides with multiple levels of floors.
def setCollisionRayHeight(self, height):
oldNode = self.avatarNodePath.getNode(0)
cRayNode = oldNode.getChild(2)
cRayNode.removeSolid(0)
cRay = CollisionRay(0.0, 0.0, height, 0.0, 0.0, -1.0)
cRayNode.addSolid(cRay)
self.cRay.setOrigin(0.0, 0.0, height)