Physics6DoFConstraint Joint Creation Tool

After struggling with physics joints, I decided to make a tool to help visualize the 6DoF parameters in real time.

Physics6DoFConstraint Joint Creation Tool | Babylon.js Playground

I limited the options in order to avoid confusion, but I believe it covers most use cases (or at least can get you in the right direction). I also added some examples to browse to help you get started.

(Note: Click the loose object to push it away from the camera.)

Hope it helps you as much as it helped me!

Tr909

4 Likes

that’s really great! CC @Cedric , maybe we could use something like that in the docs?

1 Like

This is really cool and it deserves it place in the documentation.
Do you want to do a PR on GitHub - BabylonJS/Documentation: Babylon.js's documentation website with a few lines to describe the PG @Tr909 ?

2 Likes

Yes of course - glad you think it’s helpful! Will make a PR as soon as possible

Can I ask for one thing - make sure the UI is disposed when the scene is disposed, otherwise sswitching to a new playground (or running this one again) will keep the UI until the site is reloaded.

1 Like

Ah, that’s true I hadn’t noticed! Bad news is that I just copied the idea of using lil-gui from the global illumination playground, and that one appears to have the same problem when switching between playgrounds :frowning:

Babylon.js Playground (babylonjs.com)

I’m not sure of the best way to prevent it from hanging around but I’m finding the combination of:

    if (existingGUI != null) {
        existingGUI.remove();
    }

for replaying the playground, and:

`window.onhashchange = () => gui.domElement.remove();`

for switching between playgrounds / saving / creating a new playground seems to work well.

Here’s the updated tool:
Physics6DoFConstraint Joint Creation Tool | Babylon.js Playground (babylonjs.com)

Should that be right for me to PR now?