Jump to content

How to properly remove physics joint


Recommended Posts

I have recently run into a problem with the physics joints in Babylon. I add a distance joint between two impostors in my scene, but after some time, I would like to remove that joint. Currently on the docs, there is no reference to a removeJoint function, and after looking into some of Babylon's source code, I found the function

link: https://github.com/BabylonJS/Babylon.js/blob/master/src/Physics/babylon.physicsEngine.ts

However,  the function appears as if it is not complete, and I am unsure of the proper way to access it. 

Is there a way to properly remove a physics joint?

Link to comment
Share on other sites

  • 1 year later...

that's an interesing one :)

A spring joint is actually not a joint, it is an external constraint that calculates the forces it applies on each frame.

This is why removing a spring joint doesn't work. It is specific to this joint and this physics engine. This should, however, be working, as we do abstract the spring aas a joint. To overcome this (temporarily) you can do the following:


I will add this as an issue.


Link to comment
Share on other sites

Hi @RaananW,

Thanks for the reply and example. Would you like me to add a github issue?

For the use case I am thinking, I will have many spring joints attached to a given sphere and would like to be able to select which joint I would like to remove. I suppose I could do this by just keeping track of what order constraints are added to the queue but would certainly appreciate another option.

Thanks again!

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...