Jump to content

Debugging physics with the inspector


Recommended Posts

Nice!  Next step... being able to "see" physics joints?  Perhaps a slightly-different wireframe shape for each TYPE of joint?  (phew, eh? I hear ya.)

The video is sort-of fast.  If some of the boxes have sphereImpostors, would we see wireframe spheres inside those?

Does the wireframe indicate the impostor type/position?

If a user moved the mesh itself, so the impostor gets left-behind (impostor out-of-sync with mesh)... would we see that?

I bet not.  :) I bet it would take some serious "querying" of the physics "World"... to build a wireframe "layer" that showed impostor types, transforms, and sizes.

Still, though, good progress and I hope I didn't "rain on the parade" (I hope I didn't ruin the celebration).

Link to comment
Share on other sites

You can try it already: just head to the playground :)

Joints are on my list. and yeah sphereImpostors will be spheres :) 

Wireframe indicate positions and type and if they are out of sync you'll see them where they are (just wondering why you "bet not" )

Link to comment
Share on other sites

@Deltakosh Are you querying/copying mesh.physicsImpostor.physicsBody.position... to set position of wireframe?

Are you querying/copying physicsBody.quaternion... to set wireframe.rotationQuaternion?

In other words, are you checking the position of the rigidBodies?  Are you using the ACTUAL physicsBody values...  to transform the displayed impostor-proxies?

Just curious.  :)  If not, you/we may not know if/when an impostor goes out-of-sync with a mesh.  (We'd probably know by the way it physics-acted, anyway, though.)

*shrug*  I could be wrong.  Often am.  :)

Same is true with joints.  Seems we (you) need to query world.allJoints, and then query which mesh-shapes are at each end of the joint, and do some fancy bone-looking wireframe connectors.  And we'll need name-labels on those, of course.  Could right click the joint's name-label, and a big panel of info ABOUT that joint... pops open.  :)

Physics World Sniffer... 1.0  :)

I once thought... the showImpostorsAndJoints()... might need to produce a Babylon.Layer or auxiliary (extra) AdvancedDynamicTexture.

If ya think about it, we don't really NEED to show a wireframed mesh... when we want to see an impostor.  We actually just need to see a circle... similar to those used on GUI link targets.  We spin the camera 360 around the mesh, and if the dot/circle stays in the center of the mesh, that means our impostor is in the center of the mesh, too.

No added mesh to the scene.  All done with Babylon.Layer or GUI layer... or "The Physics Inspector ADT"... a 2nd layer of advancedDynamicTextrure.

I know... goofy idea.  But if we can build the physics inspector on a HUD... that would be pretty nice... and not need mesh, ever.  To show a joint on this "layer"... its just a slight variation of a GUI link-line.  New control, called a "joint line".  :) Clickable... brings up info about the joint, including click-links to exam impostors attached to each end.  No 3d.  All layer.  HUD.  The Physics Heads-Up-Display... looks like a fighter jet HUD... overlays the scene.... easy-toggle blocking/non-blocking.  :)

What a dreamer I am, eh?  But I think there's merit in keeping our fingers OUT OF the 3D world... when inspecting physics.  No mesh-adding.  Leave scene graph alone, and get special X-Ray (physics) glasses to look at screen-with... see the scene's under-warez.  :)

Link to comment
Share on other sites

21 minutes ago, Wingnut said:

Are you using the ACTUAL physicsBody values...  to transform the displayed impostors?

Yes :)

There is no real mesh adding as the helper already works on a different layer mode

Link to comment
Share on other sites

Ahh, see, there ya go.  Genius!  (hug)  Thank goodness you are on OUR team, DK!

Update:  Just took a little tour... using https://www.babylonjs-playground.com/#15AFCG#30

Use arrow keys to move little box, which drags-around green player box, using a joint between the two. 

(This config is for avoiding over-powered collisions, which happens when keypresses DIRECTLY move a physics mesh and cause a physics collision.  There is too much impact power, when not using a "buffer joint" to absorb some impact shock.)

Looking good.  I wonder what physicsBodyBoxViewMesh ishmmIt won't view-toggle, or has no affect when toggled.  hmm.  It's a mesh... on a different render layer... me thinks.

If so... that's still messing with the scene graph.  ;)  Added a mesh, whether a different layer or not.  Same scene graph.  :)  You thought you could slide that one past me, eh?  (Like I have a clue whatsoever).


When picking is ON, pick SOMETIMES picks the mesh (good) but sometimes picks the physicsBodyBoxViewInstance.  Can pBBVI be set to isPickable = false?

Also, when picking is ON, and the PHYSICS branch (pulldown) is open, showing mass/friction/restitution/type, then picking a DIFFERENT mesh... does not update the values.  We need to close the PHYSICS tab, and then re-open it... to get the values for the newly-picked object.  Minor issue.

Said in another way, PHYSICS values... do not get updated... if Inspector picks a different mesh.  Need to collapse it and un-collapse again.

It sure is a pretty inspector, though.  Nice!  Remember 4 years ago, when you said "Yeah, I want to keep the playground really clean and not add a lot of extra stuff to it."  ?   FUN!  Now, its a full-fledged scene-layout application. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...