Example #1
0
        // Get the inverse percentage of the path based on how far you have traveled
        public static float GetInversePercentByLength(this PearlSpline path, float length)
        {
            if (path == null)
            {
                return(0f);
            }

            float totalLength = path.CalculateLength();

            return(path.GetPercentByLength(totalLength - length, totalLength));
        }
Example #2
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);
        }