motionState needs correct region when adding to physics

This commit is contained in:
Andrew Meadows 2018-05-31 10:23:49 -07:00
parent addbb597fc
commit 7e44b9b3ae

View file

@ -275,6 +275,9 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
_physicalObjects.insert(motionState);
result.push_back(motionState);
entityItr = _entitiesToAddToPhysics.erase(entityItr);
// make sure the motionState's region is up-to-date before it is actually added to physics
motionState->setRegion(_space->getRegion(entity->getSpaceIndex()));
} else {
//qWarning() << "Failed to generate new shape for entity." << entity->getName();
++entityItr;