Add rigidBodyUpdated function to EventListener

This commit is contained in:
Matthew-TC 2020-05-19 12:45:55 +01:00
parent 5c736565a7
commit 890f6a3f97
2 changed files with 8 additions and 0 deletions

View File

@ -229,6 +229,9 @@ void DynamicsWorld::updateBodiesState() {
// Update the broad-phase state of the body
bodies[b]->updateBroadPhaseState();
// Notify the event listener that the body has been updated
if (mEventListener != nullptr) { mEventListener->rigidBodyUpdated(bodies[b]); }
}
}
}

View File

@ -66,6 +66,11 @@ class EventListener {
/// engine will do several internal simulation steps. This method is
/// called at the end of each internal simulation step.
virtual void endInternalTick() {}
/// Called every time a RigidBody is updated as part of the
/// DynamicsWorld::update() step. The pointer provided as a parameter
/// to this function is the RigidBody that has been updated.
virtual void rigidBodyUpdated(const RigidBody* body) {}
};
}