Distance Between Points Spline Issue?

Hello everybody,

I get distance between two points but this have an unusual values, when i use a “Set Actor Location” and put in the “location” the “return value” of “Get Location at Distance along Spline” and pass P1, i go really slow (Distance is less but have a high value, more than P0,P1). This is an issue? i set every point like curve, linear, and constant, and got the same result all time, when you move the spline point into curves, visually i can see less distance but internally have more o.o.

I know this is an old post but for People like me looking to solve this issue I’ll go ahead and answer it. From what I Gather your looking to get the real distance between 2 spline points. Point o to Point 1 P0,P1 seems to work find and P1,P2 seems much to large. The issue is that your getting P0,P2 length. The function Get distance along spline gives you distance from start P0 to your chosen point P2. You need to subtract P1 from P2 to get the length P1,P2. If your using a loop you should store it as a variable current dist and last dist, or ref at that point index -1 minus index locations and that would give you your correct value.

I followed the the epic games UE4 tutorial for constructing a spline blueprint. Then I changed the display current point to display the distance along spline function, with a little math it shows the distance for that segment above the road mesh in my 2nd screen shot. So instead of displaying it on screen you can push that into a variable and use it in the script/blueprint.

Hope this helps for anyone looking to get point to point distances along spline.

UE4 tutorial: Live Training - Using Splines & Spline Components
https://api.unrealengine.com/INT/Videos/PLZlv_N0_O1ga0aV9jVqJgog0VWz1cLL5f/wR0fH6O9jD8/index.html
(Edited to add blueprint and example screen shots.)

1 Like