diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index 98968c045a..8d2bd4f7c5 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -68,6 +68,7 @@ void PhysicalEntitySimulation::removeEntityInternal(EntityItem* entity) { motionState->clearEntity(); entity->setPhysicsInfo(nullptr); _pendingRemoves.insert(motionState); + _outgoingChanges.remove(motionState); } } @@ -81,6 +82,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItem* entity) { _pendingChanges.remove(motionState); _physicalObjects.remove(motionState); _pendingRemoves.insert(motionState); + _outgoingChanges.remove(motionState); if (entity->isMoving()) { _simpleKinematicEntities.insert(entity); } diff --git a/libraries/physics/src/PhysicalEntitySimulation.h b/libraries/physics/src/PhysicalEntitySimulation.h index 64ab1bf011..4fd54c60fb 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.h +++ b/libraries/physics/src/PhysicalEntitySimulation.h @@ -37,11 +37,11 @@ public: protected: // only called by EntitySimulation // overrides for EntitySimulation - void updateEntitiesInternal(const quint64& now); - void addEntityInternal(EntityItem* entity); - void removeEntityInternal(EntityItem* entity); - void changeEntityInternal(EntityItem* entity); - void clearEntitiesInternal(); + virtual void updateEntitiesInternal(const quint64& now); + virtual void addEntityInternal(EntityItem* entity); + virtual void removeEntityInternal(EntityItem* entity); + virtual void changeEntityInternal(EntityItem* entity); + virtual void clearEntitiesInternal(); public: VectorOfMotionStates& getObjectsToDelete(); @@ -58,7 +58,7 @@ private: SetOfEntityMotionStates _pendingChanges; // EntityMotionStates already in PhysicsEngine that need their physics changed // outgoing changes - QSet _outgoingChanges; // EntityMotionStates for which we need to send updates to entity-server + SetOfEntityMotionStates _outgoingChanges; // EntityMotionStates for which we need to send updates to entity-server SetOfMotionStates _physicalObjects; // MotionStates of entities in PhysicsEngine VectorOfMotionStates _tempVector; // temporary array reference, valid immediately after getObjectsToRemove() (and friends)