Physics.BoxCast not detecting any hits

My problem is simple I’m using using:

if (Physics.BoxCast (position, new Vector3 ((objectToSpawn.transform.localScale.x / 2), (objectToSpawn.transform.localScale.y / 2), (objectToSpawn.transform.localScale.z / 2)), Vector3.zero, out hit)) {
            }

To try to detect obstacles, but no matter where the cast is it always returns false and the hit is always null.

I worked out the problem which is that the cast wont detect an object it starts in.

2 Likes