From 58bb137c4d01c175751fcdceb6302f9f48624efb Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 27 Jan 2015 17:37:12 -0800 Subject: [PATCH] bulletRotationStep --> computeBulletRotationStep --- libraries/entities/src/EntityItem.cpp | 4 ++-- libraries/physics/src/BulletUtil.h | 2 -- libraries/physics/src/ObjectMotionState.cpp | 2 +- libraries/shared/src/PhysicsHelpers.cpp | 2 +- libraries/shared/src/PhysicsHelpers.h | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index a6e3a90015..9012b2e50b 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -718,14 +718,14 @@ void EntityItem::simulateKinematicMotion(float timeElapsed) { glm::quat rotation = getRotation(); float dt = timeElapsed; while (dt > PHYSICS_ENGINE_FIXED_SUBSTEP) { - glm::quat dQ = bulletRotationStep(angularVelocity, PHYSICS_ENGINE_FIXED_SUBSTEP); + glm::quat dQ = computeBulletRotationStep(angularVelocity, PHYSICS_ENGINE_FIXED_SUBSTEP); rotation = glm::normalize(dQ * rotation); dt -= PHYSICS_ENGINE_FIXED_SUBSTEP; } // NOTE: this final partial substep can drift away from a real Bullet simulation however // it only becomes significant for rapidly rotating objects // (e.g. around PI/4 radians per substep, or 7.5 rotations/sec at 60 substeps/sec). - glm::quat dQ = bulletRotationStep(angularVelocity, dt); + glm::quat dQ = computeBulletRotationStep(angularVelocity, dt); rotation = glm::normalize(dQ * rotation); setRotation(rotation); diff --git a/libraries/physics/src/BulletUtil.h b/libraries/physics/src/BulletUtil.h index 15fb21364a..52bf2c8b06 100644 --- a/libraries/physics/src/BulletUtil.h +++ b/libraries/physics/src/BulletUtil.h @@ -32,6 +32,4 @@ inline btQuaternion glmToBullet(const glm::quat& g) { return btQuaternion(g.x, g.y, g.z, g.w); } -glm::quat bulletRotationStep(const glm::vec3& angularVelocity, float deltaTime); - #endif // hifi_BulletUtil_h diff --git a/libraries/physics/src/ObjectMotionState.cpp b/libraries/physics/src/ObjectMotionState.cpp index a36418171f..21dead5b0b 100644 --- a/libraries/physics/src/ObjectMotionState.cpp +++ b/libraries/physics/src/ObjectMotionState.cpp @@ -179,7 +179,7 @@ bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) { // Bullet caps the effective rotation velocity inside its rotation integration step, therefore // we must integrate with the same algorithm and timestep in order achieve similar results. for (int i = 0; i < numFrames; ++i) { - _sentRotation = glm::normalize(bulletRotationStep(_sentAngularVelocity, PHYSICS_ENGINE_FIXED_SUBSTEP) * _sentRotation); + _sentRotation = glm::normalize(computeBulletRotationStep(_sentAngularVelocity, PHYSICS_ENGINE_FIXED_SUBSTEP) * _sentRotation); } } const float MIN_ROTATION_DOT = 0.99f; // 0.99 dot threshold coresponds to about 16 degrees of slop diff --git a/libraries/shared/src/PhysicsHelpers.cpp b/libraries/shared/src/PhysicsHelpers.cpp index eed31b36e6..80b8d11f26 100644 --- a/libraries/shared/src/PhysicsHelpers.cpp +++ b/libraries/shared/src/PhysicsHelpers.cpp @@ -31,7 +31,7 @@ * * Copied and modified from LinearMath/btTransformUtil.h by AndrewMeadows on 2015.01.27. * */ -glm::quat bulletRotationStep(const glm::vec3& angularVelocity, float timeStep) { +glm::quat computeBulletRotationStep(const glm::vec3& angularVelocity, float timeStep) { // Bullet uses an exponential map approximation technique to integrate rotation. // The reason for this is to make it easy to compute the derivative of angular motion for various consraints. // Here we reproduce the same approximation so that our extrapolations agree well with Bullet's integration. diff --git a/libraries/shared/src/PhysicsHelpers.h b/libraries/shared/src/PhysicsHelpers.h index cc5f4017b8..bef7275067 100644 --- a/libraries/shared/src/PhysicsHelpers.h +++ b/libraries/shared/src/PhysicsHelpers.h @@ -18,6 +18,6 @@ const float PHYSICS_ENGINE_FIXED_SUBSTEP = 1.0f / 60.0f; // return incremental rotation (Bullet-style) caused by angularVelocity over timeStep -glm::quat bulletRotationStep(const glm::vec3& angularVelocity, float timeStep); +glm::quat computeBulletRotationStep(const glm::vec3& angularVelocity, float timeStep); #endif // hifi_PhysicsHelpers_h