# Combine multiple rigidbodies?

 0 Hello there. I was wondering, what is the best way to approach this problem? I want to combine two or more different rigidbodies into one at runtime, or if that is not possible without a complex use of the Mesh class, to make them act as one? Picture shows what I mean, since I am not good with words: They would need to follow the physics as if they were a single object, mass caclulations included. Thank you in advance. ~Bumbaz more ▼ asked Apr 27 '11 at 08:59 PM Bumbaz 1 88 ● 2 ● 2 ● 6 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 If you remove the rigidbodies from the cubes (but keep the colliders intact), and make them children of an empty gameobject that has a rigidbody, then they will be effectively merged. You'd want to add the mass from the two cubes before deleting the rigidbodies and apply that to the mass of the parent. more ▼ answered Apr 27 '11 at 09:15 PM Eric5h5 81.5k ● 42 ● 133 ● 529 That's very helpful, thanks. But what if I have gameobjects with different masses? In the method you described, the center of mass is only one. Is it possible to assign different weights to different parts of this one gameobject?I am so bad at words. Haha~Bumbaz Apr 27 '11 at 09:43 PM Bumbaz 1 @Bumbaz: No, that wouldn't work with the method I described. I'm not sure there's an easy way to do that. Apr 27 '11 at 09:52 PM Eric5h5 what if you only parented them to the new gameobject but retained their original rigidbodies? Wouldn't that also retain their weight distribution? Apr 27 '11 at 10:11 PM Chris D @ChrisD: that won't work, since the rigidbodies would still be independent. In order for compound colliders to work, only the parent can have a rigidbody. Apr 27 '11 at 11:32 PM Eric5h5 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 Maybe you need to look at a fixed joint:http://docs.unity3d.com/Documentation/Components/class-FixedJoint.htmlThis is used to "connect" two distinct rigidbodies together. Each maintains its own mass, but pushing on one rigidbody pulls on the connected one, so they act sort of like a single physics object.There are other types of joints as well: hinge joints, spring joints, etc. more ▼ answered Sep 07 '12 at 08:32 PM klay 1 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1864
x1403
x99

asked: Apr 27 '11 at 08:59 PM

Seen: 1614 times

Last Updated: Sep 07 '12 at 08:32 PM