Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Test if a collider can be seen from a point

Discussion in 'Physics' started by SkinnyDinner, Dec 8, 2020.

  1. SkinnyDinner

    SkinnyDinner

    Joined:
    Feb 13, 2016
    Posts:
    8
    I know that physics.raycast can be used to detect if a collider is in between two points, but i was wandering how to test if a point can see ANY part of a collider

    This would be much better because a plain raycast would not hit the target collider with even the smallest collider in between the center points. For example, an npc wouldnt be able to see another object ten times its size just because of a small rock in between.
     
  2. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    296
    I created a thread long time ago exactly about this. Maybe it could help you

    https://forum.unity.com/threads/check-if-a-collider-is-visible-from-a-position.424760/#post-2754912
     
  3. SkinnyDinner

    SkinnyDinner

    Joined:
    Feb 13, 2016
    Posts:
    8