Course contentsShow
← Unity Game Development
Lesson 208 of 8283. Physics and InteractionFree lesson

Visualizing Physics Collisions and Triggers

Learners will use the Physics Debugger window to inspect collider boundaries and identify overlapping geometry issues in real-time.

In this lesson, you will learn how to use the Physics Debugger window to see the "hidden" boundaries of your objects and catch overlapping colliders before they cause physics glitches.

Seeing the Invisible

When you place a Collider on a GameObject, it often doesn't perfectly match the visual mesh of your 3D model. If two colliders overlap accidentally, or if a trigger volume is slightly offset, your physics-based objects might get stuck or behave erratically. Because these boundaries are invisible during normal gameplay, they are often the source of "phantom" collisions.

Using the Physics Debugger

To see these boundaries, go to Window > Analysis > Physics Debugger. This panel allows you to visualize your scene’s physics configuration in real-time.

  1. Show All Colliders: When you toggle this on, Unity highlights every collider in your scene with a colored outline.
  2. Highlight Triggers: You can set the debugger to specifically color-code your triggers (like those used for your physics-based traps or doors), making it easy to verify that they are positioned exactly where you intended.
  3. Real-Time Inspection: If you keep this window open while the game is running, you can move objects and watch how their bounding boxes interact. This is perfect for debugging your FixedUpdate logic or ensuring that your complex joints aren't causing colliders to clip into each other during movement.

Identifying Overlaps

If you notice an object jittering or behaving strangely, turn on the Show All Colliders setting and look for intersecting wireframes. If two static colliders are overlapping, they might be conflicting with the physics engine’s solver. If you see a trigger volume that should be detecting a player but is actually floating inches away from where it needs to be, you can adjust the Center or Size properties of your BoxCollider or SphereCollider in the Inspector while watching the update in the Debugger.

This tool transforms "guesswork" into precise visual feedback, allowing you to maintain a clean and predictable physics environment for all your mechanical systems.

Key Takeaway: The Physics Debugger is your primary diagnostic tool for validating that your colliders and triggers are correctly placed, preventing erratic physics behavior by making invisible boundaries visible.