public static bool CheckIfNearEnoughToHideAxis(AAxis originalAxis, AAxis metaAxis) { if ( ((originalAxis.GetAxisBaseGlobal() - metaAxis.GetAxisBaseGlobal()).magnitude < triggerInvisibleDistance || (originalAxis.GetAxisBaseGlobal() - metaAxis.GetAxisTipGlobal()).magnitude < triggerInvisibleDistance) && ((originalAxis.GetAxisTipGlobal() - metaAxis.GetAxisTipGlobal()).magnitude < triggerInvisibleDistance || (originalAxis.GetAxisTipGlobal() - metaAxis.GetAxisTipGlobal()).magnitude < triggerInvisibleDistance) ) { return(true); } else { return(false); } }
public static float MeanDistanceBetween(AAxis axisA, AAxis axisB) { var tipA = axisA.GetAxisTipGlobal(); var baseA = axisA.GetAxisBaseGlobal(); var tipB = axisB.GetAxisTipGlobal(); var baseB = axisB.GetAxisBaseGlobal(); return(((baseA - baseB).magnitude + (baseA - tipB).magnitude + (tipA - baseB).magnitude + (tipA - tipB).magnitude) / 4f); }
public static float ProjectedDistanceToAxis(Vector3 point, AAxis axis) { var ray = new Ray(axis.GetAxisBaseGlobal(), (axis.GetAxisTipGlobal() - axis.GetAxisBaseGlobal())); return(Vector3.Cross(ray.direction, point - ray.origin).magnitude); }