From 2da0714e36b30967dcb9b0beff341b2b23c45859 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 9 Jul 2019 15:30:06 -0700 Subject: [PATCH] comments and more readable code --- interface/src/octree/SafeLanding.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 00ac958b14..88807fc577 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -203,7 +203,18 @@ bool SafeLanding::isEntityPhysicsReady(const EntityItemPointer& entity) { if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) { auto space = _entityTreeRenderer->getWorkloadSpace(); uint8_t region = space ? space->getRegion(entity->getSpaceIndex()) : (uint8_t)workload::Region::INVALID; - bool definitelyNotPhysical = (region > workload::Region::R2 && region < workload::Region::UNKNOWN) || + + // Note: the meanings of the workload regions are: + // R1 = in physics simulation and willing to own simulation + // R2 = in physics simulation but does NOT want to own simulation + // R3 = not in physics simulation but kinematically animated when velocities are non-zero + // R4 = sorted by workload and found to be outside R3 + // UNKNOWN = known to workload but not yet sorted + // INVALID = not known to workload + // So any entity sorted into R3 or R4 is definitelyNotPhysical + + bool definitelyNotPhysical = region == workload::Region::R2 || + region == workload::Region::R4 || !entity->shouldBePhysical() || modelEntity->unableToLoadCollisionShape(); bool definitelyPhysical = entity->isInPhysicsSimulation();