Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Help with object in path

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

  1. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    331
    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:
    360
    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.
     
    IndieFist likes this.
  3. IndieFist

    IndieFist

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