# Best way to do chain simulation

## Recommended Posts

So here is a good technical hurdle.
https://www.babylonjs-playground.com/#7AHEVA#18

Trying to figure out the best way to do a interlinked chain and be able to do a physics simulation with it, the hurdle here is there will be 27 chain systems on the basket which makes things hard.

I am thinking the solution will be to use use physic linked cylinders and hide then from visibility then children the link impostors to the hidden cylinders.
This solution does not give the "slide" effect that happens between chain links though and so I am open to more ideas.

After being able to construct the chain the next part will be connecting it to two anchor points and having the chain hang correctly.
Another hard part will be the fact the end anchor point for all the chain systems is a ring that they are all connected to so when one chain system gets hit at min 12 systems will have to calculate.

##### Share on other sites

Have you ever played disc golf before?  This one might be a little hard to visualize unless you have seen a disc slam chains before.

I would need like sliders with ball and socket combined.

##### Share on other sites

https://www.babylonjs-playground.com/#NP3GK1#2

I am struggling with this.

I effectively want the links to be connected with a slider joint in the middle that allows for sliding on the y Axes only so that way the links and expand/compress.

It should effectively look like this:
https://www.babylonjs-playground.com/#NP3GK1#5
after they settle.

*UPDATE*
I was not using Oimo, which has the slider joint...  but I am still stuggling 1 second will post update.
https://www.babylonjs-playground.com/#NP3GK1#7
with two or more they disappear...
for some reason I can never get the joints working correctly.

*UPDATE*
https://www.babylonjs-playground.com/#NP3GK1#8
Ok got the chain "Working" now I need to figure out to how to constrain the rotations and then how to connect multiple systems together.
https://www.babylonjs-playground.com/#NP3GK1#11

I also need to figure out how to make the connected effect less violent as the numbers increase.
https://www.babylonjs-playground.com/#NP3GK1#12
https://www.babylonjs-playground.com/#NP3GK1#13

##### Share on other sites

Ha, look at this thing just load itself up...  thats not right...
https://www.babylonjs-playground.com/#NP3GK1#15

https://www.babylonjs-playground.com/#NP3GK1#19
gotta figure out how to make it stop bouncing under its own weight.

*UPDATE*
https://www.babylonjs-playground.com/#NP3GK1#20
well I guess this kinda works, taking a mass of 1 dividing it by the number of links in the chain.  Then as it goes down remove the fraction of the mass away from the total as it goes down.  Only works up to an extent though.

##### Share on other sites

Those are fixed points, I need them to slide.

##### Share on other sites

I was kinda thinking a softbody tube might make the cut.  Now you got me wanting to investigate that.

the problem would be connecting the soft bodies to the rings on the pole though, let me see if I can find an example video.

this video is kinda weak too, the chains can really get rocked sometimes with a good throw.

with the chain tutorial in blender does not take into account the sliding that the chains do, they do not stay fixed to each other in a single pivot point and that's what gives them their play.

Looks like my mass hack will work for now:
https://www.babylonjs-playground.com/#NP3GK1#21

Cause all I need is 26 chains per system.  Plus it kinda makes sense the mass would go like that (not really but ok), the top link has the cumulative weight of all below it.

##### Share on other sites

ok. i understand.
so you prev. example looks a bit like this. https://www.babylonjs-playground.com/#9ZP81N

maybe your join point arent right

##### Share on other sites

https://www.babylonjs-playground.com/#NP3GK1#23

I think I'm getting closer.  Now I gotta figure out how to stop them from rotating past a certain point on their local Y axis.

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.