Path points aren't dispersed equally


Hey all,

I’ve got a system set up in blueprints that adds to an array of positions, with the condition that the new position is at least 1 unreal unit away from the last one. The problem is, at a very high velocity, the path points are no longer 1 unit apart; I need them to always be 1 unit apart, no more no less. I’ve included a video to show what I mean (sometimes they can be as high as 30 units apart) and a screenshot of the blueprints.

To explain what’s going on in the video, I’m using a timeline on begin play that moves the sphere (our location reference) at a very fast velocity before it stops abruptly. As you can see, the higher the velocity, the more spread out the path points.

Does anyone know why this is happening and how I can consistently keep my path points 1 unit apart, independent of velocity?

Thanks in advance for any help

It’s probably going to be frame rate dependent how it’s setup now, you could every frame check the previous position versus the current position and add points.

Yeah that’s what I’m thinking too. I tried this but it has a couple problems too. I was hoping for a simpler solution but maybe this is the only way.

If you are running this on tick / timeline update then you are only caching the position once per frame. If an object travels more than a distance of one unit per frame (as with higher velocities) then you do not have enough data to build off the cache positions.

What you could do is have a spline that follows the cached points. Then use “Get Transform at Distance Along Spline” in conjunction with a for loop that has the number of points needed. Increment the for loops index by 1 and then feed that into the multiplier of the needed distance to get the next n-th point along the spline.

In a way you can use the spline as a way to quantize it’s position along it’s path.

You can break off the top branch if you want it to not have a limit.

KeepDistance.zip (36.9 KB)

And if you need to keep smoother path points to take into account sooth directional changes you’d need to feed the path the needed tangents based on previous and current points.

This approach isn’t perfect though. It’s only an approximation of the path. You would need the equivalent of physics sub stepping to calculate the position in-between frames.

You could in theory extrapolate the data by taking the last position subtracting the current and then normalizing it doing recursive jumps back until you hit the previous point.

But the spline gives you the option of easy tangent calculations.

Hey thanks for the detailed reply. I actually went with a system that fills in the missing points based on distance between ticks. While the spline would be good for curving the path, I don’t really need that much control. But an interesting solution nonetheless

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.