Search Unity

Resolved Visualize generated Physics Colliders in scene

Discussion in 'Physics for ECS' started by slushieboy99, Sep 5, 2021.

  1. slushieboy99

    slushieboy99

    Joined:
    Aug 29, 2014
    Posts:
    88
    Currently I don't see any way to visualize a meshcollider generated at runtime, so I have no idea what it looks like unless I create a separate entity with the same rendermesh. It would be nice to be able to view physics colliders like we can with GameObjects.
     
  2. CookieStealer2

    CookieStealer2

    Joined:
    Jun 25, 2018
    Posts:
    119
    Have you tried making a gameobject and attaching a physics debug display component? upload_2021-9-5_19-55-16.png
    It can be somewhat buggy, but should be able to display the colliders.
     
  3. slushieboy99

    slushieboy99

    Joined:
    Aug 29, 2014
    Posts:
    88
    Yeah I tried that, but doesn't seem to display my meshcolliders, not sure why.
     
  4. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
    Make sure Gizmos are turned on in the tab you are trying to see the colliders. IIRC by default Gizmos are on in the Scene tab but off for the Game tab.
     
    JMPM-UNITY likes this.
  5. slushieboy99

    slushieboy99

    Joined:
    Aug 29, 2014
    Posts:
    88
    Ah that worked, thanks!
     
  6. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    761
    0.51 with in a blank scene with 2 meshes and 3 box colliders and gizmos enabled in game and scene view:

    Enable "Draw Colliders" only --> FPS drops to 3, random meshes disappear, glitchy grey outlines on some things but it's impossible to tell where the colliders are. Totally Useless.

    For "Draw Collider Edges", I get 100+FPS, but initially nothing displayed. I was using a single Debug.DrawLine() call. Then I used Debug.DrawLine() to draw the collider box myself around the entity and suddenly the Physics Debug Display started drawing it too. I disabled it and re-enabled it several times to be sure that's what was happening and sure enough, every single time for some reason my adding more Debug.DrawLine near the entity magically made Physics Debug Display start working.

    So in conclusion... yeah Physics Debug Display is buggy.