Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

AI immediately skips over navmesh surface

Discussion in 'Navigation' started by hesrayilmaz, Aug 25, 2022.

  1. hesrayilmaz

    hesrayilmaz

    Joined:
    Feb 20, 2022
    Posts:
    4
    Hi,
    I have a floor which the AIs walks on normally, but when they go upstairs and there is finish platform (so different navmesh surface and data) they don't walk on it. But they also don't stuck, just immediately skips over that surface. But if this is not the finish floor and the clone of normal floor there is no problem, they continue to walk normally. When they reach the finish floor, I disabled the set destination function to check if it's related to it but it is not. And there is no other code to change their position.

    I also tried adding navmesh link between two floors, maybe it's because of the link. But I don't know I'm doing it correctly. I have no idea other than that.

    This is the video of that part:
     
  2. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    How are you doing so the AI walks between the 2 Areas using the Ladder?

    Maybe that is causing the AI Walking up the "Stairs" thinking the AI is moving forward, so when they are up, they straight get moved to the end?
     
  3. hesrayilmaz

    hesrayilmaz

    Joined:
    Feb 20, 2022
    Posts:
    4
    When they come to the ladder I disable navmesh agent and move them manually by using dotween doMoveY function. When ladder ends I enable navmesh agent again. (Actually I tried checking if there is a problem about enable/disable but I couldn't figure out anything. Changing them caused other problems but maybe still this is the problem and I couldn't manage it.)

    Also like I said before, if there is the clone of the first floor instead of the new platform, there is no problem. After climbing ladder they walk on the surface. So I didn't associate the problem with ladder.

    I'd like to add that I have never used navmesh before, because of that I don't know if there is something simple I missed.
     
  4. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    I would suggest, after reaching the ladder, dont disable the navmesh (or do so if needed) but before, set agent to be stopped, since you disable it and enable it, he straight try to move towards the destination (what he should do) but maybe thats causing the problem, ofc. after reaching the top of the ladder, you need to reassign the destination.

    Weird is that if you copy paste the platform that it does work but by adding a new one, he fly through, if you find the solution, would love to hear it
     
  5. hesrayilmaz

    hesrayilmaz

    Joined:
    Feb 20, 2022
    Posts:
    4
    I will try it and okay if it is solved I will inform.

    Thank you:)
     
    Terraya likes this.
  6. hesrayilmaz

    hesrayilmaz

    Joined:
    Feb 20, 2022
    Posts:
    4
    Eventually I found the problem.. It isn't related to navmesh, there is just a silly mistake in my code about changing a boolean value that blocks the movement of AIs:/
     
  7. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646