diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index f1c0daea26..58a0a2c53b 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -79,6 +79,8 @@ void EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* void EntityMotionState::clearEntity() { _entity = nullptr; + // set the type to INVALID so that external logic that pivots on the type won't try to access _entity + _type = MOTION_STATE_TYPE_INVALID; } MotionType EntityMotionState::computeObjectMotionType() const { diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 4836cf52fd..343ad2ce24 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -27,7 +27,7 @@ enum MotionType { }; enum MotionStateType { - MOTION_STATE_TYPE_UNKNOWN, + MOTION_STATE_TYPE_INVALID, MOTION_STATE_TYPE_ENTITY, MOTION_STATE_TYPE_AVATAR }; @@ -125,7 +125,7 @@ protected: virtual void setMotionType(MotionType motionType); void setRigidBody(btRigidBody* body); - MotionStateType _type = MOTION_STATE_TYPE_UNKNOWN; // type of MotionState + MotionStateType _type = MOTION_STATE_TYPE_INVALID; // type of MotionState MotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC btCollisionShape* _shape;