Showing the changes to interface/src/Application.cpp (1 of 31 files). Show all
Unified · Split
| @@ -687,6 +687,10 @@ Application::~Application() { · 686 unmodified lines | ||
| 687 | 687 | // stop the glWidget frame timer so it doesn't call paintGL |
| 688 | 688 | _glWidget->stopFrameTimer(); |
| 689 | 689 | |
| 690 | + // remove avatars from physics engine | |
| 691 | + DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | |
| 692 | + _physicsEngine.deleteObjects(DependencyManager::get<AvatarManager>()->getObjectsToDelete()); | |
| 693 | + | |
| 690 | 694 | DependencyManager::destroy<OffscreenUi>(); |
| 691 | 695 | DependencyManager::destroy<AvatarManager>(); |
| 692 | 696 | DependencyManager::destroy<AnimationCache>(); |
| @@ -2150,7 +2154,7 @@ void Application::init() { · 1457 unmodified lines | ||
| 2150 | 2154 | _physicsEngine.init(); |
| 2151 | 2155 | |
| 2152 | 2156 | EntityTree* tree = _entities.getTree(); |
| 2153 | − _entitySimulation.init(tree, &_physicsEngine, &_shapeManager, &_entityEditSender); | |
| 2157 | + _entitySimulation.init(tree, &_physicsEngine, &_entityEditSender); | |
| 2154 | 2158 | tree->setSimulation(&_entitySimulation); |
| 2155 | 2159 | |
| 2156 | 2160 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| @@ -2467,12 +2471,21 @@ void Application::update(float deltaTime) { · 310 unmodified lines | ||
| 2467 | 2471 | _physicsEngine.changeObjects(_entitySimulation.getObjectsToChange()); |
| 2468 | 2472 | _entitySimulation.unlock(); |
| 2469 | 2473 | |
| 2474 | + AvatarManager* avatarManager = DependencyManager::get<AvatarManager>().data(); | |
| 2475 | + _physicsEngine.deleteObjects(avatarManager->getObjectsToDelete()); | |
| 2476 | + _physicsEngine.addObjects(avatarManager->getObjectsToAdd()); | |
| 2477 | + _physicsEngine.changeObjects(avatarManager->getObjectsToChange()); | |
| 2478 | + | |
| 2470 | 2479 | _physicsEngine.stepSimulation(); |
| 2471 | 2480 | |
| 2472 | 2481 | if (_physicsEngine.hasOutgoingChanges()) { |
| 2473 | 2482 | _entitySimulation.lock(); |
| 2474 | 2483 | _entitySimulation.handleOutgoingChanges(_physicsEngine.getOutgoingChanges(), _physicsEngine.getSessionID()); |
| 2475 | 2484 | _entitySimulation.unlock(); |
| 2485 | + | |
| 2486 | + avatarManager->handleOutgoingChanges(_physicsEngine.getOutgoingChanges()); | |
| 2487 | + avatarManager->handleCollisionEvents(_physicsEngine.getCollisionEvents()); | |
| 2488 | + | |
| 2476 | 2489 | _physicsEngine.dumpStatsIfNecessary(); |
| 2477 | 2490 | } |
| 2478 | 2491 | } |