Is the example of Physics.BoxCast and Gizmos.DrawWireCube in the docs inaccurate?

Regardig the docs: Unity - Scripting API: Physics.BoxCast
the parameter halfExtents is a vector3 with HALF the size of the boxcast in each dimension…

And in the example says:
m_HitDetect = Physics.BoxCast(center, transform.localScale, transform.forward, out m_Hit, transform.rotation, m_MaxDistance);

But after that, the draw gizmo example we see in the same page they do:

Gizmos.DrawWireCube(transform.position + transform.forward * dist, transform.localScale);

So my question… isn’t the boxCast or the Gizmo draw missing a division by 2?
The boxcast expects half of the size… but then the Gizmo is drawing the full size,
To my understanding the Gizmo would be drawing a box twice as big as the BoxCast actually is casting.

Yeah, that looks incorrect because AFAIK DrawWireCube takes the full size of the cube.

@yant

2 Likes