public static TransformMinimal operator-(TransformMinimal a, TransformMinimal b) { var result = new TransformMinimal(); result.localPos = a.localPos - b.localPos; result.pos = a.pos - b.pos; result.localRot = a.localRot - b.localRot; result.rot = a.rot - b.rot; return(result); }
private TransformMinimal CaptureParentTransform() { TransformMinimal result = new TransformMinimal(); if (transform.parent) { result.parent = transform.parent.parent; result.localRot = transform.parent.localRotation.eulerAngles; result.rot = transform.parent.rotation.eulerAngles; result.localPos = transform.parent.localPosition; result.pos = transform.parent.position; } return(result); }
#pragma warning restore #endregion private void Awake() { // Check if this joint is valid. if (CheckValid() == false) { return; } _parentTransform = CaptureParentTransform(); _actualEndPos = CaptureEndPointTransform(); ClampParameters(); CaptureStartTransform(); _currEulerAngles = _prevEulerAngles = _idealEulerAngles = transform.rotation.eulerAngles; _origFwd = transform.forward; _origRootToEnd = _endPoint.position - transform.position; _origUp = transform.up; _origRight = transform.right; }
public void DoLateFixedUpdate() { // Only do once per frame if (_didLateUpdate) { return; } _didLateUpdate = true; if (_doGradualMovement) { UpdateRotationValues(); // THIS NEEDS TO ONLY BE DONE EXACTLY ONCE OR WE ARE GONNA HAVE ANGVEL DIFFS } if (_hasMoved == false && _doesReturnToRest) { ReturnToRest(); } if (_doesDroop) { HandleGravity(); } // Smooths over the previous movements if (_doesSmoothMotion) { HandleSmoothMotion(); } if (_checkLimits && _respectsLimits) { CheckLimits(ref _currEulerAngles); CheckTwist(ref _currTwistAngle); _checkLimits = false; } _actualEndPos = CaptureEndPointTransform(); _parentTransform = CaptureParentTransform(); }