public static animationTransformData scale(identity nIdentity, animationTransformData pose_1, float parameter, bool usingQuaternion) { animationTransformData poseresult = new animationTransformData(); //translation: literal linear interpolation poseresult.localPosition = Vector3.Lerp(nIdentity.position, pose_1.localPosition, parameter); //scale: ditto poseresult.localScale = Vector3.Lerp(nIdentity.scale, pose_1.localScale, parameter); //rotation: slerp if quaternion (or NLERP) otherwise euler lerp if (usingQuaternion) { poseresult.localRotation = Quaternion.Slerp(nIdentity.rotation, pose_1.localRotation, parameter); } else { poseresult.localEulerAnglesSet(Vector3.Lerp(nIdentity.rotation.eulerAngles, pose_1.localEulerAngles(), parameter)); } return(poseresult); }
public static animationTransformData add(animationTransformData pose0, animationTransformData pose1, bool usingQuaternion) { animationTransformData poseresult = new animationTransformData(); //translation literal addition poseresult.localPosition = pose0.localPosition + pose1.localPosition; //scale component-wise multiplication poseresult.localScale = pose0.localScale; poseresult.localScale.Scale(pose1.localScale); //rotation: quaternioni concatenation or Euler addition if (usingQuaternion) { poseresult.localRotation = pose0.localRotation * pose1.localRotation; } else { poseresult.localEulerAnglesSet(pose0.localEulerAngles() + pose1.localEulerAngles()); } return(poseresult); }