Showing the changes to interface/src/Application.cpp (1 of 38 files). Show all
Unified · Split
| @@ -693,6 +693,10 @@ Application::~Application() { · 692 unmodified lines | ||
| 693 | 693 | // stop the glWidget frame timer so it doesn't call paintGL |
| 694 | 694 | _glWidget->stopFrameTimer(); |
| 695 | 695 | |
| 696 | + // remove avatars from physics engine | |
| 697 | + DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | |
| 698 | + _physicsEngine.deleteObjects(DependencyManager::get<AvatarManager>()->getObjectsToDelete()); | |
| 699 | + | |
| 696 | 700 | DependencyManager::destroy<OffscreenUi>(); |
| 697 | 701 | DependencyManager::destroy<AvatarManager>(); |
| 698 | 702 | DependencyManager::destroy<AnimationCache>(); |
| @@ -2166,7 +2170,7 @@ void Application::init() { · 1467 unmodified lines | ||
| 2166 | 2170 | _physicsEngine.init(); |
| 2167 | 2171 | |
| 2168 | 2172 | EntityTree* tree = _entities.getTree(); |
| 2169 | − _entitySimulation.init(tree, &_physicsEngine, &_shapeManager, &_entityEditSender); | |
| 2173 | + _entitySimulation.init(tree, &_physicsEngine, &_entityEditSender); | |
| 2170 | 2174 | tree->setSimulation(&_entitySimulation); |
| 2171 | 2175 | |
| 2172 | 2176 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| @@ -2486,12 +2490,21 @@ void Application::update(float deltaTime) { · 313 unmodified lines | ||
| 2486 | 2490 | _physicsEngine.changeObjects(_entitySimulation.getObjectsToChange()); |
| 2487 | 2491 | _entitySimulation.unlock(); |
| 2488 | 2492 | |
| 2493 | + AvatarManager* avatarManager = DependencyManager::get<AvatarManager>().data(); | |
| 2494 | + _physicsEngine.deleteObjects(avatarManager->getObjectsToDelete()); | |
| 2495 | + _physicsEngine.addObjects(avatarManager->getObjectsToAdd()); | |
| 2496 | + _physicsEngine.changeObjects(avatarManager->getObjectsToChange()); | |
| 2497 | + | |
| 2489 | 2498 | _physicsEngine.stepSimulation(); |
| 2490 | 2499 | |
| 2491 | 2500 | if (_physicsEngine.hasOutgoingChanges()) { |
| 2492 | 2501 | _entitySimulation.lock(); |
| 2493 | 2502 | _entitySimulation.handleOutgoingChanges(_physicsEngine.getOutgoingChanges(), _physicsEngine.getSessionID()); |
| 2494 | 2503 | _entitySimulation.unlock(); |
| 2504 | + | |
| 2505 | + avatarManager->handleOutgoingChanges(_physicsEngine.getOutgoingChanges()); | |
| 2506 | + avatarManager->handleCollisionEvents(_physicsEngine.getCollisionEvents()); | |
| 2507 | + | |
| 2495 | 2508 | _physicsEngine.dumpStatsIfNecessary(); |
| 2496 | 2509 | } |
| 2497 | 2510 | } |