Moved MotionState deletes out of PhysicsEngine. EntityMotionStates are deleted by the PhysicsEntitySimulation. AvatarMotionStates are deleted in the Avatar dtor.
Showing the changes to interface/src/Application.cpp (1 of 25 files). Show all
Unified · Split
| @@ -1084,8 +1084,8 @@ Application::~Application() { · 1083 unmodified lines | ||
| 1084 | 1084 | // remove avatars from physics engine |
| 1085 | 1085 | DependencyManager::get<AvatarManager>()->clearOtherAvatars(); |
| 1086 | 1086 | VectorOfMotionStates motionStates; |
| 1087 | − DependencyManager::get<AvatarManager>()->getObjectsToDelete(motionStates); | |
| 1088 | − _physicsEngine->deleteObjects(motionStates); | |
| 1087 | + DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates); | |
| 1088 | + _physicsEngine->removeObjects(motionStates); | |
| 1089 | 1089 | |
| 1090 | 1090 | DependencyManager::destroy<OffscreenUi>(); |
| 1091 | 1091 | DependencyManager::destroy<AvatarManager>(); |
| @@ -3085,11 +3085,11 @@ void Application::update(float deltaTime) { · 1993 unmodified lines | ||
| 3085 | 3085 | PerformanceTimer perfTimer("physics"); |
| 3086 | 3086 | |
| 3087 | 3087 | static VectorOfMotionStates motionStates; |
| 3088 | − _entitySimulation.getObjectsToDelete(motionStates); | |
| 3089 | − _physicsEngine->deleteObjects(motionStates); | |
| 3088 | + _entitySimulation.getObjectsToRemoveFromPhysics(motionStates); | |
| 3089 | + _physicsEngine->removeObjects(motionStates); | |
| 3090 | 3090 | |
| 3091 | 3091 | getEntities()->getTree()->withWriteLock([&] { |
| 3092 | − _entitySimulation.getObjectsToAdd(motionStates); | |
| 3092 | + _entitySimulation.getObjectsToAddToPhysics(motionStates); | |
| 3093 | 3093 | _physicsEngine->addObjects(motionStates); |
| 3094 | 3094 | |
| 3095 | 3095 | }); |
| @@ -3102,9 +3102,9 @@ void Application::update(float deltaTime) { · 6 unmodified lines | ||
| 3102 | 3102 | _entitySimulation.applyActionChanges(); |
| 3103 | 3103 | |
| 3104 | 3104 | AvatarManager* avatarManager = DependencyManager::get<AvatarManager>().data(); |
| 3105 | − avatarManager->getObjectsToDelete(motionStates); | |
| 3106 | − _physicsEngine->deleteObjects(motionStates); | |
| 3107 | − avatarManager->getObjectsToAdd(motionStates); | |
| 3105 | + avatarManager->getObjectsToRemoveFromPhysics(motionStates); | |
| 3106 | + _physicsEngine->removeObjects(motionStates); | |
| 3107 | + avatarManager->getObjectsToAddToPhysics(motionStates); | |
| 3108 | 3108 | _physicsEngine->addObjects(motionStates); |
| 3109 | 3109 | avatarManager->getObjectsToChange(motionStates); |
| 3110 | 3110 | _physicsEngine->changeObjects(motionStates); |
| @@ -4083,7 +4083,7 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { · 972 unmodified lines | ||
| 4083 | 4083 | }); |
| 4084 | 4084 | |
| 4085 | 4085 | foreach (EntityItemPointer entity, entities) { |
| 4086 | − if (!entity->isReadyToComputeShape()) { | |
| 4086 | + if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) { | |
| 4087 | 4087 | static QString repeatedMessage = |
| 4088 | 4088 | LogHandler::getInstance().addRepeatedMessageRegex("Physics disabled until entity loads: .*"); |
| 4089 | 4089 | qCDebug(interfaceapp) << "Physics disabled until entity loads: " << entity->getID() << entity->getName(); |