private Vector3 MapMeshPositionToCurve(Vector3 meshPosition, float xScale, out float t)
        {
            t = curve.DistanceToT(currentPosition + meshPosition.x * xScale);

            Vector3 toReturn = curve.GetPoint(t, false);

            toReturn += curve.GetNormal(t, false) * meshPosition.y;
            toReturn += curve.GetBiNormal(t, false) * meshPosition.z;

            return(toReturn);
        }
Exemplo n.º 2
0
        void ShowDirections()
        {
            Handles.color = Color.green;

            int steps = stepsPerCurve * line.CurveCount;

            for (int i = 1; i <= steps; i++)
            {
                Vector3 lineEnd = line.GetPoint(i / (float)steps);
                Handles.color = Color.green;
                Handles.DrawLine(lineEnd, lineEnd + line.GetDirection(i / (float)steps));

                Handles.color = Color.red;
                Handles.DrawLine(lineEnd, lineEnd + line.GetNormal(i / (float)steps));
            }
        }