mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:23:39 +02:00
rather than computing a velocity for entities held by others as a way to keep it active in local bullet, just call activateBody over and over
This commit is contained in:
parent
91f6b7e80d
commit
8f304d95b3
1 changed files with 1 additions and 22 deletions
|
@ -153,32 +153,10 @@ std::shared_ptr<Avatar> AvatarActionHold::getTarget(float deltaTimeStep, glm::qu
|
|||
palmPosition = holdingAvatar->getLeftPalmPosition();
|
||||
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;
|
||||
position = palmPosition + rotation * _relativePosition;
|
||||
|
||||
// update linearVelocity based on offset via _relativePosition;
|
||||
linearVelocity = linearVelocity + glm::cross(angularVelocity, position - palmPosition);
|
||||
});
|
||||
|
||||
return holdingAvatar;
|
||||
|
@ -278,6 +256,7 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) {
|
|||
});
|
||||
|
||||
forceBodyNonStatic();
|
||||
activateBody(true);
|
||||
}
|
||||
|
||||
bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
||||
|
|
Loading…
Reference in a new issue