Search Unity

Problem with character footing

Discussion in 'Navigation' started by AndersMalmgren, Feb 28, 2018.

  1. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hey guys.
    We use the Unity navmesh for our upcoming NPCs

    But the feet grounding is not working very well. When it steps up and down from smaller height differences like a pavement or staircase its not a smooth transation but a rather a teleport. Also when walking on uneven terrain it looks very funny. I have had trouble finding resources on how to fix these things. If you guys can give me any pointers I would be grateful. Here is a vid showing them in acttion, the animation controller is missing rotation animations and some other stuff, please ignore that.

     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I'm not too familiar with navmesh - yet, however it looks to me like the teleport that is happening should be performed over a set time (between 5-10 frames) rather than instantaneous as it is happening now. I don't code so I don't know the correct terminology for this - I would call it a tween from Y height to Y+height based off the elevation change, but I think maybe the proper terminology is lerp?

    You might be able to deconstruct one of these free packs to see if the functions they use to change elevation work for your current setup.
    Invector 3rd person controller. mecanim controlled with documentation available in the description.

    Locomotion system - legacy animation setup.
     
  3. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    We let the navmesh do all the footing, so its nothing thats driven from code. Since the built in system support doing this work I feel there must be a way of fine tuning it? Thanks will have a look.
     
  4. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Look at your navmesh. What does it look like?
     
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    The settings?
     
  6. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Its a bit unclear what you ask for, here is the navmesh
     
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    ops, posted before forum was ready with the image

    upload_2018-3-1_16-47-24.png
     
  8. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    We have some IK for the left hand so it grabs the frontgrip of weapon, I disabled the IK pass for that layer and the character is still reacting strange to uneven terrain. The navmesh is doing something undocumented here?
     
  9. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    What does hand IK have to do with navmesh? How would turning on/off that pass effect the root node elevation in any way?
    This is for feet right? What is controlling the root node of the character - navmesh right? But how - this is what is causing the sudden jump of the character - the root node changes height instantly once the nav mesh tells (the controller?) the feet are changing elevation.
     
  10. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    If you have one script doing IK for hands and feet then it's fired when the layer's IK pass is called, so he's just disabling the whole pass so it doesn't get invoked.

    It's definitely not following the vertical slope of the navmesh.

    The only thing I can think of is that the Y axis isn't considered with navmesh agent navigation. Really, if the navmesh is disconnected then the agent will route to its destination through nearest connected corners. In this case the navmesh is sloped and connected instead of disconnected so the XY seems to be working and the step distance is enough to allow it to "step" up the abrupt height change immediately as the agent follows the collider outline. Technically, this is good.

    I think you'll have to manage the root position manually if you want this to improve. I'm not sure if there are any built-in options to make this behavior smoother.
     
    theANMATOR2b likes this.
  11. havchr

    havchr

    Joined:
    Jun 18, 2009
    Posts:
    75