News Forums General Discussion Discussion on RAIN Navigation

This topic contains 10 replies, has 4 voices, and was last updated by  prime 4 weeks, 1 day ago.

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

    CodersExpo
    Participant

    So this week I will be posting information to the wiki on RAIN Navigation. The wiki currently has no detail on the AIRig element navigation section. I will fix that ASAP. I’m reaching out to all of you for information on what you know, what’s not clear, what specific information/tips you might find useful. Post your thoughts here and I’ll do my best to provide clarity on this topic or share any tips you may have. Keep checking the wiki as new stuff is posted daily!

    #10598

    redhawk
    Participant

    Okay, let’s see if this helps.

    - Multiple NavMesh = How do I create say 3 sized 100 NavMesh all with the same settings with each overlapping and my AI can transition from one to the other based on wherever there target is? For instance, they are chasing the player, they are on NavMesh 1 and Player is on NaveMesh 2.

    - Set Up = It’s always good to have both a RigidBody (constrain it except Position Y) and a collider (capsule works) so that your AI stays on the ground.

    - Example = How can you create links? For example ladder that goes up, small gap to jump from 1 building to the next, small gap to jump over a river instead of run a long ways to the bridge.

    - Recommended setup = Good setup for standard character size (I use default normally).

    #10625

    CodersExpo
    Participant

    Thanks redhawk. I’ll do my best to incorporate these thoughts into appropriate projects.

    BTW - not sure if you’re asking a question or offering a suggestion in your first point on this list. You can add multiple navigation meshes. They do need to overlap for the AI to chase after the entity objects. Also, you must have no Graph Tag defined or have tags added for all nav meshes you want the AI to be able to move on to.

    Here is a question for anyone of you reading this. What are Graph Tags used for and how do you define them in the AIRig? What other RAIN component must you define the tag name? I’ll provide an answer to this challenge in 1 day.

    #10626

    CodersExpo
    Participant

    Oh …and no fair if members of Rival Theory answer this

    #10643

    redhawk
    Participant

    Thanks for the tip, I will try that. I never knew whether or not you could do multiple meshes. So all they need to do is overlap? I’ve also never used a Graph Tag, so not sure what that’s for. Maybe this would be a good chance for a project with an odd shape (maybe a Plus symbol) with multiple meshes and graph tags (I guess it’s for different sized things but if that’s the case, then I must be setting my navmeshes up wrong).

    #10682

    CodersExpo
    Participant

    What are Graph Tags used for and how do you define them in the AIRig?
    - Graph Tags are a way to group multiple navigation meshes under a common name.
    - With the meshes “tagged”, you can use this to define which graphs your AI can walk on.
    - This is done in the AIRig under Navigation Graph Tag.
    - You can assign nothing and the AI will walk on all Navigation Meshes (default behavior). Or, you can assign 1 or more Graph Tags by entering a number and adding the names of the Graph Tags associated with the Navigation Meshes you want your AI to be able to walk on.

    What other RAIN component must you define the tag name?
    You need to select the navigation mesh(s) in your hierarchy. On the Navigation Mesh Rig at the top, add a Graph Tag name. This name will be the Graph Tag name you use in the AIRig’s Navigation.

    Now you can have multiple navigation meshes and constrain which of them your AI should use through Graph Tags.

    I found it necessary to write a little code to change the AI animation and behavior when chasing someone who moves onto another mesh. He would stand there with his ‘run’ animation looping as long as he was detecting the target. I’m not sure if there is a better way to modify the AI behavior when this happens but a couple lines of code was all it took.

    So this is my interpretation of how this works. I’ll hand this over to someone on the Rival Theory team to confirm. We may also want to discuss Ignore Tags and Unwalkable Tags since we’re on the topic of tags.

    Once we are certain, I’ll add the notes and example to the wiki.

    #10684

    CodersExpo
    Participant

    Quick update…

    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.

    Also, use ‘Ignored Tags’ to associate colliders you want to have excluded from the mesh generation and ‘Unwalkable Tags’ with colliders you want to have completely unwalkable. For example, if you generate a mesh and see that it is creating a walk-able area on top of a building, you can add an ignore tag ‘building’ in the Navigation Mesh Rig. Then select the building game object and create a tag with the same name ‘building’ and assign that to your building object. Then re-generate your mesh.

    #10696

    CodersExpo
    Participant

    So I wanted to ask Rival Theory team a question….

    “I found it necessary to write a little code to change the AI animation and behavior when chasing someone who moves onto another mesh that is not in the AIRig’s navigation Graph Tag list. The AI character would stand there with his ‘run’ animation looping as long as he was detecting the target.” - from above

    So I tried this code…

    if(ai.Motor.moveTarget != null)//Make sure we have a target
          {
                ai.Navigator.GetPathToMoveTarget(out path);  //get path
                if(path == null) //Once the AI moves onto the other graph the path is null
                {
                    ai.Senses.DisableSensor("eyes"); //I want to stop sensing. This is where it causes Unity to lock up and I have to kill the process
                }
          }

    Is there a better way??

    #11216

    CodersExpo
    Participant

    Keeping this thread alive. Need more input so we can improve this section of the wiki…and maybe even get a project or video out on this topic. What say all of you?

    #34883

    KB
    Participant

    Well, I was following this thread and would like to have seen a conclusion to what CodersExpo was asking with the code snippet.

    #34886

    prime
    Keymaster

    I’ll be able to give a better answer if I understand the use case.

    RAIN no longer fails to return a valid path when something moves off the mesh. Instead, it will move along the best path it can, and then the behavior tree move node will either fail or succeed depending on whether it reached its target. You can use the return value of the move node to figure out if you reached the target, but in both cases it will return and give you a chance to switch animations.

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

You must be logged in to reply to this topic.