Search Unity

NavMesh.SamplePosition() not always returning closest point to sampled position

Discussion in 'Navigation' started by bagelbaker_legacy, Jun 12, 2015.

  1. We found a situation where NavMesh.SamplePosition() doesn't return the closest point to the sample position. In the attached picture, the sampled position is the red sphere and the result hit position is the white sphere.

    The expected result would be a point on the plane where the normal hits the red sphere. However, the actual returned result is always on the "internal edge" of the navmesh (white line on the blue navmesh). The bug only occurs near one of the horizontal white lines.

    In this test map, it only occurs if the plane slope is 45 degrees or more but in our game, we've seen it in smaller slopes.

    Reported bug case #702030. The reported bug was on Unity 5.0.2p2 but the issue is still there on Unity 5.1.0f3

    Anyone have any ideas about this?

    Actually, what would be the best way to get the the closest point on the navmesh below the sampled position, which is the position we're looking for, and not the closest point in 3D as is supposed to return NavMesh.SamplePosition()?
     

    Attached Files:

  2. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    121
    Was this ever solved? Having some similar issues in regards to SamplePosition.
     
  3. The bug case is still open and I never got any reply to it.
     
  4. Multithreaded_Games

    Multithreaded_Games

    Joined:
    Jul 6, 2015
    Posts:
    121
    Ridiculous that no one has chimed in here. My biggest issue is that a NavMeshAgent itself can usually resolve these kinds of problems when I am not manually moving the character using SamplePosition. What in the hell is being done 'behind the scenes' to make it work properly then?
     
  5. MorningSir_LY

    MorningSir_LY

    Joined:
    Oct 26, 2017
    Posts:
    1
    upload_2018-5-16_16-52-48.png
    Like this, the red sphere is NavMesh.SamplePosition() returned position. I don't kown why ...
     
  6. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    133
    Don't mean to necro but it might be something to do with the radius of the agent?