Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -2496,24 +2496,45 @@ void Application::update(float deltaTime) { · 2495 unmodified lines | ||
| 2496 | 2496 | |
| 2497 | 2497 | _entitySimulation.lock(); |
| 2498 | 2498 | _physicsEngine.deleteObjects(_entitySimulation.getObjectsToDelete()); |
| 2499 | + _entitySimulation.unlock(); | |
| 2500 | + | |
| 2501 | + _entities.getTree()->lockForWrite(); | |
| 2502 | + _entitySimulation.lock(); | |
| 2499 | 2503 | _physicsEngine.addObjects(_entitySimulation.getObjectsToAdd()); |
| 2504 | + _entitySimulation.unlock(); | |
| 2505 | + _entities.getTree()->unlock(); | |
| 2506 | + | |
| 2507 | + _entities.getTree()->lockForWrite(); | |
| 2508 | + _entitySimulation.lock(); | |
| 2500 | 2509 | _physicsEngine.changeObjects(_entitySimulation.getObjectsToChange()); |
| 2510 | + _entitySimulation.unlock(); | |
| 2511 | + _entities.getTree()->unlock(); | |
| 2512 | + | |
| 2513 | + _entitySimulation.lock(); | |
| 2501 | 2514 | _entitySimulation.applyActionChanges(); |
| 2502 | 2515 | _entitySimulation.unlock(); |
| 2503 | 2516 | |
| 2517 | + | |
| 2504 | 2518 | AvatarManager* avatarManager = DependencyManager::get<AvatarManager>().data(); |
| 2505 | 2519 | _physicsEngine.deleteObjects(avatarManager->getObjectsToDelete()); |
| 2506 | 2520 | _physicsEngine.addObjects(avatarManager->getObjectsToAdd()); |
| 2507 | 2521 | _physicsEngine.changeObjects(avatarManager->getObjectsToChange()); |
| 2508 | 2522 | |
| 2523 | + _entities.getTree()->lockForWrite(); | |
| 2509 | 2524 | _physicsEngine.stepSimulation(); |
| 2525 | + _entities.getTree()->unlock(); | |
| 2510 | 2526 | |
| 2511 | 2527 | if (_physicsEngine.hasOutgoingChanges()) { |
| 2528 | + _entities.getTree()->lockForWrite(); | |
| 2512 | 2529 | _entitySimulation.lock(); |
| 2513 | 2530 | _entitySimulation.handleOutgoingChanges(_physicsEngine.getOutgoingChanges(), _physicsEngine.getSessionID()); |
| 2514 | 2531 | _entitySimulation.unlock(); |
| 2532 | + _entities.getTree()->unlock(); | |
| 2515 | 2533 | |
| 2534 | + _entities.getTree()->lockForWrite(); | |
| 2516 | 2535 | avatarManager->handleOutgoingChanges(_physicsEngine.getOutgoingChanges()); |
| 2536 | + _entities.getTree()->unlock(); | |
| 2537 | + | |
| 2517 | 2538 | auto collisionEvents = _physicsEngine.getCollisionEvents(); |
| 2518 | 2539 | avatarManager->handleCollisionEvents(collisionEvents); |
| 2519 | 2540 | |