Overte C++ Documentation
PhysicsHelpers.h
1 //
2 // PhysicsHelpers.h
3 // libraries/shared/src
4 //
5 // Created by Andrew Meadows 2015.01.27
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_PhysicsHelpers_h
13 #define hifi_PhysicsHelpers_h
14 
15 #include <glm/glm.hpp>
16 #include <glm/gtc/quaternion.hpp>
17 #include <QUuid>
18 
19 // TODO: move everything in here to the physics library after the physics/entities library
20 // dependency order is swapped.
21 
22 const int32_t PHYSICS_ENGINE_MAX_NUM_SUBSTEPS = 6; // Bullet will start to "lose time" at 10 FPS.
23 const uint32_t NUM_SUBSTEPS_PER_SECOND = 90;
24 const float PHYSICS_ENGINE_FIXED_SUBSTEP = 1.0f / (float)NUM_SUBSTEPS_PER_SECOND;
25 
26 const float DYNAMIC_LINEAR_SPEED_THRESHOLD = 0.05f; // 5 cm/sec
27 const float DYNAMIC_ANGULAR_SPEED_THRESHOLD = 0.087266f; // ~5 deg/sec
28 const float KINEMATIC_LINEAR_SPEED_THRESHOLD = 0.001f; // 1 mm/sec
29 const float KINEMATIC_ANGULAR_SPEED_THRESHOLD = 0.008f; // ~0.5 deg/sec
30 
31 // return incremental rotation (Bullet-style) caused by angularVelocity over timeStep
32 glm::quat computeBulletRotationStep(const glm::vec3& angularVelocity, float timeStep);
33 
34 namespace Physics {
35  int32_t getDefaultCollisionMask(int32_t group);
36 
37  void setSessionUUID(const QUuid& sessionID);
38  const QUuid& getSessionUUID();
39 };
40 
41 #endif // hifi_PhysicsHelpers_h