Pathfinding on terrain

Currently I’m attempting to emulate the overworld travel found in games like mount and blade warband, where the player travels to the spot on the map which they had clicked on.

However, judging by some posts from other developers, roblox pathfinding doesn’t exactly work the best on smooth terrain.
I’ve been trying to think up of a good way to move the player to their destination while being able to avoid certain terrain materials such as rocks or water, but I can’t think of anything.

Any suggestions would be welcomed as I’m unsure on how to implement this.

Hello! I’ve come up with 2 ways that might be possible to do and still don’t look just terrible.

Method 1

My first method that i came up with was preseting paths, Where there are nodes on the road that the player would follow (This would still look realistic because we don’t walk over grass, But follow the road.)

Method 2

My second method was making the player walk there in a straight line, And when it’s near water or rocks (Which could be detected with a zone perhaps?) They would follow a scripted WalkTo() to walk around it?

No idea how you would script this, But this may still help with ideas, Goodluck :slight_smile:

The problem is my overworld map is far too large to create predetermined paths and even if I were to make some form of hybrid, (such as preset paths only near water or rocks), it would still be time consuming. Not to mention I wouldn’t like to limit the players movement too much anywhere on the map.

Also bumping this post

Bumping again

I’ve tried changing the waypoint height to the terrain height with raycasting, however this only works sometimes, and completely breaks in certain areas like below.

I’m just curious, why is it that you’re trying to avoid certain things like rocks on the terrain?

The rocks are meant to act as impassable mountains

In that case, why not just set up solid blocks that cover certain areas?

It would be far too time consuming, not to mention this doesn’t resolve the problem with pathfinding breaking around hills which players can traverse.

To avoid certain obstacles using pathfinding, I’m pretty your best option would be to set up parts. Regarding the other issue of hills, I’m not sure what you mean by this. Are you saying that characters walk through hills during pathfinding?

Edit: Maybe you could provide a visual of whats happening.

If you took a look at the gyazo link I had already posted, the created path goes nowhere near the spot the mouse had clicked on.

In that case, I suggest you try out my pathfinding module. You have the ability to spam the pathfinding function. In other words, continuously calling the :Run() or pathfinder function from the module computes a new path instantly. This can help in detecting the terrain as the player reaches moves. Furthermore, I’ve added a jump detection feature that I have tested on terrain and it quite literally allows the rig to climb terrain. More about this can be found on the page.

I don’t think this will fully fix the issue since after all the pathfinding is done by PathfindingService in the end. But this will definitely be more effective at ignoring some of these things.

Pathfinding in a “spam” style using the module: