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

Feedback Add a remark for Physics cast methods

Discussion in 'Documentation' started by BakeMyCake, Dec 23, 2020.

  1. BakeMyCake


    May 8, 2017
    I've spent more time than I'd like to admit, debugging a strange case where my BoxCast-dependent code would suddenly teleport objects to the origin of the world. The issue turned out to be an unexpected feature of the API that all functions working with RaycastHit can potentially return 0 as the hit point.

    I believe this is not apparent from the API documentation and should be warned about. I did not find any mention of it in any of the documentation I initially searched:

    The only place I've found, where this is described is here
    After discovering this I was able to locate a lot of forum discussions describing and explaining it in detail, the problem here is that at that point I've already lost time debugging it myself. This is a classic case of something incredibly simple being difficult to discover naturally by virtue of not knowing the magic keywords to type in search beforehand. To save anyone else the trouble I suggest mentioning this nuance in more places in the API documentation to improve user experience.

    As it stands, it seems you can only discover this either by running head-first into the very same issue, or if you happen to be using SphereCastAll specifically.