public Transform lerp (final Vector3 targetT, final Quaternion targetR, final Vector3 targetS, final float alpha) { translation.lerp(targetT, alpha); rotation.slerp(targetR, alpha); scale.lerp(targetS, alpha); return this; }
public Transform lerp (final Vector3 targetT, final Quaternion targetR, final Vector3 targetS, final float alpha) { translation.lerp(targetT, alpha); rotation.slerp(targetR, alpha); scale.lerp(targetS, alpha); return this; }
private final static Quaternion getRotationAtTime (final NodeAnimation nodeAnim, final float time, final Quaternion out) { if (nodeAnim.rotation == null) return out.set(nodeAnim.node.rotation); if (nodeAnim.rotation.size == 1) return out.set(nodeAnim.rotation.get(0).value); int index = getFirstKeyframeIndexAtTime(nodeAnim.rotation, time); final NodeKeyframe firstKeyframe = nodeAnim.rotation.get(index); out.set((Quaternion)firstKeyframe.value); if (++index < nodeAnim.rotation.size) { final NodeKeyframe<Quaternion> secondKeyframe = nodeAnim.rotation.get(index); final float t = (time - firstKeyframe.keytime) / (secondKeyframe.keytime - firstKeyframe.keytime); out.slerp(secondKeyframe.value, t); } return out; }
private final static Quaternion getRotationAtTime (final NodeAnimation nodeAnim, final float time, final Quaternion out) { if (nodeAnim.rotation == null) return out.set(nodeAnim.node.rotation); if (nodeAnim.rotation.size == 1) return out.set(nodeAnim.rotation.get(0).value); int index = getFirstKeyframeIndexAtTime(nodeAnim.rotation, time); final NodeKeyframe firstKeyframe = nodeAnim.rotation.get(index); out.set((Quaternion)firstKeyframe.value); if (++index < nodeAnim.rotation.size) { final NodeKeyframe<Quaternion> secondKeyframe = nodeAnim.rotation.get(index); final float t = (time - firstKeyframe.keytime) / (secondKeyframe.keytime - firstKeyframe.keytime); out.slerp(secondKeyframe.value, t); } return out; }
/** Averages the given transform with this one and stores the result in this matrix. Translations and scales are lerped while * rotations are slerped. * @param other The other transform * @param w Weight of this transform; weight of the other transform is (1 - w) * @return This matrix for chaining */ public Matrix4 avg (Matrix4 other, float w) { getScale(tmpVec); other.getScale(tmpForward); getRotation(quat); other.getRotation(quat2); getTranslation(tmpUp); other.getTranslation(right); setToScaling(tmpVec.scl(w).add(tmpForward.scl(1 - w))); rotate(quat.slerp(quat2, 1 - w)); setTranslation(tmpUp.scl(w).add(right.scl(1 - w))); return this; }
/** Averages the given transform with this one and stores the result in this matrix. Translations and scales are lerped while * rotations are slerped. * @param other The other transform * @param w Weight of this transform; weight of the other transform is (1 - w) * @return This matrix for chaining */ public Matrix4 avg (Matrix4 other, float w) { getScale(tmpVec); other.getScale(tmpForward); getRotation(quat); other.getRotation(quat2); getTranslation(tmpUp); other.getTranslation(right); setToScaling(tmpVec.scl(w).add(tmpForward.scl(1 - w))); rotate(quat.slerp(quat2, 1 - w)); setTranslation(tmpUp.scl(w).add(right.scl(1 - w))); return this; }
float interpolation=0.2f; Quaternion result=new Quaternion(); result.slerp(startOrientation, endOrientation, interpolation);
public Transform lerp (final Vector3 targetT, final Quaternion targetR, final Vector3 targetS, final float alpha) { translation.lerp(targetT, alpha); rotation.slerp(targetR, alpha); scale.lerp(targetS, alpha); return this; }
private final static Quaternion getRotationAtTime (final NodeAnimation nodeAnim, final float time, final Quaternion out) { if (nodeAnim.rotation == null) return out.set(nodeAnim.node.rotation); if (nodeAnim.rotation.size == 1) return out.set(nodeAnim.rotation.get(0).value); int index = getFirstKeyframeIndexAtTime(nodeAnim.rotation, time); final NodeKeyframe firstKeyframe = nodeAnim.rotation.get(index); out.set((Quaternion)firstKeyframe.value); if (++index < nodeAnim.rotation.size) { final NodeKeyframe<Quaternion> secondKeyframe = nodeAnim.rotation.get(index); final float t = (time - firstKeyframe.keytime) / (secondKeyframe.keytime - firstKeyframe.keytime); out.slerp(secondKeyframe.value, t); } return out; }
quaternionGyroscope.slerp(quaternionRotationVector, interpolate, DIRECT_INTERPOLATION_WEIGHT);
/** Averages the given transform with this one and stores the result in this matrix. Translations and scales are lerped while * rotations are slerped. * @param other The other transform * @param w Weight of this transform; weight of the other transform is (1 - w) * @return This matrix for chaining */ public Matrix4 avg (Matrix4 other, float w) { getScale(tmpVec); other.getScale(tmpForward); getRotation(quat); other.getRotation(quat2); getTranslation(tmpUp); other.getTranslation(right); setToScaling(tmpVec.scl(w).add(tmpForward.scl(1 - w))); rotate(quat.slerp(quat2, 1 - w)); setTranslation(tmpUp.scl(w).add(right.scl(1 - w))); return this; }
/** Averages the given transform with this one and stores the result in this matrix. Translations and scales are lerped while * rotations are slerped. * @param other The other transform * @param w Weight of this transform; weight of the other transform is (1 - w) * @return This matrix for chaining */ public Matrix4 avg (Matrix4 other, float w) { getScale(tmpVec); other.getScale(tmpForward); getRotation(quat); other.getRotation(quat2); getTranslation(tmpUp); other.getTranslation(right); setToScaling(tmpVec.scl(w).add(tmpForward.scl(1 - w))); rotate(quat.slerp(quat2, 1 - w)); setTranslation(tmpUp.scl(w).add(right.scl(1 - w))); return this; }
currentOrientation.slerp(targetOrientation, 10 * deltaTime); modelTransform.setFromEulerAngles( currentOrientation.getYaw(),