Move Bullet physics query flush from Bullet space pre-tick callback to
Bullet physics flush_queries() as is done in Godot physics, and remove the pre-tick callback.
This commit is contained in:
parent
2eb65b5c7e
commit
e7d8464f87
|
@ -1572,6 +1572,12 @@ void BulletPhysicsServer::sync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BulletPhysicsServer::flush_queries() {
|
void BulletPhysicsServer::flush_queries() {
|
||||||
|
if (!active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < active_spaces_count; ++i) {
|
||||||
|
active_spaces[i]->flush_queries();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BulletPhysicsServer::finish() {
|
void BulletPhysicsServer::finish() {
|
||||||
|
|
|
@ -560,10 +560,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) {
|
void onBulletTickCallback(btDynamicsWorld *p_dynamicsWorld, btScalar timeStep) {
|
||||||
|
|
||||||
const btCollisionObjectArray &colObjArray = p_dynamicsWorld->getCollisionObjectArray();
|
const btCollisionObjectArray &colObjArray = p_dynamicsWorld->getCollisionObjectArray();
|
||||||
|
@ -635,7 +631,6 @@ void SpaceBullet::create_empty_world(bool p_create_soft_world) {
|
||||||
|
|
||||||
dynamicsWorld->setWorldUserInfo(this);
|
dynamicsWorld->setWorldUserInfo(this);
|
||||||
|
|
||||||
dynamicsWorld->setInternalTickCallback(onBulletPreTickCallback, this, true);
|
|
||||||
dynamicsWorld->setInternalTickCallback(onBulletTickCallback, this, false);
|
dynamicsWorld->setInternalTickCallback(onBulletTickCallback, this, false);
|
||||||
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(ghostPairCallback); // Setup ghost check
|
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(ghostPairCallback); // Setup ghost check
|
||||||
dynamicsWorld->getPairCache()->setOverlapFilterCallback(godotFilterCallback);
|
dynamicsWorld->getPairCache()->setOverlapFilterCallback(godotFilterCallback);
|
||||||
|
|
Loading…
Reference in New Issue