mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
set ship.worldVelocity to zero when cleaning up physics
This commit is contained in:
parent
db1d179033
commit
fb24918dd6
@ -62,6 +62,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
|
|||||||
|
|
||||||
self.isAirborne = 0
|
self.isAirborne = 0
|
||||||
self.highMark = 0
|
self.highMark = 0
|
||||||
|
self.ship = None
|
||||||
|
|
||||||
def setWalkSpeed(self, forward, jump, reverse, rotate):
|
def setWalkSpeed(self, forward, jump, reverse, rotate):
|
||||||
assert(self.debugPrint("setWalkSpeed()"))
|
assert(self.debugPrint("setWalkSpeed()"))
|
||||||
@ -75,13 +76,14 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
|
|||||||
return (self.__speed, self.__rotationSpeed)
|
return (self.__speed, self.__rotationSpeed)
|
||||||
|
|
||||||
def setAvatar(self, ship):
|
def setAvatar(self, ship):
|
||||||
self.ship = ship
|
|
||||||
if ship is None:
|
if ship is None:
|
||||||
self.takedownPhysics()
|
self.takedownPhysics()
|
||||||
|
self.ship = None
|
||||||
else:
|
else:
|
||||||
#self.setupShip()
|
#self.setupShip()
|
||||||
print "setAvatar, wallbitmask = %s" % self.wallBitmask
|
print "setAvatar, wallbitmask = %s" % self.wallBitmask
|
||||||
self.setupPhysics(ship)
|
self.setupPhysics(ship)
|
||||||
|
self.ship = ship
|
||||||
|
|
||||||
#*# Debug:
|
#*# Debug:
|
||||||
if not hasattr(ship, "acceleration"):
|
if not hasattr(ship, "acceleration"):
|
||||||
@ -221,6 +223,8 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
|
|||||||
del self.phys
|
del self.phys
|
||||||
for i in self.nodes:
|
for i in self.nodes:
|
||||||
i.removeNode()
|
i.removeNode()
|
||||||
|
if self.ship != None:
|
||||||
|
self.ship.worldVelocity = Vec3.zero()
|
||||||
|
|
||||||
def setupPhysics(self, avatarNodePath):
|
def setupPhysics(self, avatarNodePath):
|
||||||
assert(self.debugPrint("setupPhysics()"))
|
assert(self.debugPrint("setupPhysics()"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user