Multiple Joints on A Gameobject

Yeah I’m sure that this question has been asked before but the problem is that none of them directly relate to my problem.

Bit Of Backstory

In order to make my fully fledged destruction system I planned to use joints so the building does not just shatter. I am using pre-fragmented walls.

What I want to do

“Procedually” add joints so that when the building is broken, the wall fragments will connect via joints and become more realistic

Is there a better way to do destruction?

Probably, If you have any ideas just tell me.
What i am doing right now is caching all the adjacent walls via raycasts on start and i check their health, etc.

So anyway. Is there a way to add many active joints to a gameobject.

Thought out code:

{
jointLeft = gameObject.AddComponent(HingeJoint);
jointLeft.hingeJoint.connectedBody = leftTran.rigidbody;
}

{
jointRight = gameObject.AddComponent(HingeJoint);
jointRight.hingeJoint.connectedBody = rightTran.rigidbody;
}

Or is there a better way to simulate realistic destruction

Thanks
~Myhijim

Bump

Joints are what they are. I use hinge joints in my game to simulate bones, or body joints. Placed on a stationary enemy, my hero blasts away. The effect, that I achieved is a bit of a rattling. I have noticed that the joints component, hinge, is very flexable. Specifically in terms of Use Limits. This little feature allows me to co trol how much my guy rattles.

So, I think if you can get the effect you want with joints, no problem. Just remeber the settings, where you place the joint, what it’s attached to, everything is important in the end effect.

Ah thank you haha.

Now what I forgot to add in my main post was.

How do I achieve multiple hinge joints?

I am unsure if a single object could have more than one. But why not create a child object, with a hinge? Trouble is collisions tho, so, if you make the child a trigger. If that works, in illusion an object could have infinite joints.

Hmmmm would be quite CPU intensive.

What if I write my own joints script… Hmmm