Browse Source

bullet: Change the b2p sync-order to allow parenting BulletWheels to a BulletVehicle

Parenting a BulletVehicle's wheels to the chassis-BulletRigidBodyNode now works as expected. Previously doing this would make the wheels appear to be positioned one frame ahead of the chassis, because the wheel's position were synced before the chassis' position.

For more information see issue #250.

Closes #349
David Carlsson 7 years ago
parent
commit
371e60c768
1 changed files with 4 additions and 4 deletions
  1. 4 4
      panda/src/bullet/bulletWorld.cxx

+ 4 - 4
panda/src/bullet/bulletWorld.cxx

@@ -276,10 +276,6 @@ do_sync_p2b(PN_stdfloat dt, int num_substeps) {
 void BulletWorld::
 do_sync_b2p() {
 
-  for (BulletVehicle *vehicle : _vehicles) {
-    vehicle->do_sync_b2p();
-  }
-
   for (BulletRigidBodyNode *body : _bodies) {
     body->do_sync_b2p();
   }
@@ -295,6 +291,10 @@ do_sync_b2p() {
   for (BulletBaseCharacterControllerNode *character : _characters) {
     character->do_sync_b2p();
   }
+
+  for (BulletVehicle *vehicle : _vehicles) {
+    vehicle->do_sync_b2p();
+  }
 }
 
 /**