This tool allows you to visualize geometry queries – raycasts, sweeps and overlaps.
Tool is using gizmos to draw shapes. Detailed information below.
Physics visualization methods are implemented in such a way that they can be quickly used.
For example, if we want to visualize a method from the Physics or Physics2D class, just copy the method and add the word “Debug” before the copied line of code.
What can we visualize?
Visualized methods from the Physics class:
Visualized methods from the Physics2D classes:
For methods from the classes Rigidbody, Rigidbody2D, Collider, Collider2D, RaycastCommand, BoxcastCommand, CapsulecastCommand, SpherecastCommand we need to add the word “Debug” before the name of the method.
Visualized methods from the Rigidbody, Rigidbody2D, Collider, Collider2D, RaycastCommand, BoxcastCommand, CapsulecastCommand, SpherecastCommand classes:
More information you can find in documentation!
Under the hood – very important!
The methods for visualizing physics use the built-in Gizmos mechanism.
For the gizmos to be displayed, we need to make sure if the gizmos are active at the moment.
In order to be visible in the Game window, this button must be pressed:
The physics visualization methods only work in the editor. After compilation it will not be able to be displayed.
When calling visualization methods, a gameobject called GizmosFromEverywhereManager is created in the scene with a script that calls the visualization methods.
If we collapse the script, the gizmos will also disappear, similar to the usual gizmos created with the OnDrawGizmos method.