01-25-2022, 06:27 PM
Good Afternoon, I'm currently trying to "constrain" my character to a spline, Setting its rotation with
Vector3 P;
float carTf = path.GetNearestPointTF(transform.position, out P, Space.World);
Quaternion splineOrientation = path.GetOrientationFast(carTf);
float splineOrientationYaw = splineOrientation.eulerAngles.y;
transform.eulerAngles = new Vector3(0f, splineOrientationYaw, 0f);
this is going well for the rotation part, although for the movement along the spline, I'm trying to get a normalize length of the spline (0 to 1) depending on the current position of my character, is there a simple way to get this value?
This is for stopping the player when he gets near the end or beginning of the spline.
Thank you and have a good day, excellent profuct by the way!
Vector3 P;
float carTf = path.GetNearestPointTF(transform.position, out P, Space.World);
Quaternion splineOrientation = path.GetOrientationFast(carTf);
float splineOrientationYaw = splineOrientation.eulerAngles.y;
transform.eulerAngles = new Vector3(0f, splineOrientationYaw, 0f);
this is going well for the rotation part, although for the movement along the spline, I'm trying to get a normalize length of the spline (0 to 1) depending on the current position of my character, is there a simple way to get this value?
This is for stopping the player when he gets near the end or beginning of the spline.
Thank you and have a good day, excellent profuct by the way!