Physics Debugger Improvements

Hello,

We’ve been reworking some of the UI/UX aspects of the built-in physics debugger lately, and I’d love to share some early progress with you on this thread. Here is a link to an experimental build that I’ve prepared: https://beta.unity3d.com/download/cd910d1ebf55/public_download.html

Here is a short description of what has been addressed so far:

  • Split the Physics Debug window into Filtering, Rendering, Info, and Contacts tabs for easier access and space management

  • Moved the Rigidbody and Articulation Body info sections to the Info tab (and added some more info for debugging)

  • Added the option to visualize the center of mass or the inertia tensor of Rigidbodies or Articulation Bodies that are being tracked in the Info tab

  • Added Contact visualization that can be filtered by using settings in the Filtering tab

Known limitations:

  • Changing filtering settings while stepping frame by frame during Play Mode will not take effect until the next simulation step

  • Turning on the Show All Contacts option during play mode will not show contacts of Colliders that have already been initialized.

Things that are being considered:

  • In addition to being able to filter by Physics Scene, add an option to filter by Unity Scene.

  • Expose Rigidbody and Articulation Body velocity and acceleration accumulators. This could be employed to get an estimate of the total external force applied this frame

Let me know what you think, can’t wait to hear any feedback.

Augustinas

6 Likes

Hello!
Nice Job!
But Inertia Tensor and Mass Gizmos becomes almost invisible when they are located inside a collider

here transparency at the 0.5f

here transparency close to zero: now they are almost invisible

Moreover, Childs of articulation bodies Mass and inertia tensor Gizmos is not available

1 Like

Hmm, the transparency could definitely be bumped up here.

Just checked this, and it seems to be working for me. Is the “Inertia Tensor” enum selected for the child?

Thanks for the feedback!

One of the things I saw requested way back when for this before you worked on it, was for visualisation of capsule and raycasts. In particular what gets people a bit confused are capsule casts, because the shape can be bigger than people expect.

People think it’s a bug when really they fail to visualise it properly and understand that beginning the cast inside an object will reject it. This will affect capsule cast the most (and swept shapes).

Great job so far!

1 Like

Yep, all child Articularbodies are selected with the enum state, but no child ArtBody has a center of mass Gizmos.

Good idea and I don’t think it would be difficult to implement. Thanks for the feedback!

Weird, I’m still unable to reproduce the issue after following your screenshot as closely as possible. If this is an issue that you can consistently reproduce, could you provide the repro steps? I’m really curious why this is not working for you.

Thanks for your continued interest in physics!!! <3

2 Likes

<3

Another bit of feedback: I would put the “Info” tab at the start or the end because it’s the only tab with passive information and a miscellaneous meaning (it sits badly nested among tabs that can be interacted with which have strong meaning) and because it’s likely the most commonly accessed tab now you’ve moved info from the RB component into another window, so you want to easily get to that Info.

For a busy dev, that would be start or end - quickly and easily found / clicked with muscle memory.

4 Likes

Great work!

The contact impulses are per-contact, or the overall value calculated by Unity?

Because currently only the overall value is exposed by Unity. A good and easy push in physics would be exposing the impulse per-contact, exactly as PhysX does (indeed, there’s no such overall value in PhysX).

2 Likes

Hi, this might be overdue but the per-contact impulses are now exposed and used in this build. This will also be included in the final product. Thanks for taking a look!

2 Likes

Just to refine on what Augustinas just said, per-point contact impulses is in a PR towards trunk now, expected to land sometime soon, and become available in a public alpha of 22.1. I can totally remember you asking about it since forever. :slight_smile:

5 Likes

Unity Physx integration is fundamental to all the work we do, without it and these updates we’d have moved to Unreal because we really needed contact modification. Now there’s also better visualisations as well! Please don’t stop improving Unity’s built in Physics.

Can’t wait for what’s next. If it was me I’d definitely hire more to help out, seems like the team is small (and extremely hard working) for the amount of heavy lifting Physics does in Unity.

5 Likes

Great to know that this is already on the way!
You know you can pick another item from the list anytime :slight_smile:

2 Likes

Here’s a new build with query visualization added:
https://beta.unity3d.com/download/25827f979846/public_download.html.

There is query visualization for check, overlap and cast query types, and the visualization can be filtered independently in the new “Query” tab. Here’s a gif of the visualization in action:

Also, the Info tab is now at the start of the row + some other minor fixes.

7 Likes

Amazing progress :slight_smile: I hope that the visualisations can be cleaned up later on (not important now obviously!)

Awesome! Does it also shows rigidbody sweep tests? Unity - Scripting API: Rigidbody.SweepTest

1 Like

At the moment, no. But definitely, a thing to look into. Thank you for your interest! <3

2 Likes

I guess the visualisation of a convex hull extruded along vector is going to need some shader fu to do properly (like stencils) !

That would be the best way, of course. But to me, simply drawing the wireframe of the collider(s) at the start and at the end with a raycast line connecting the center of masses would suffice.

1 Like

Indeed, and I feel the omission of swept shapes is an unfortunate one, even seeing it in the visualiser would encourage people to find out more about these useful functions.

1 Like