Skip to content

Commit

Permalink
Move Bullet physics query flush from Bullet space pre-tick callback to
Browse files Browse the repository at this point in the history
Bullet physics flush_queries() as is done in Godot physics, and remove
the pre-tick callback.
  • Loading branch information
madmiraal committed Jul 8, 2020
1 parent 18c51d3 commit f31b2a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 7 additions & 0 deletions modules/bullet/bullet_physics_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,13 @@ void BulletPhysicsServer3D::sync() {
}

void BulletPhysicsServer3D::flush_queries() {
if (!active) {
return;
}

for (int i = 0; i < active_spaces_count; ++i) {
active_spaces[i]->flush_queries();
}
}

void BulletPhysicsServer3D::finish() {
Expand Down
5 changes: 0 additions & 5 deletions modules/bullet/space_bullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,6 @@ void SpaceBullet::remove_all_collision_objects() {
}
}

void onBulletPreTickCallback(btDynamicsWorld *p_dynamicsWorld, btScalar timeStep) {
static_cast<SpaceBullet *>(p_dynamicsWorld->getWorldUserInfo())->flush_queries();
}

void onBulletTickCallback(btDynamicsWorld *p_dynamicsWorld, btScalar timeStep) {
const btCollisionObjectArray &colObjArray = p_dynamicsWorld->getCollisionObjectArray();

Expand Down Expand Up @@ -650,7 +646,6 @@ void SpaceBullet::create_empty_world(bool p_create_soft_world) {

dynamicsWorld->setWorldUserInfo(this);

dynamicsWorld->setInternalTickCallback(onBulletPreTickCallback, this, true);
dynamicsWorld->setInternalTickCallback(onBulletTickCallback, this, false);
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(ghostPairCallback); // Setup ghost check
dynamicsWorld->getPairCache()->setOverlapFilterCallback(godotFilterCallback);
Expand Down

0 comments on commit f31b2a1

Please sign in to comment.