// Don't interpolate when parent changes (sit/stand link/unlink)
if (previousParent != getBasePrim().ParentID)
{
previousParent = getBasePrim().ParentID;
InterpolatedPosition = new Vector3(getBasePrim().Position);
InterpolatedRotation = new Quaternion(getBasePrim().Rotation);
return;
}
// Linear velocity and acceleration
if (!getBasePrim().Velocity.equals(Vector3.Zero))
{
getBasePrim().Position = Vector3.multiply(getBasePrim().Velocity, time
* 0.98f * dilation).add( getBasePrim().Position);
InterpolatedPosition = new Vector3(getBasePrim().Position);
getBasePrim().Velocity = Vector3.multiply(getBasePrim().Acceleration, time).add(getBasePrim().Velocity);
}
else if (!InterpolatedPosition.equals(getBasePrim().Position))
{
InterpolatedPosition = RHelp.Smoothed1stOrder(InterpolatedPosition, getBasePrim().Position, time);
}
// Angular velocity (target omega)
if (!(getBasePrim().AngularVelocity.equals(Vector3.Zero)))
{
Vector3 angVel = getBasePrim().AngularVelocity;
float angle = time * angVel.length();
Quaternion dQ = Quaternion.createFromAxisAngle(angVel, angle);
InterpolatedRotation = Quaternion.multiply(dQ, InterpolatedRotation);
}
else if (!(InterpolatedRotation.equals(getBasePrim().Rotation)) && !(this instanceof RenderAvatar))
{