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. Dismiss Notice

Question Which collider does Physics.BoxCast return?

Discussion in 'Physics' started by HoiTemmieColeg, Jul 26, 2023.

  1. HoiTemmieColeg

    HoiTemmieColeg

    Joined:
    Aug 6, 2018
    Posts:
    6
    In Physics.BoxCast, the variant that only returns one hit instead of all, is the collider returned guaranteed to be the closest one?

    Thanks,
    Gavin
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,394
    Similar to raycast, it should use the first collider it hits
     
  3. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    577
    Yes, that's the closest blocking hit (in physx speak)
     
    Edy likes this.
  4. HoiTemmieColeg

    HoiTemmieColeg

    Joined:
    Aug 6, 2018
    Posts:
    6
    Appreciate it!
     
    DevDunk likes this.