Pathfinding obstacle groups [SOLVED]

Hi, is there any way to create obstacles separately for each object using pathfinding behavior?
let’s say I have 4 objects - water and land, a boat and a car. Water should serve as an obstacle for a car, but be passable for a boat, and vice versa.
The only alternative that I found is to use pathfinding for one group of objects and navmesh behavior for another, but this method is bad since you can have only 2 groups of objects and its also not suitable for large maps since a large navmesh is quite demanding on performance.

I tried something like that before. The only way I found was to give the obstacles a variable like style and before doing the path finder move I disabled or enabled the obstacle behavior on the objects without the specific type value. It only checks for obstacles when you use the move action. Once a path is created. It does matter.

It would be easier to create a function that does it automatically. I don’t know how efficient it is to enable and disable behaviors. Maybe the nav mesh behavior can be modified or a feature request made for either the built-in version or the nav mesh.

It would be nice if it was like the physics behavior with layers or some other way to limit it.

The linked object behavior has that type of feature but it’s made for a more grid or object based movement. It uses object variables and a condition that allows you to set the maximum number of links.

Thanks for the answer, I’ll try to do something similar, but it seems to me that problems may arise when using a large number of objects and groups. If I can’t find a convenient way to do this, I’ll make a feature request, I think it will be quite useful.

1 Like

Your method works great even with 2 hundred objects, no errors occur, they move only in the designated zones. For convenience, you can write functions in custom behavior through which groups of obstacles will be selected and actions will not have to be copied from event to event, the main thing is to use them for all events related to the movement of pathfinding objects.

In some ways, limiting zones this way is even more flexible than if it were a system of layers or groups, since I can freely modify them, switch between them, change them for specific cases, and so on, and it doesn’t require a lot of events . Therefore, I probably won’t make a feature request.



PathfindingZones

Good to hear. A function is definitely the way to go. You can call the function and let it call the path finder move. It would be automatic without any extra events in the main event list.

For the most part, walling off a river would keep vehicles out and boats inside. Bridges would be an issue for boats. But then you would only need to disable the bridge sides when needed. You can also wall off areas like a forest with a few hidden objects that you selectively enable and disable. The size of the moving object and the size of the gaps will also help keep things where they need to be.

Bridges are not a problem, I just marked them as passable for both boats and cars.
Bridge

Basically the only requirement for this is that the zones should not intersect. We simply line the entire map with rectangles that are marked either passable or impassable for each specific object. In any case, boats and cars are just an example, where I’m going to use this is even simpler.

1 Like