Insights into dynamic path shaping

I’m trying to figure out a way to make a path go from Point A to Point B, but the path also needs to smoothly curve around obstacles like other parts, which means it would need to be a chain of parts. This needs to be computable hence dynamic in the title.

I thought about making use of PathfindingService since it can compute points from A to B around other objects and terrain, and I could use this data to construct a chain of parts but it doesn’t work vertically (since the service is supposed to be used for players and AI) which is functionality that I would need.

I’ve attached a mockup of different curves below to better convey what I’m trying to achieve:

The curved examples definitely look like S curves, but would have to be able to adjust in the Y direction to account for height differences between Point A and Point B.

Does anyone have any insights on how this would be possible? PathfindingService seems like the best way as of right now but would have to be modified and my specific use case is not what the service is even intended for.

1 Like

For your obstacle curve, yes, pathfindingservice would probably be the best solution. As for the others, you might want to take a look at bezier curves.

https://developer.roblox.com/en-us/articles/Bezier-curves

Keep in mind that pathfindingservice will always pick the closest possible path making that obstacle curve quite difficult to recreate without significant adjustments to what it spits out for you.

2 Likes

Basically you just extend on with bezier curves, with your control points being your objects.

1 Like

I thought so… both PathfindingService and Bezier Curves for my use case have their pros and cons. I’ll try out bezier curves and just restrict placing through objects and see where that gets me.

1 Like