Chain Physics not working Properly



Hey guys. I’m facing an issue that when I make my spheres “isKinematic” and then try to drag it the chains break and sometimes start bursting like you can see in the pictures above. I have tried with Hinge joints too but the issues still remains the same.

It works fine when both the spheres are not set to “isKinematic” but they start dragging each other and I dont want that either. Any solution to this?

You’re trying to stretch the chain further than it’s length, and it’s attached to unmovable endpoints. That’s probably going to break it, yeah. The physics simulation is simulating physics.

What do you want the chains to do when you move the end points?

Hey Baste
I want to basically implement the physics of the game called “Chained together”.
The chain should allow some degree of freedom in movement but also impose constraints to prevent the characters (here spheres) from moving too far apart

You probably want to set that up in code. Have the bodies be non-kinematic, and then prevent them from moving further appart than the chains.

1 Like

Making the spheres kinematic means they will move to the position you specify, regardless any other considerations (joints, collisions, forces, etc). So at certain distance the physics won’t be able to keep the chain together.

That also happens when you modify the position of the spheres directly, either by modifying Transform.position or using Rigidbody.MovePosition / Rigidbody.position. The rigidbody will move to the specified position. If the Rigidbody is not kinematic, then the next physics frame the physics engine will try to resolve any possible conflict coming from the new position (contacting other object, joints etc). Sometimes may resolve it successfully, but others will result in glitches (i.e. chain breaking, or object crossing solid walls).

If your chain is already working, then the correct way to interact with the spheres is using Rigidbody.AddForce exclusively. Don’t modify the position or the velocity directly, except i.e. to respawn the objects in a specific position. AddForce allows the physics engine to simulate the situation and resolve all contacts and constraints in a physically correct way.