mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:49:34 +02:00
Merge pull request #7202 from sethalves/fix-grab-more
don't fling held items if someone else is watching
This commit is contained in:
commit
b2fa28148a
1 changed files with 1 additions and 19 deletions
|
@ -153,25 +153,6 @@ std::shared_ptr<Avatar> AvatarActionHold::getTarget(float deltaTimeStep, glm::qu
|
||||||
palmPosition = holdingAvatar->getLeftPalmPosition();
|
palmPosition = holdingAvatar->getLeftPalmPosition();
|
||||||
palmRotation = holdingAvatar->getLeftPalmRotation();
|
palmRotation = holdingAvatar->getLeftPalmRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// In this case we are simulating the grab of another avatar.
|
|
||||||
// Because the hand controller velocity for their palms is not transmitted over the
|
|
||||||
// network, we have to synthesize our own.
|
|
||||||
|
|
||||||
if (_previousSet) {
|
|
||||||
// smooth linear velocity over two frames
|
|
||||||
glm::vec3 positionalDelta = palmPosition - _previousPositionalTarget;
|
|
||||||
linearVelocity = (positionalDelta + _previousPositionalDelta) / (deltaTimeStep + _previousDeltaTimeStep);
|
|
||||||
glm::quat deltaRotation = palmRotation * glm::inverse(_previousRotationalTarget);
|
|
||||||
float rotationAngle = glm::angle(deltaRotation);
|
|
||||||
if (rotationAngle > EPSILON) {
|
|
||||||
angularVelocity = glm::normalize(glm::axis(deltaRotation));
|
|
||||||
angularVelocity *= (rotationAngle / deltaTimeStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
_previousPositionalDelta = positionalDelta;
|
|
||||||
_previousDeltaTimeStep = deltaTimeStep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation = palmRotation * _relativeRotation;
|
rotation = palmRotation * _relativeRotation;
|
||||||
|
@ -278,6 +259,7 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) {
|
||||||
});
|
});
|
||||||
|
|
||||||
forceBodyNonStatic();
|
forceBodyNonStatic();
|
||||||
|
activateBody(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
||||||
|
|
Loading…
Reference in a new issue