# 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.

Well those splines are likely made from “Bezier Curves”, and lenght of such animal is not that easy to calculate.

You can always do it yourself: length-of-bezier-curves

What words are censored? Sorry my english is not good. (i edit img :P)
And splines dont have more methods to get location. Really i need calc when i curve a spline between two points and set another velocity to calc distance based in lenght of curve?
Thanks for u answer, i find this post:

They say a Spline use a Cubic Bezier, i would love get distance only like a perimeter of curve D:!

The problem is that i cannot type that word here (it is censored) and if i try to bypass word filter i should give infraction to myself and probably ban myself for 24 hour or so.

Also back to your topic, getting length of splines is not trivial (as you can see in article), all your hope now is that this thing is high on todo list of some of blueprint engine folks at epic. Without accurate p1, pn values for bezier curve you cannot calculate that yourself. Getting those points from C++ code may be also near impossible.

Conclusion is that without epic help or digging into C++ you cannot solve this. This may be bug or “Feature” of blueprints. I think it goes wrong because of some scaling somewhere in middle. I seen similar behavior in matinee curves and they probably use same code to plot it in3d space.

Thanks man for your answer! and sorry but the RED is an impulse XD (edited
How you say, without pn values for bezier curve is really impossible get a real calc of length but i think in a fast solution, is only change velocity when my object passed pn, but not with high calc, only set a new velocity when object is between two (curve) points, i can generate an array to save points and any string (init curve01, end curve01) and set a new value to velocity. Is not a elegant solution but may work.

Regards!

Other idea, may in code when calc “Arc Length of Cubic Bezier Curves” getting a bad distance?
The method “Get Location at Distance Along Spline” no get that? I newly think that there is something wrong.

Well without idea what you really want to do (besides that distance) i really cannot help much here.

I need a real distance of spline, only is ok in line, had a wrong calc when curve. Like in the img. 100cm + maybe ~50cm (if get p1,p2 and put in rect line), no 146 cm XD.
The calc of distance has a issue or anything. Distance is a distance, is physics, you can see that line and say “ohhh really the length between p1 and p2 is 146?” bezier or another algorithm, Distance of a curve or a line is a magnitude independent of algorithm. In ue2 it worked well

there is a function to get length of the spline. So if you need a distance just between two of it’s points you can make a new temporary spline with just those two point coordinates and tangents.

I found this issue, but is not an issue D:!
In my BP_Spline i scale “Splane Component”, when i drag and drop into the map, the scale is different and when i curve a spline have a different distances. Never scale Spline Component in a BP. Only Scale in map D:!

Regards!