public static PoseFrame Interpolate(PoseFrame a, PoseFrame b, float t) { return(new PoseFrame { headPosition = Vector3.Lerp(a.headPosition, b.headPosition, t), headRotation = Quaternion.Slerp(a.headRotation, b.headRotation, t), handLeftPosition = Vector3.Lerp(a.handLeftPosition, b.handLeftPosition, t), handLeftRotation = Quaternion.Slerp(a.handLeftRotation, b.handLeftRotation, t), handRightPosition = Vector3.Lerp(a.handRightPosition, b.handRightPosition, t), handRightRotation = Quaternion.Slerp(a.handRightRotation, b.handRightRotation, t), voiceAmplitude = Mathf.Lerp(a.voiceAmplitude, b.voiceAmplitude, t), controllerLeftPose = ControllerPose.Interpolate(a.controllerLeftPose, b.controllerLeftPose, t), controllerRightPose = ControllerPose.Interpolate(a.controllerRightPose, b.controllerRightPose, t), }); }
public static Pose Interpolate(Pose from, Pose to, float time) { return(new Pose { headPosition = Vector3.Lerp(from.headPosition, to.headPosition, time), headRotation = Quaternion.Slerp(from.headRotation, to.headRotation, time), handLeftPosition = Vector3.Lerp(from.handLeftPosition, to.handLeftPosition, time), handLeftRotation = Quaternion.Slerp(from.handLeftRotation, to.handLeftRotation, time), handRightPosition = Vector3.Lerp(from.handRightPosition, to.handRightPosition, time), handRightRotation = Quaternion.Slerp(from.handRightRotation, to.handRightRotation, time), voiceAmplitude = Mathf.Lerp(from.voiceAmplitude, to.voiceAmplitude, time), controllerLeftPose = ControllerPose.Interpolate(from.controllerLeftPose, to.controllerLeftPose, time), controllerRightPose = ControllerPose.Interpolate(from.controllerRightPose, to.controllerRightPose, time), handLeftPose = HandPose.Interpolate(from.handLeftPose, to.handLeftPose, time), handRightPose = HandPose.Interpolate(from.handRightPose, to.handRightPose, time), }); }