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
6363 btVector3 targetVelocity(0.0f, 0.0f, 0.0f);
6464
6565 float speed = (offsetLength > FLT_EPSILON) ? glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED) : 0.0f;
66+ targetVelocity = (-speed / offsetLength) * offset;
6667 if (speed > rigidBody->getLinearSleepingThreshold()) {
67− targetVelocity = (-speed / offsetLength) * offset;
6868 rigidBody->activate();
6969 }
7070
@@ -92,8 +92,8 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 21 unmodified lines
9292 // dQ = Q1 * Q0^
9393 btQuaternion deltaQ = target * bodyRotation.inverse();
9494 float speed = deltaQ.getAngle() / _angularTimeScale;
95+ targetVelocity = speed * deltaQ.getAxis();
9596 if (speed > rigidBody->getAngularSleepingThreshold()) {
96− targetVelocity = speed * deltaQ.getAxis();
9797 rigidBody->activate();
9898 }
9999 }