News › Forums › Troubleshooting › Problem with Graph Tags
This topic contains 10 replies, has 3 voices, and was last updated by LightYarn 1 week, 2 days ago.
-
AuthorPosts
-
June 15, 2022 at 4:16 pm #27801
Hi everybody,
I have a problem with the Graph Tags Rain uses. I am trying to use them to dynamically tell my AI if a door is blocking a passage or not.
NavMesh with closed door (Tag: default)
NavMesh with open door (Tag: cellHWOpen)
The door script does the following:
If the door is open => ‘AddGraphTag(“cellHWOpen”)’ to enemy AI
If it is closed again => ‘RemoveGraphTag(“cellHWOpen”)’ from enemy AIThis is working quite well, the Tags are added and removed correctly but here is my problem:
The AI is not using the NavMesh with the shorter way. It still seems to be using the “default” NavMesh as if the door were closed.
Can you help me with this?
June 16, 2022 at 8:55 pm #27980I believe you must add GraphTags to both the AI (AIRig navigation) and the navigation mesh itself. The names must match and if the mesh has, for example, 3 graphtag names the AI should have all 3 too.
From the wiki “If you define more than one Graph Tag name on the Navigation Mesh, you must add ALL those names to the AIRig navigations Graph Tag list”.
- This reply was modified 3 weeks ago by CodersExpo.
- This reply was modified 3 weeks ago by CodersExpo.
June 17, 2022 at 5:41 am #28020Hey thanks for your help! =)
But I already assigned the Tags to the NavMesh and the AI.
Here some pictures of my setupLink for bigger Image: http://iht.rdy2play.de/iht/navmeshtag1.png
Link for bigger Image: http://iht.rdy2play.de/iht/navmeshtag2.png
This should be correct, shouldn’t it?
I really don’t know whats going on here…could it be I found a bug?June 17, 2022 at 6:09 am #28026How are you creating the mesh when the door opens? I don’t see a mesh graph and then when it opens there is one. You might try registering the mesh graph with RAIN.Navigation.NavigationManager.Instance.Register(YourRainNavigationGraph); if you are programmatically generating this…
June 17, 2022 at 6:22 am #28027The NavMesh is pre-calculated.
The only thing I am doing at runtime is adding a Tag to AIs Rig telling him “now you can walk on NavMesh XYZ, too” which depends on the door. If it is closed at runtime I’m just removing the Tag, so the AI cant use this NavMesh anymore.Do I still need to register the NavMesh with this method?
EDIT: I have 2 GOs with two different NavMesh Rigs
1=> Pre-calc NavMesh with all doors closed | Tag: default
2=> Pre-calc NavMesh with hallwayDoor open | Tag: cellHWOpen- This reply was modified 3 weeks ago by LightYarn.
June 17, 2022 at 11:42 pm #28114I think your problem is that you need to do this:
If the door is open =>
AddGraphTag(“cellHWOpen”)
ANDRemoveGraphTag("default")
to enemy AI
If it is closed again => ‘RemoveGraphTag(“cellHWOpen”)’ ANDAddGraphTag("default")
from enemy AIThe AI will only choose graphs that match all of its criteria. If the AI has both “default” and “cellHWOpen” then it can only use graphs that have both tags.
Note that the AI does NOT need to have all the tags that the mesh has. For example, an AI with no tags will match any graph. Any AI with “default” will match any graph with “default”, including graphs that have other tags too. An AI with “default” and “cellHWOpen” will not match a graph with just “default”.
Does that match what you are seeing?
June 19, 2022 at 6:11 am #28246No, unfortunately this didn’t make it work. The AI still uses the old path, ignoring the new NavMesh. It stays with it’s old calculated path
I noticed that the only way to force the AI to calculate a new path with the new possibility of passing the door is to completely deactivate the whole GO which holds the NavMesh “default”. Then it suddenly recons the “cellHWOpen” NavMesh and calculates a path through the door.
June 19, 2022 at 12:53 pm #28276What version of RAIN? I’ll go look - maybe what I looked at before is in the new patch and not yet released.
June 19, 2022 at 3:33 pm #28305I am using the Version 2.0.11.0. Is this the current version?
June 27, 2022 at 11:29 pm #289542.0.11 is current. Is this a project you can share so we can help debug?
June 29, 2022 at 5:50 am #29442I tried to delete all unnecessary things in the scene. It still might be a bit chaotic….but I hope you can orient yourself in there.
Thank you very much for offering this help =)
Here is the link to the project: http://iht.rdy2play.de/iht/graphtagissuescene.7z
-
AuthorPosts
You must be logged in to reply to this topic.