Search Unity

Question Help re: applying rigidbody component to a prefab's children meshes

Discussion in 'Prefabs' started by jeromegold, Mar 14, 2021.

  1. jeromegold

    jeromegold

    Joined:
    Apr 7, 2020
    Posts:
    47
    Hi. I've modelled a mech prop in Maya and it's rigged with 3 joints. The prop has two section and bends between the two sections. The bottom part of the prop is metal, the top part is a rubber material and it bends/rotates between the metal and rubber.

    The model and rig have come into Unity correctly. I made them into a prefab that is called "mechprop". mechprop is the parent and under this is mechprop_model and mechprop_rig. Under mechprop_model there is metal_handle and rubber_top_section. Because the bottom part of the model is metal I added a rigidbody to metal_handle and increased the mass and I added a rigidbody to rubber_top_section and reduced the mass.

    Gravity is enabled. But the mechprop isn't falling as i'd expect with gravity and i wonder if it's because rigid body components are only meant to be attached to the prefab itself and not the children meshes.

    Thanks.
     
  2. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    Rigidbodies and the Hierarchy
    Non-kinematic rigid bodies will ignore the hierarchy. If you make one rigid body a child of another and translate the parent. Then the child will NOT move with the the parent. The child’s transform will update so that it remains in place in world space. If you want to couple rigid bodies you need to use joints.


    I typical make physics geometry in there own PREFABS. you don't have to, but its what I do. Make sure that object is not static either... Remember lower Drag makes the object act lighter.

    You can use contraints, joints/Unity ones for something like this..

    https://docs.unity3d.com/Manual/class-CharacterJoint.html or which ever one you like.
     
    Last edited: Mar 27, 2021
    jeromegold likes this.