Closest position on a Spline to a Player

Hey guys I had to tackle this issue a while back in UDK and wanted to create it in blueprint for UE4

Here is my solution to a fast and fairly accurate test for finding the closest point on a spline from the player location.

I use a recursive function that is called in the tick. It checks the start and end, gets the closest, then checks that against the mid point. It keeps doing it for N times or until its close enough, the user can change those vars based on each camera spline actor but around 10 times or less has always worked for me in my testing.

Local Variables I use here:

40776-splinerecursionlocals.png

How it looks in game:

[- YouTube][3]

I also ended up doing a lengthy tutorial on how to create the entire actor and set it up here if you are interested:

[http://gregmladucky.com/blog/?p=445#more-445][4]

Hopefully that helps!

1 Like