예제 #1
0
        //Assumes the point is already on the line somewhere
        public static Vector3 ClampToSegment(Vector3 point, Vector3 linePoint1, Vector3 linePoint2)
        {
            Vector3 lineDirection = linePoint2 - linePoint1;

            if (!ExtVector3.IsInDirection(point - linePoint1, lineDirection))
            {
                point = linePoint1;
            }
            else if (ExtVector3.IsInDirection(point - linePoint2, lineDirection))
            {
                point = linePoint2;
            }

            return(point);
        }
 int AxisDirectionMultiplier(Vector3 direction, Vector3 otherDirection)
 {
     return(ExtVector3.IsInDirection(direction, otherDirection) ? 1 : -1);
 }