History

fix problem where grab stops on slow movement

Andrew Meadows committed 10 years ago

Commit 72928fd1 parent d924e041 file · +2 −2Browse files

Showing the changes to libraries/physics/src/ObjectActionSpring.cpp (1 of 1 file). Show all

Unified · Split

libraries/physics/src/ObjectActionSpring.cpp+2−2
@@ -63,8 +63,8 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 62 unmodified lines
63 btVector3 targetVelocity(0.0f, 0.0f, 0.0f);63 btVector3 targetVelocity(0.0f, 0.0f, 0.0f);
64 64
65 float speed = (offsetLength > FLT_EPSILON) ? glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED) : 0.0f;65 float speed = (offsetLength > FLT_EPSILON) ? glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED) : 0.0f;
66 targetVelocity = (-speed / offsetLength) * offset;
66 if (speed > rigidBody->getLinearSleepingThreshold()) {67 if (speed > rigidBody->getLinearSleepingThreshold()) {
67 targetVelocity = (-speed / offsetLength) * offset;
68 rigidBody->activate();68 rigidBody->activate();
69 }69 }
70 70
@@ -92,8 +92,8 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 21 unmodified lines
92 // dQ = Q1 * Q0^92 // dQ = Q1 * Q0^
93 btQuaternion deltaQ = target * bodyRotation.inverse();93 btQuaternion deltaQ = target * bodyRotation.inverse();
94 float speed = deltaQ.getAngle() / _angularTimeScale;94 float speed = deltaQ.getAngle() / _angularTimeScale;
95 targetVelocity = speed * deltaQ.getAxis();
95 if (speed > rigidBody->getAngularSleepingThreshold()) {96 if (speed > rigidBody->getAngularSleepingThreshold()) {
96 targetVelocity = speed * deltaQ.getAxis();
97 rigidBody->activate();97 rigidBody->activate();
98 }98 }
99 }99 }