07-11-2023, 08:10 AM
I might be bad at explaining what exactly I'm looking to do but,
I'm looking for a way to get a position above(as in Y axis) a spline that has been drawn on XZ axis.
Easiest way to describe it might be to have the ray stop as it reaches the XZ coordinates along the spline and wish to get the world position straight above the spline at the cross-section.
Currently I'm using ScreenPointToRay to get the position when clicking, but I'm not sure on what would be the best method for what I'm looking to do.
I have thought of just looking through the clicked ray that is being cast and using the GetNearestPoint to get the other comparable point, then look for position when the angle from the spline point to the ray is 0, but this method might have various issues if I'm using too curvy splines and the nearest point isn't "below" the clicked point.
The fact I'm looking it to be above is somewhat irrelevant, as I just want the coordinates relative to the click, but due to colliders I believe there will not be a case where the ray from mouse click would hit the location below the spline before hitting anything else.
I'm looking for a way to get a position above(as in Y axis) a spline that has been drawn on XZ axis.
Easiest way to describe it might be to have the ray stop as it reaches the XZ coordinates along the spline and wish to get the world position straight above the spline at the cross-section.
Currently I'm using ScreenPointToRay to get the position when clicking, but I'm not sure on what would be the best method for what I'm looking to do.
I have thought of just looking through the clicked ray that is being cast and using the GetNearestPoint to get the other comparable point, then look for position when the angle from the spline point to the ray is 0, but this method might have various issues if I'm using too curvy splines and the nearest point isn't "below" the clicked point.
The fact I'm looking it to be above is somewhat irrelevant, as I just want the coordinates relative to the click, but due to colliders I believe there will not be a case where the ray from mouse click would hit the location below the spline before hitting anything else.