mwissink Posted March 21, 2017 Share Posted March 21, 2017 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? Quote Link to comment Share on other sites More sharing options...
wo997 Posted March 21, 2017 Share Posted March 21, 2017 Finally I can help someone 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. kpgbrink, Wingnut and mwissink 3 Quote Link to comment Share on other sites More sharing options...
mwissink Posted March 21, 2017 Author Share Posted March 21, 2017 @wo997 Yes! Exactly what I was looking for, thanks. Quote Link to comment Share on other sites More sharing options...
blondegeek Posted August 16, 2018 Share Posted August 16, 2018 This doesn't seem to be working for me. Has this by chance changed between when this was posted and now? Here's a playground example: https://www.babylonjs-playground.com/#4J9JBX#1 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 16, 2018 Share Posted August 16, 2018 Pinging @RaananW. Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 19, 2018 Share Posted August 19, 2018 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: https://www.babylonjs-playground.com/#4J9JBX#2 I will add this as an issue. Quote Link to comment Share on other sites More sharing options...
blondegeek Posted August 22, 2018 Share Posted August 22, 2018 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! Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 29, 2018 Share Posted August 29, 2018 hi @blondegeek, A quick follow up - https://github.com/BabylonJS/Babylon.js/pull/5028 GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 29, 2018 Share Posted August 29, 2018 Oh, and please create an issue for the second request (removing a specific joint, if more than one is connected to the same impostors). It requires a small architecture change, which I am not sure we will do in 3.3. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.