Search Unity

Edit auto-generated offmeshlinks for Jumping Up?

Discussion in 'Navigation' started by OhNoDinos, Apr 10, 2016.

  1. OhNoDinos

    OhNoDinos

    Joined:
    Feb 16, 2014
    Posts:
    6
    Hi all, I've been banging my head against this for a while.

    Baking the navmesh allows for auto-generated offmeshlinks for jumping across gaps or dropping down. But for whatever reason, having the drop-down links go both ways - to allow agents to jump back up - isn't allowed by default, even though the gap-jumping ones are automatically bi-directional.

    It seems strange that this functionality would just be missing. I've seen answers saying that you just have to place offmeshlinks by hand, but this is hugely impractical when the engine seems capable of doing it already. Is there really no way to have the auto-generated ones go both directions? An editor extension maybe?

    Thank you for any help!
     
  2. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Hi, I'm alsol struggling with this problem. Did you ever find a solution?
     
  3. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    You might have to manually create a link and uncheck bi-directional.
     
  4. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    or set agent.autoTraverseOffMeshLink = false
    You handle the animation from the startPos to endPos. Don't allow animation from endPos to StartPos.
     
  5. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Thanks for replying but how does that fix the problem? The auto generated offmesh links are for jumping down only, we need them to be bidirectional so our agents can also jump up on the same links.

    Is it possible to force an agent to use offmesh links in reverse direction?
     
  6. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    oh, I thought you wanted oneway.

    You can check agent.isOnOffMeshLink and then trigger an animation to jump up.
    You can get the startPos with agent.currentOffMeshLinkData.startPos
     
  7. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    And how does that fix my problem with the offmeshlinks not allowing me to jump up?

    I dont want to create all mesh links manually, I want to either:

    1- Figure out how to have all auto generated off mesh link be bidirectional

    OR

    2- Figure out how to use a SINGLE direction off mesh link in reverse.

    OR

    3- Find another tool to generate off mesh links for the unity navemesh.
     
  8. TobyWu

    TobyWu

    Joined:
    Oct 10, 2019
    Posts:
    7
    Still struggled on this question, are there any good solutions?
     
    IndieFist likes this.
  9. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Do you have found an easy solution?
     
  10. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    @IndieFist Nope still nothing, I've been looking into A* pathfinding pro's documentation which mentions off mesh links but isn't clear about how to create and use them. I need to ask the dev.

    Looking at mistergreen2016's previous answers we may be able to do it with the Unity NavMesh using "agent.isOnOffMeshLink" to initiate some verification, if closer to startPos or endPos (get them from agent.currentOffMeshLinkData) we know if we should go up or down then check the obstacle's height to run the proper behavior (anim + code).

    But this is all guessing, I'm going to work on this in the coming weeks.
     
    Last edited: Mar 11, 2021
    IndieFist likes this.
  11. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Yes, right now im using this system, check if agent is closest to endPos or StarPos and do whatever...
    Right now i have other problem, agent does not update my transform rotation in hard surfaces like a wall with two sides where can walk.