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.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #27801

    LightYarn
    Participant

    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 AI

    This 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?

    #27980

    CodersExpo
    Participant

    I 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.
    #28020

    LightYarn
    Participant

    Hey thanks for your help! =)

    But I already assigned the Tags to the NavMesh and the AI.
    Here some pictures of my setup

    Link 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?

    • This reply was modified 3 weeks ago by  LightYarn.
    • This reply was modified 3 weeks ago by  LightYarn.
    • This reply was modified 3 weeks ago by  LightYarn.
    #28026

    CodersExpo
    Participant

    How 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…

    #28027

    LightYarn
    Participant

    The 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.
    #28114

    prime
    Keymaster

    I think your problem is that you need to do this:

    If the door is open => AddGraphTag(“cellHWOpen”) AND RemoveGraphTag("default") to enemy AI
    If it is closed again => ‘RemoveGraphTag(“cellHWOpen”)’ AND AddGraphTag("default") from enemy AI

    The 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?

    #28246

    LightYarn
    Participant

    No, 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.

    #28276

    prime
    Keymaster

    What version of RAIN? I’ll go look - maybe what I looked at before is in the new patch and not yet released.

    #28305

    LightYarn
    Participant

    I am using the Version 2.0.11.0. Is this the current version?

    #28954

    prime
    Keymaster

    2.0.11 is current. Is this a project you can share so we can help debug?

    #29442

    LightYarn
    Participant

    I 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

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.