How to handle multiple joints between two impostors

Hello guys !

I’m new to the Babylon world but I already have some questions.
A year ago I did an anatomy app prototype on Unity. Using “rigidbodies” I could attach multiple spring joints to an object to creates some muscles or ligaments.

Recently I was trying to do the same thing on Babylon and I’m currently stuck on the correct way to do it (or if it’s possible).

So far, I tried to attach multiple spring joints between two BoxImpostors. It seems like only the last one added was really working.(the box does’nt rotate when spring is stretched)=> https://www.babylonjs-playground.com/#TB6ER9#1

So I guessed we can only add one joint per couple of impostors. I added to my box some “insertions”, small boximpostors where I could attach some muscles.
The muscles are simple spring joints between two insertions with a debug line to see where they should be. ==> https://www.babylonjs-playground.com/#TB6ER9#2
I used the compound method to organize the impostors and I feel like it’s not the right way.
If my insertion impostor have 0 mass, the spring is not working, if they have 1 mass, they are like detached from the parent. If I want my muscle to work, it seems that I need to add a “Lock” joint to the insertion and his parent…

Is there another way to do it ? Am I missing something here ?
I don’t even imagine the mess when I will add a bone mesh with all the colliders xD.

I’m currently using Cannonjs, specially for the spring joint. I don’t know if it is a good choice in this case.

Thanks :slight_smile:

Hello and welcome

Invoking @trevordev, our Physics mastermind

1 Like

Does this playground help?

https://www.babylonjs-playground.com/#1BHF6C#50

It creates 2 joints one on each side of the cubes and seems to behave as expected

1 Like

Yes it have the correct behaviour. So it was the joint data error visibly. I don’t know where I took the localAnchor :s.

Thanks a lot and sry for the mistake ^^.

Yeah…this is quite impressive. My main goal is to create something realistic to see effect of different muscle contraction. If this work, I will definitively try A.I ;).

1 Like