3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 09:15:32 +02:00

Merge pull request from AndrewMeadows/workload

only add to physics simulation that when necessary
This commit is contained in:
Sam Gateau 2018-04-06 15:29:41 -07:00 committed by GitHub
commit f996989a40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,7 +48,9 @@ void PhysicalEntitySimulation::addEntityInternal(EntityItemPointer entity) {
QMutexLocker lock(&_mutex);
assert(entity);
assert(!entity->isDead());
if (entity->shouldBePhysical()) {
uint8_t region = _space->getRegion(entity->getSpaceIndex());
bool shouldBePhysical = region < workload::Region::R3 && entity->shouldBePhysical();
if (shouldBePhysical) {
EntityMotionState* motionState = static_cast<EntityMotionState*>(entity->getPhysicsInfo());
if (!motionState) {
_entitiesToAddToPhysics.insert(entity);