# [Solved] Hinges Falling Apart

Discussion in 'Getting Started' started by Effervescent, Mar 12, 2015.

1. ### Effervescent

Joined:
Mar 7, 2015
Posts:
31
Hi! I have been playing around with procedurally generating 2D chains during runtime because it's an essential part of my first project (admittedly I spent too much time on figuring this out but it's been a good learning experience).

I managed to get a working model, albeit primitive, by linking cloning a sprite (a subunit of a chain in this case) and linking them with hinges; here is a demo (I'm not sure what are the "real" unit for gravity Unity uses, so I'm just using G for that):

30 Subunits, 1 G

After playing with it further, I found that it starts to fall apart with longer chain length:

80 Subunits, 1 G

The effect can be reproduce by increasing the gravitational force experienced by the subunits:

30 Subunits, 6 G

I'm not sure that I'll ever apply too much force to a chain so this is more of an academic exercise than anything else (also, it's better to be safe than sorry). Thank you very much in advance for any suggestions!

2. ### base4

Joined:
Mar 11, 2015
Posts:
30
Hmm. I think this is generally documented (err... "understood to happen") about hinging.

It's technically a PhysX issue. If I recall correctly people in the past ended up "hard linking" them. or even coming up with alternate solutions.

You should probably search on that one, it's certainly been mentioned before.

Effervescent likes this.
3. ### Effervescent

Joined:
Mar 7, 2015
Posts:
31
Thank you. x: Now I feel silly - I did look last night using with similar keywords but I have no idea why I didn't see them/basically ignore them. I shall try again and report back!

4. ### Effervescent

Joined:
Mar 7, 2015
Posts:
31
I tried it again just and tried the suggestions in this thread in a 2D context. Increasing either the number of Velocity Iterations or Position Iterations appear to stop the chains from falling apart due to excessive force; unfortunately, I have no means to test which is more effective. Adjusting the size of Fixed Timestep also fixes the problem but it appears to be the most expansive option out of all three.

Increasing the Angular Drag on the subunits also works and, as far as I can tell, it's the least expansive solution but it does change the behaviour of the chain very slightly. Decreasing the Mass of the subunits has no noticable effect whatsoever.

I was able to have more than 100 subunits with these methods - in fact, FPS started to become a big problem for me before I could break the chains. xD

base4 likes this.
5. ### base4

Joined:
Mar 11, 2015
Posts:
30
result.
Like a wise person once said: All good things come to those who beat the heck out of systems that don't do what they want.

Effervescent likes this.