Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting a location above the spline
#3
(07-11-2023, 09:30 AM)_Aka_ Wrote: Hi

There is no ready out of the box solution for this issue in Curvy Splines. You will have to code something. Here is what seems to me like a good logic to implement:
Simplify the problem by restricting it to the XZ plane (this means you will have to project the ray on that plane). Then find the nearest point on the spline from that ray. Then finally restore the Y coordinate to get the point on the real XYZ ray.

About finding the nearest point from the spline to the ray. There might be an optimized way to do it that I am not aware of, but an easy way would be to test multiple points on the ray and compute their distance from the spline. To do so use GetNearestPoint and compute the distance between the result point an the ray point. To reduce the number of points tested, if their high number is an issue, you can use some optimization strategy such as Binary Search.

I hope this helped
Have a nice day

Thank you for the quick answer, but after few tests I'm not sure if I got the hang of it.

Currently the fact that the hit location for the ray and the curviness of the spline cause some misalignment with the closest point.

Here's a more comprehensive image about the situation
   

 
I had a thought of using the "player"- or camera position as and offset of sorts to somehow get the correct location, but I don't think it would scale correctly when used on more straight splines.
Reply


Messages In This Thread
Getting a location above the spline - by EeSe01 - 07-11-2023, 08:10 AM
RE: Getting a location above the spline - by EeSe01 - 07-11-2023, 10:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,349 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 654 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,452 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,203 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: