mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:18:24 +02:00
harvest collision events before disowning
This commit is contained in:
parent
2162a364a9
commit
0809149a8c
1 changed files with 6 additions and 3 deletions
|
@ -4377,6 +4377,10 @@ void Application::update(float deltaTime) {
|
||||||
PROFILE_RANGE_EX(simulation_physics, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
PROFILE_RANGE_EX(simulation_physics, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
PerformanceTimer perfTimer("harvestChanges");
|
PerformanceTimer perfTimer("harvestChanges");
|
||||||
if (_physicsEngine->hasOutgoingChanges()) {
|
if (_physicsEngine->hasOutgoingChanges()) {
|
||||||
|
// grab the collision events BEFORE handleOutgoingChanges() because at this point
|
||||||
|
// we have a better idea of which objects we own or should own.
|
||||||
|
auto& collisionEvents = _physicsEngine->getCollisionEvents();
|
||||||
|
|
||||||
getEntities()->getTree()->withWriteLock([&] {
|
getEntities()->getTree()->withWriteLock([&] {
|
||||||
PerformanceTimer perfTimer("handleOutgoingChanges");
|
PerformanceTimer perfTimer("handleOutgoingChanges");
|
||||||
const VectorOfMotionStates& outgoingChanges = _physicsEngine->getOutgoingChanges();
|
const VectorOfMotionStates& outgoingChanges = _physicsEngine->getOutgoingChanges();
|
||||||
|
@ -4384,11 +4388,10 @@ void Application::update(float deltaTime) {
|
||||||
avatarManager->handleOutgoingChanges(outgoingChanges);
|
avatarManager->handleOutgoingChanges(outgoingChanges);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto collisionEvents = _physicsEngine->getCollisionEvents();
|
|
||||||
avatarManager->handleCollisionEvents(collisionEvents);
|
|
||||||
|
|
||||||
if (!_aboutToQuit) {
|
if (!_aboutToQuit) {
|
||||||
|
// handleCollisionEvents() AFTER handleOutgoinChanges()
|
||||||
PerformanceTimer perfTimer("entities");
|
PerformanceTimer perfTimer("entities");
|
||||||
|
avatarManager->handleCollisionEvents(collisionEvents);
|
||||||
// Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
|
// Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
|
||||||
// deadlock.)
|
// deadlock.)
|
||||||
_entitySimulation->handleCollisionEvents(collisionEvents);
|
_entitySimulation->handleCollisionEvents(collisionEvents);
|
||||||
|
|
Loading…
Reference in a new issue