News Forums RAIN General Discussion and Troubleshooting AI moves between disconnected navmeshes

This topic contains 11 replies, has 3 voices, and was last updated by  prime 2 years, 9 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #5159

    Chris
    Participant

    The NavMesh in green: https://www.dropbox.com/s/ys6sj611xanm8i1/Screenshot%202013-11-09%2018.54.44.png

    The AI starts in a green area, moves towards the player, but always chooses the shortest path through walls (ignoring NavMesh). The NavMesh is generated during runtime.

    At the moment I just have one plane as floor. Limiting the floor to walkable areas would probably solve the problem. But still, it seems odd that the AI can walk between NavMeshes?

    #5216

    Chris
    Participant

    In short, the AI moves between disconnected areas in the NavMesh.

    Let me know if the picture is bad.

    #5228

    prime
    Keymaster

    Probably the same issue a lot of people have been mentioning. Your capsule is likely not “on” the navmesh. If you are using a Unity shape primitive (like your capsule collider or a sphere or cube) the transform is at the middle of the object, which is probably something like 0.5 above the ground. The AI does not consider itself on a NavMesh if its transform is greater than step-up height above the mesh. You want your Body transform to be right on the ground.

    To solve the problem, create an empty game object as a new parent for your capsule. Place it directly on the ground (say 0,0,0). Make your capsule a child of the empty object and set its transform so it is on the ground too (for the capsule, that means it will be at something like 0,.5,0 relative to the parent, depending on the capsule size.) Then, change your AI Body to point to the parent, not the capsule. That should fix it.

    #5230

    Chris
    Participant

    My AI is set up exactly as you specify. And it does work perfectly in another level with obstacles/walls that has a premade mesh (so the navmesh is generated before runtime).

    Navmesh: https://www.dropbox.com/s/oxnd8edg171lt01/Screenshot%202013-11-12%2017.53.07.png
    Preview collision meshes: https://www.dropbox.com/s/50qak4m8wcchab7/Screenshot%202013-11-12%2017.53.38.png

    (Another oddity: in the navmesh screenshot you can see small hill between left and middle room)

    #5235

    prime
    Keymaster

    Sorry, you are saying it works with navmeshes created at design time, but not navmeshes created at runtime?

    #5242

    Chris
    Participant

    Yes, exactly. And using the “Generate NavMesh” button in the GUI does not help.

    The screenshots are from the scene wherein I generate mesh and navmesh at runtime. As you can see in the later screenshots I generate a floor within the walls now instead of one big plane (as in the first screenshot).

    • This reply was modified 2 years, 9 months ago by  Chris.
    #5245

    Chris
    Participant

    After doing more testing it seems that the AI ignores the navmesh generated at runtime. It simply uses the navmesh created at design time (regardless of how I generate the navmesh at runtime).

    Is it possible to tell the AI to update how it sees the navmesh or something similar?

    #5322

    Chris
    Participant

    Shameful bump

    #5324

    prime
    Keymaster

    After generating the navmesh at runtime, you need to:

    navMesh.Name = "whatever";
    navMesh.GenerateNavMeshGraph();

    and to disable it

    navMesh.ResetGraph();
    #5333

    Chris
    Participant

    Thanks, it worked!

    #5374

    Evilworm
    Participant

    I can’t make my enemies run around objects anymore. Navmesh doesn’t seem to work in 2.06. Or I am stupid. Anyway, my enemies are running through all objects they walked around in 2.05.

    #5386

    prime
    Keymaster

    2.0.6 fixed an issue that was allowing AI to use NavMeshes that were not within a valid height offset. If your AI is not obeying the NavMesh, it most likely means that the Body transform is not on the ground. We posted a video in the Tutorials tab that discusses basic rigging and some problems you might see.

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

You must be logged in to reply to this topic.