10-06-2021, 10:33 AM
Hi, so I'm creating a sort of road system where I 1st click to set the start of the spline ( CP0000) , I keep mouse button down and buttonup places the 2nd control point etc.
After each control point is addded I'm logging the spline.length but what I've noticed is the spline length isn't correct. It's correct in the inspector but not when I log it.
The Gameobject that the spline is a part of is always at 0,0,0. What I have noticed is after the 2nd control point is added (CP0001) ( this is when I log the spline.length ) the spline length is logged as the dist between 0,0,0 and the CP0000 regardless of how long the spline actually is.
If I place the Gameobject at the position of CP0000 after placing CP0001 the spline.length is logged as 0 but it's still correct in the inspector.
1. How can I get the acutal spline length please ?
2. Is there a way to get the spline length at each control point.
Regards.
After each control point is addded I'm logging the spline.length but what I've noticed is the spline length isn't correct. It's correct in the inspector but not when I log it.
The Gameobject that the spline is a part of is always at 0,0,0. What I have noticed is after the 2nd control point is added (CP0001) ( this is when I log the spline.length ) the spline length is logged as the dist between 0,0,0 and the CP0000 regardless of how long the spline actually is.
If I place the Gameobject at the position of CP0000 after placing CP0001 the spline.length is logged as 0 but it's still correct in the inspector.
1. How can I get the acutal spline length please ?
2. Is there a way to get the spline length at each control point.
Regards.