remove from _physicalObjects list after transaction

This commit is contained in:
Andrew Meadows 2019-05-06 14:47:00 -07:00
parent bef053584b
commit 81f960a4bd

View file

@ -156,7 +156,6 @@ void PhysicalEntitySimulation::processChangedEntity(const EntityItemPointer& ent
// remove from the physical simulation
_incomingChanges.remove(motionState);
_physicalObjects.remove(motionState);
removeOwnershipData(motionState);
_entitiesToRemoveFromPhysics.insert(entity);
if (canBeKinematic && entity->isMovingRelativeToParent()) {
@ -443,6 +442,7 @@ void PhysicalEntitySimulation::buildPhysicsTransaction(PhysicsEngine::Transactio
void PhysicalEntitySimulation::handleProcessedPhysicsTransaction(PhysicsEngine::Transaction& transaction) {
// things on objectsToRemove are ready for delete
for (auto object : transaction.objectsToRemove) {
_physicalObjects.remove(object);
delete object;
}
transaction.clear();