Welcome to the feedback forum for the Physics Debug Visualization.
What is the Physics Debugger?
It can sometimes be hard to tell what objects in your scene should and should not be colliding, especially when the Render and Collision meshes are out of sync. To help you quickly inspect the collision geometry in your scene we’re adding a debug view mode for physics collision geometry to let you spot problems right away.
How Can I Get It?
[quote]
Please remember to back up your projects before opening them in a custom build
[/quote]
Download Windows and Mac Editors
[5.5.0f3]: http://beta.unity3d.com/download/22a2ba31cb97/public_download.html
[5.5.1p1]: http://beta.unity3d.com/download/7bef31968871/public_download.html
This tool is available in the Editor by selecting Window > Physics Debugger from the main menu. The tool is intended to help you quickly inspect the physics world and profile common scenarios. Feature development will be incremental and additional features such as raycast support are planned.
When you first open it, the tool lets you quickly select GameObjects with collision geometry and can also highlight simulating Rigidbodies for debugging physics performance issues.
From this window, you can customize visual settings and specify if there are certain types of objects you want to see or hide.
Here we can take a look at some features that enable control of the filtering and presentation of found Colliders
A small overlay also appears in the corner of the scene view with further options.
Revealing Collision Geometry
Normal Render geometry can accidentally hide Colliders, like a plane MeshCollider below a floor. By picking the “Force Overdraw” rendering mode the visualization will draw the Colliders on top of the Render geometry.
Profiling
With a few clicks common performance issues can be easily spotted.
Active Rigidbodies
The visualization can be made into a physics collision profiler by hiding Static Colliders and Sleeping Bodies. The result is that only the expensive simulated Rigidbodies are shown.
MeshColliders with concave (triangle) meshes
The concave (triangle based) MeshColliders tend to generate the most contacts when Rigidbodies are very near a collision with another Rigidbody or a Collider.
You can visualize the concave MeshColliders by switching the Workflow to “Show Selected Items” mode, pressing “Show None” and selecting “Show MeshColliders (concave)”.
What Else Is Coming?
- A port for Unity 5.4.
- Visualize raycasts.
- Visualize contact points.
- Visualize joints.
- Show possible collisions only from current Colliders point of view.
- Show what callbacks will be sent to colliders and triggers based on their current settings.
- Nicer shading.
- Timeline recording and scrubbing.
- Network support.
Scripting API
(Real script reference has proper documentation)
namespace UnityEditor
{
class PhysicsVisualizationSettings
{
enum FilterWorkflow
{
HideSelectedItems = 0,
ShowSelectedItems = 1,
}
enum MeshColliderType
{
Convex = 0,
NonConvex = 1,
}
static void InitDebugDraw () ;
static void DeinitDebugDraw () ;
static void Reset () ;
static bool GetShowStaticColliders (FilterWorkflow filterWorkflow) ;
static void SetShowStaticColliders (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowTriggers (FilterWorkflow filterWorkflow) ;
static void SetShowTriggers (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowRigidbodies (FilterWorkflow filterWorkflow) ;
static void SetShowRigidbodies (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowKinematicBodies (FilterWorkflow filterWorkflow) ;
static void SetShowKinematicBodies (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowSleepingBodies (FilterWorkflow filterWorkflow) ;
static void SetShowSleepingBodies (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowCollisionLayer (FilterWorkflow filterWorkflow, int layer) ;
static void SetShowCollisionLayer (FilterWorkflow filterWorkflow, int layer, bool show);
static int GetShowCollisionLayerMask (FilterWorkflow filterWorkflow) ;
static void SetShowCollisionLayerMask (FilterWorkflow filterWorkflow, int mask) ;
static bool GetShowBoxColliders (FilterWorkflow filterWorkflow) ;
static void SetShowBoxColliders (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowSphereColliders (FilterWorkflow filterWorkflow) ;
static void SetShowSphereColliders (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowCapsuleColliders (FilterWorkflow filterWorkflow) ;
static void SetShowCapsuleColliders (FilterWorkflow filterWorkflow, bool show) ;
static bool GetShowMeshColliders (FilterWorkflow filterWorkflow, MeshColliderType colliderType) ;
static void SetShowMeshColliders (FilterWorkflow filterWorkflow, MeshColliderType colliderType, bool show) ;
static bool GetShowTerrainColliders (FilterWorkflow filterWorkflow) ;
static void SetShowTerrainColliders (FilterWorkflow filterWorkflow, bool show) ;
static FilterWorkflow filterWorkflow { get; set; }
static bool showCollisionGeometry { get; set; }
static bool enableMouseSelect { get; set; }
static bool useSceneCam { get; set; }
static float viewDistance { get; set; }
static int terrainTilesMax { get; set; }
static bool forceOverdraw { get; set; }
static Color staticColor { get; set; }
static Color rigidbodyColor { get; set; }
static Color kinematicColor { get; set; }
static Color triggerColor { get; set; }
static Color sleepingBodyColor { get; set; }
static float baseAlpha { get; set; }
static float colorVariance { get; set; }
static float dotAlpha { get; set; }
static bool forceDot { get; set; }
static void UpdateMouseHighlight (Vector2 pos);
static void ClearMouseHighlight () ;
static bool HasMouseHighlight () ;
} // PhysicsVisualizationSettings
} // UnityEditor
Update History
2016-12-07
- Update to Unity 5.5.0f3.
- UI overhaul. Toolbar introduced. Filtering foldout removed. Things got smaller.
- Fixed a bug in the Layer masking code.
- Green is now used for Static Colliders and red for Rigidbodies.
- “Non-convex” change to “concave”.
2017-01-02
- Update to Unity 5.5.1p1.