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
This commit is contained in:
David Carlsson 2018-06-23 00:02:10 +02:00 committed by rdb
parent c18abad8c3
commit 371e60c768

View File

@ -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();
}
} }
/** /**