Search Unity

Help with object in path

Discussion in 'Navigation' started by MrPacoGP, Jul 10, 2019.

  1. MrPacoGP

    MrPacoGP

    Joined:
    Jul 18, 2013
    Posts:
    296
    Hi!
    I`m a bit confused with some part of code navigation, i have some doors in my map and i want to do a raycast to the door only if this is in my path. But how can i do it? like a navmesh obstacle?
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    313
    You could take the object's bounding box and the corners of the path, then check for each path segment if it goes through the object's bounding box using Bounds.IntersectRay.
     
    MrPacoGP likes this.
  3. MrPacoGP

    MrPacoGP

    Joined:
    Jul 18, 2013
    Posts:
    296
    Thank you, i will check it!