mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
changed moving while airborne
This commit is contained in:
parent
e5a6d9e600
commit
3e66211e38
@ -521,6 +521,9 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
# rotMat is the rotation matrix corresponding to
|
# rotMat is the rotation matrix corresponding to
|
||||||
# our previous heading.
|
# our previous heading.
|
||||||
rotMat=Mat3.rotateMatNormaxis(self.avatarNodePath.getH(), Vec3.up())
|
rotMat=Mat3.rotateMatNormaxis(self.avatarNodePath.getH(), Vec3.up())
|
||||||
|
if self.isAirborne:
|
||||||
|
forward = Vec3.forward()
|
||||||
|
else:
|
||||||
contact = self.lifter.getContactNormal()
|
contact = self.lifter.getContactNormal()
|
||||||
forward = contact.cross(Vec3.right())
|
forward = contact.cross(Vec3.right())
|
||||||
forward = Vec3(rotMat.xform(forward))
|
forward = Vec3(rotMat.xform(forward))
|
||||||
@ -533,8 +536,11 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
forward.normalize()
|
forward.normalize()
|
||||||
self.vel=Vec3(forward * distance)
|
self.vel=Vec3(forward * distance)
|
||||||
if slideDistance:
|
if slideDistance:
|
||||||
|
if self.isAirborne:
|
||||||
|
right = Vec3.right()
|
||||||
|
else:
|
||||||
right = forward.cross(contact)
|
right = forward.cross(contact)
|
||||||
right = Vec3(rotMat.xform(Vec3.right()))
|
right = Vec3(rotMat.xform(right))
|
||||||
# See note above for forward.normalize()
|
# See note above for forward.normalize()
|
||||||
right.normalize()
|
right.normalize()
|
||||||
self.vel=Vec3(self.vel + right * slideDistance)
|
self.vel=Vec3(self.vel + right * slideDistance)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user