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:
Seth Alves 2016-02-25 15:26:42 -08:00
parent 91f6b7e80d
commit 8f304d95b3

View file

@ -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) {