public static float calcLerpValueAngle(this float f, float currAngle, float endAngle, float lerpVelocity_DperF, wrapType wT) { return(lerpHelper.calcLerpValueAngle(currAngle, endAngle, lerpVelocity_DperF, wT)); }
public static float calcLerpValueAngle(float currAngle, float endAngle, float lerpVelocity_DperF, wrapType wT) { float shortestDist = Mathf.Abs(Mathf.DeltaAngle(currAngle, endAngle)) % 360; //---calc distance left to travel float distToFinish = (wT == wrapType.shortest) ? shortestDist : 360 - shortestDist; //--- calc lerp value based on this return(Mathf.Clamp((lerpVelocity_DperF / distToFinish), 0, 1)); }
public static float calcGuideDistanceAngle(this float f, float startAngle, float currAngle, float endAngle, guideDistance GD, wrapType wT) { return(lerpHelper.calcGuideDistanceAngle(startAngle, currAngle, endAngle, GD, wT)); }
/// <summary> /// You only need to fill in the values that guide distance is asking for /// the other parameter must be filled in but will not affect the result /// NOTE: guideDistance.other has no definition for anything but color /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used /// because GD is only asking for a startValue(s) and endValue(s) /// </summary> public static float calcGuideDistanceAngle(float startAngle, float currAngle, float endAngle, guideDistance GD, wrapType wT) { float shortestDist; if (GD == guideDistance.distBetween_StartAndCurr) { shortestDist = Mathf.Abs(Mathf.DeltaAngle(startAngle, currAngle)); } else if (GD == guideDistance.distBetween_StartAndEnd) { shortestDist = Mathf.Abs(Mathf.DeltaAngle(startAngle, endAngle)); } else { shortestDist = Mathf.Abs(Mathf.DeltaAngle(currAngle, endAngle)); } shortestDist = shortestDist % 360; return((wT == wrapType.shortest) ? shortestDist : 360 - shortestDist); //this should only return a value between 0 -> 360 }