0
\$\begingroup\$

I created a hollow box, in Blender, and imported it into Unity. The problem is, when the game starts in Unity, and gravity is applied, the box falls apart. So there needs to be some kind of glue that holds the edges of the box together.

What Blender or Unity features do I need to apply to the box to make it a single, rigid unit, like all the edges are nailed together?

\$\endgroup\$
  • \$\begingroup\$ Have you attached a rigidbody to each side of the box? Each rigidbody you attach says "I want this to be a separate piece that can move independently" so you may be able to solve this by removing unwanted rigidbody components and keeping just one rigidbody responsible for the box as a whole - show us how the object hierarchy looks in Unity, including what components you have on each piece, and we should be able to walk you through the steps in an answer. \$\endgroup\$ – DMGregory May 16 '17 at 22:22
  • \$\begingroup\$ Have you tried putting them together in Blender instead? blender.stackexchange.com/questions/2632/… \$\endgroup\$ – John Hamilton May 17 '17 at 10:33
2
\$\begingroup\$

If the object contains a single mesh, it will hold together. It sounds like you have used separate meshes to create each side, so by default, they are separate pieces. However, there is a pretty easy way to hold them all together. Have them parented together.

Parent the mesh objects

You can do this in either Blender or Unity. I am not overly familiar with the process, in Blender, but I imagine it would be pretty easy for future work. In Unity, it is just a matter of dragging the secondary objects onto the main object, via the Inspector. To keep things consistent, it might be a good idea to parent all sides to an empty game object, placed in the dead centre of your cube.

Use a single rigidbody

At this point, it is important to ensure that your parent object contains the rigidbody; this body will encompass all containing parts, not just the base object. In contrast, placing a rigidbody on all separate components tells Unity that they are separate components, which is not what you want. You can see this demonstrated in the animation, below. Both cubes are the same "HollowCube" construct you see in the above image; the yellow cube has a rigidbody attached to its base "HollowCube" object, while the multi-coloured cube has a rigidbody attached to each of the children "Cube_" objects. As you can see, the object with multiple rigidbodies immediately breaks up, while the object with the single rigidbody stays connected.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks for the detailed response and the video -- very helpful. I was able to create a mesh in Blender, and you're correct, the mesh stays together in Unity. I will also try the grouping + one rigid body. \$\endgroup\$ – Henry Rillovian May 18 '17 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.