Dynamic obstacles and path modifying?

Hi !
I’m currently working on a 3D side scroller game and i’m facing some troubles with the pathfinding implementation. So the game only works on the X and Y axis since it’s a side scroller and the environment is inside a bunker.

I’m trying to work with a gridGraph using DynamicGridObstacles to update the graph depending on different moving obstacles. But the problem is that when the grid is updated, the seeker do not update their path.
So, is there any function like “OnGraphUpdated” ?

Secondly, is there any component like DynamicGridObstacles that work with the navmesh graph? I know there is the navmesh cutting, but it’s a pro features and it’s a bit overkill for my use.

One example of moving object is the door. The door are like sas with two parts going up & down when they are opening or closing. If the door is close, the unit should not find a path or try to find another one. If the door is open, they can pass though.

If some informations are not clear or missing, just tell me.

Thanks a lot !

Hi

Usually agents are configured to recalculate their paths at regular intervals. However you can also register to a callback for when the graph has been updated.

void OnEnable () {
     AstarPath.OnGraphsUpdated += OnGraphsUpdated;
}

void OnDisable () {
    AstarPath.OnGraphsUpdated -= OnGraphsUpdated;
}

void OnGraphsUpdated () {
    Debug.Log("A graph has been updated!");
}

You can modify properties on existing nodes in a navmesh graph without using navmesh cutting. For example you can make a whole triangle (node) unwalkable. You can do this using the GraphUpdateScene component (updatePhysics=false, modifyWalkability=true, setWalkability=false). See this page for more information: https://arongranberg.com/astar/docs/graph-updates.php

Thanks a lot for the answer! Helped me a lot !

1 Like