Quellcode durchsuchen

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 vor 7 Jahren
Ursprung
Commit
371e60c768
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  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::
 void BulletWorld::
 do_sync_b2p() {
 do_sync_b2p() {
 
 
-  for (BulletVehicle *vehicle : _vehicles) {
-    vehicle->do_sync_b2p();
-  }
-
   for (BulletRigidBodyNode *body : _bodies) {
   for (BulletRigidBodyNode *body : _bodies) {
     body->do_sync_b2p();
     body->do_sync_b2p();
   }
   }
@@ -295,6 +291,10 @@ do_sync_b2p() {
   for (BulletBaseCharacterControllerNode *character : _characters) {
   for (BulletBaseCharacterControllerNode *character : _characters) {
     character->do_sync_b2p();
     character->do_sync_b2p();
   }
   }
+
+  for (BulletVehicle *vehicle : _vehicles) {
+    vehicle->do_sync_b2p();
+  }
 }
 }
 
 
 /**
 /**