mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:17:01 +02:00
fix problem where grab stops on slow movement
This commit is contained in:
parent
d924e042bc
commit
72928fdbd6
1 changed files with 2 additions and 2 deletions
|
@ -63,8 +63,8 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) {
|
||||||
btVector3 targetVelocity(0.0f, 0.0f, 0.0f);
|
btVector3 targetVelocity(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
float speed = (offsetLength > FLT_EPSILON) ? glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED) : 0.0f;
|
float speed = (offsetLength > FLT_EPSILON) ? glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED) : 0.0f;
|
||||||
|
targetVelocity = (-speed / offsetLength) * offset;
|
||||||
if (speed > rigidBody->getLinearSleepingThreshold()) {
|
if (speed > rigidBody->getLinearSleepingThreshold()) {
|
||||||
targetVelocity = (-speed / offsetLength) * offset;
|
|
||||||
rigidBody->activate();
|
rigidBody->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) {
|
||||||
// dQ = Q1 * Q0^
|
// dQ = Q1 * Q0^
|
||||||
btQuaternion deltaQ = target * bodyRotation.inverse();
|
btQuaternion deltaQ = target * bodyRotation.inverse();
|
||||||
float speed = deltaQ.getAngle() / _angularTimeScale;
|
float speed = deltaQ.getAngle() / _angularTimeScale;
|
||||||
|
targetVelocity = speed * deltaQ.getAxis();
|
||||||
if (speed > rigidBody->getAngularSleepingThreshold()) {
|
if (speed > rigidBody->getAngularSleepingThreshold()) {
|
||||||
targetVelocity = speed * deltaQ.getAxis();
|
|
||||||
rigidBody->activate();
|
rigidBody->activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue