Sign in to follow this  
mwiss

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?

Share this post


Link to post
Share on other sites

Finally I can help someone :P 

Keep your jointAB in a variable so you can use it later:

scene.getPhysicsEngine().removeJoint(meshA.physicsImpostor,meshB.physicsImpostor,jointAB);

If you want to see my project with helicopter able to crash when forces between body elements are to high just ask me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.