diff --git a/libraries/physics/src/CharacterController.h b/libraries/physics/src/CharacterController.h index d736487d20..77a75c7bbd 100755 --- a/libraries/physics/src/CharacterController.h +++ b/libraries/physics/src/CharacterController.h @@ -25,6 +25,7 @@ #include "BulletUtil.h" #include "CharacterGhostObject.h" #include "PhysicsEngine.h" +#include "PhysicsHelpers.h" const uint32_t PENDING_FLAG_ADD_TO_SIMULATION = 1U << 0; const uint32_t PENDING_FLAG_REMOVE_FROM_SIMULATION = 1U << 1; @@ -38,7 +39,7 @@ const uint32_t PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION = 1U << 7; const float DEFAULT_MIN_FLOOR_NORMAL_DOT_UP = cosf(PI / 3.0f); const uint32_t NUM_SUBSTEPS_FOR_STUCK_TRANSITION = 6; // physics substeps -const uint32_t NUM_SUBSTEPS_FOR_SAFE_LANDING_RETRY = 40; // physics substeps +const uint32_t NUM_SUBSTEPS_FOR_SAFE_LANDING_RETRY = NUM_SUBSTEPS_PER_SECOND / 2; // retry every half second class btRigidBody; class btCollisionWorld; diff --git a/libraries/shared/src/PhysicsHelpers.h b/libraries/shared/src/PhysicsHelpers.h index 332100f03b..2e32865fd0 100644 --- a/libraries/shared/src/PhysicsHelpers.h +++ b/libraries/shared/src/PhysicsHelpers.h @@ -19,8 +19,9 @@ // TODO: move everything in here to the physics library after the physics/entities library // dependency order is swapped. -const int PHYSICS_ENGINE_MAX_NUM_SUBSTEPS = 6; // Bullet will start to "lose time" at 10 FPS. -const float PHYSICS_ENGINE_FIXED_SUBSTEP = 1.0f / 90.0f; +const int32_t PHYSICS_ENGINE_MAX_NUM_SUBSTEPS = 6; // Bullet will start to "lose time" at 10 FPS. +const uint32_t NUM_SUBSTEPS_PER_SECOND = 90; +const float PHYSICS_ENGINE_FIXED_SUBSTEP = 1.0f / (float)NUM_SUBSTEPS_PER_SECOND; const float DYNAMIC_LINEAR_SPEED_THRESHOLD = 0.05f; // 5 cm/sec const float DYNAMIC_ANGULAR_SPEED_THRESHOLD = 0.087266f; // ~5 deg/sec