NavigationRegion3D have no update real time

Godot Version

4.7

Question

NavigationRegion3D have no update real time

I was trying to upload a video but did not let me sadly

I will try to explain it in two line

after the NPC opened the door the target was behind the door so he got stuck in between,
the thing is you cannot bake the mesh when the door is open because you need the NBC to get blocked by the door and by using the NavigationLink3D you can control opening the door animation and then reassign the target position, so how can I solve this ?

things I have tried:

  1. trying navigation_region_3d.bake_navigation_mesh(true) every door open or closed that’s going to be so heavy and it’s going to cost a lag
  2. obstacles also did not work because basically I need the route of the character to completely changed to avoid the door

Why didn’t the NavigationLink3D work? I don’t think this can be done with only one NavigationRegion3D. You’ll need two regions at least and connect them with a NavigationLink3D or you can also check this documentation page:

okay this is the workflow

  1. the NPC will get to the link first

  2. an animation will run to open the door and custom velocity will take him to the other side of the link

  1. after he get to the other side of the link you will re assign the target to the navigation
    nav_agent.target_position = target
    and by choosing the shortest and the closest path he will get blocked by the door

In that case you’ll also need to use navigation obstacles:

obstacles won’t help unless there is enough distance

they also won’t recalculate the path even if it is blocking the way unless you repack
and if you are going to repack anyway obstacles are useless

I have already tried them and they did not help

if you know that they actually can fix the problem can you explain more

knowing that I’m not only facing this issue in this specific case ,take it as a large dynamic hallway with multiple doors that can be open and close into both sides, every time and each time the door will open from any of the sides that may block the room from the inside or the corridor from the outside, take it as a real case that might be actually existing in most of the game

If obstacles aren’t enough then you’ll need to manually steer the agent away from the obstacle itself or re-bake the navigation region again with the obstacle affecting it. I don’t think there’s any other option.

I Appreciate the help thanks

If there are any updates in the future, or if anyone else has other ideas, I’d really appreciate that too.