So given the position, halfextents and rotation of a Physics.OverlapBox, how would I draw it on the screen for debugging.
Any advice appreciated, thanks.
So given the position, halfextents and rotation of a Physics.OverlapBox, how would I draw it on the screen for debugging.
Any advice appreciated, thanks.
Just wanted to mention that in Unity 2022.1 (that is about to be released soon), there is a new mode that shows all the queries natively. Check this out: Physics Debugger Improvements
thanks for your reply. is there a way to do it currently? this is kind of blocking on my development atm ![]()
I’ve tried various things playing around in OnDrawGizmos() and using Gizmos.matrix and Gizmos.DrawWireCube, but nothing seems to be coming close yet.
I think if I could figure out what I need to set Gizmos.matrix to and what parameters to feed Gizmos.DrawWireCube I might have success, but so far no luck.
This draws a box. What you want to draw is a box. If it isn’t drawing what you want (somehow) you are therefore using it wrong.
The same as the Transform matrix likely: https://docs.unity3d.com/ScriptReference/Transform-localToWorldMatrix.html
What’s to figure out? Use the above and draw the box in the local-space of the GameObject. The docs are here and its args are pretty simple: https://docs.unity3d.com/ScriptReference/Gizmos.DrawWireCube.html
Something along these lines:
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawWireCube(Vector3.zero, myCubeSize);
ok thanks, it was my misunderstanding about matrixes that was the issue. got it and it works now.
today is a good day to smile ![]()