Ejemplo n.º 1
0
        public Vector3 GetPoint(float t)
        {
            var(clampedT, i) = GetStartingIndexPointFromT(t);
            Vector3 cubicPoint = BezierMath.GetCubicPoint(points[i], points[i + 1], points[i + 2], points[i + 3], clampedT);

            return(transform.TransformPoint(cubicPoint));
        }
Ejemplo n.º 2
0
        public Vector3 GetVelocity(float t)
        {
            var(clampedT, i) = GetStartingIndexPointFromT(t);
            Vector3 tangent = BezierMath.GetCubicFirstDerivative(points[i], points[i + 1], points[i + 2], points[i + 3], clampedT);

            // tangent point relative to the origin's point (e.g. transform position)
            // convert the local space to
            return(transform.TransformPoint(tangent - transform.position));
        }