Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Line Renderer Cutting Into Geometry

Discussion in 'Navigation' started by xidifen, Jul 21, 2019.

  1. xidifen

    xidifen

    Joined:
    Jul 21, 2019
    Posts:
    3
    Hi all,

    I've been trying to create a pathfinding line between my navmesh agent and destination for a project that provides the user with a path to wherever he/she wishes to go within the vicinity. However, I've been encountering cases where my path created by the Line Renderer function cuts into the geometrical bodies, and I'm not exactly sure of the parameters that I can play with in order to avoid this situation. Does it have to do with the agent or baking parameters, or the line renderer function? Attached some images of my line cutting the steps, as well as my NPC move script. Appreciate any kind soul's assistance. Thanks!
     

    Attached Files:

  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    381
    Maybe just offset your line renderer to float safely above the floor? Just take the corners and add a Vector3.up to each of them.
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,596
    Peter77 likes this.
  4. xidifen

    xidifen

    Joined:
    Jul 21, 2019
    Posts:
    3
    Hi all, now I have a new problem instead of the line cutting across the stairs. I realise my line renderer now no longer traverses along the slope, but it goes off tangent at the start of the slope angle, as shown in the image. Why is the navpath not sticking to the surfaces prescribed by the baked navmesh?

    Is there anything to do with the height mesh? voxel size? baked agent settings (radius, height, slope, step height, etc)?

    I'm also concerned if all the building and ground geometries need to belong to a same family of sorts? e.g. prefab, child-parent?
     

    Attached Files:

  5. xidifen

    xidifen

    Joined:
    Jul 21, 2019
    Posts:
    3
    Hi, anyone who can help with this?

    I've tried various ways and still facing the same set of problems. My line keeps cutting across the surfaces and flies above the surfaces, instead of following closely to the baked surfaces. Does Navmesh work on slopes? Do I really need to use stairs instead of a plane/sloped cube? It seems for my case the problem occurs when Navmesh is not able to navigate my stairs properly.

    Any advice from the developer, please?
     
    Last edited: Jul 28, 2019
  6. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    381
    Slopes really shouldn't be the issue here. Are you certain your NavMesh is properly following the slope there? How does your agent move? Following the slope more, or following the line?