Beispiel #1
0
        // Get the location of the path based on percent to a initial relative point
        public static void GetPointReltive(this PearlSpline path, out Vector3 result, float t, Vector3 initPosition)
        {
            if (path == null)
            {
                result = default;
                return;
            }

            result = path.EvaluatePosition(t);
            Vector3 initPath = path.EvaluatePosition(0);

            result = initPosition + (result - initPath);
        }
Beispiel #2
0
        // Get the location of the path based on how far you have traveled to a initial relative point
        public static bool GetPointReltiveByLength(this PearlSpline path, out Vector3 result, float length, Vector3 initPosition)
        {
            if (path == null)
            {
                result = default;
                return(false);
            }

            bool    isFinish = path.GetPointByLength(out result, ref length);
            Vector3 initPath = path.EvaluatePosition(0);

            result = initPosition + (result - initPath);
            return(isFinish);
        }
Beispiel #3
0
        // Get the location of the path based on how far you have traveled
        public static bool GetPointByLength(this PearlSpline path, out Vector3 result, ref float length)
        {
            if (path == null)
            {
                result = default;
                return(false);
            }

            var totalLength = path.CalculateLength();

            length = MathfExtend.Clamp0(length, totalLength);
            float t = path.GetPercentByLength(length, totalLength);

            result = path.EvaluatePosition(t);

            return(t >= 1);
        }