From ae64fbe298d319500c4794f6130d415aff38c8a4 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Thu, 20 Sep 2007 21:12:28 +0000 Subject: [PATCH] don't clear the global controlForce's physicsObject if some other code has set it to move something else --- direct/src/controls/ShipPilot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/direct/src/controls/ShipPilot.py b/direct/src/controls/ShipPilot.py index a0a0ddaf94..fe62dbd30b 100755 --- a/direct/src/controls/ShipPilot.py +++ b/direct/src/controls/ShipPilot.py @@ -77,8 +77,14 @@ class ShipPilot(PhysicsWalker): def setAvatar(self, ship): if ship is None: - base.controlForce.clearPhysicsObject() - base.controlForce.setVector(Vec3(0)) + # only clear out the global controlForce's physics object if it hasn't + # been changed since we set it up for our boat + # this could still break if we have more than one ShipPilot referencing + # a single boat + if (self.ship is not None and + base.controlForce.getPhysicsObject() is self.ship.node().getPhysicsObject()): + base.controlForce.clearPhysicsObject() + base.controlForce.setVector(Vec3(0)) self.takedownPhysics() self.setCollisionsActive(0) self.ship = ship