Search Unity

RigidBody for a complex game object

Discussion in 'Getting Started' started by krupps, Apr 18, 2019.

  1. krupps

    krupps

    Joined:
    Oct 17, 2017
    Posts:
    159
    I have a game object with multiple child sprites with their own Colliders like a monster with multiple weapons.

    Should I have 1 parent have the RigidBody or is it really depending on the child?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Rigidbody is a very well-named class. You should have 1 of these for each rigid body.

    So if your object and all its child sprites are a single, rigid body (i.e., the parts can't move relative to each other), then it should be one Rigidbody.

    If it's multiple bodies that can move relative to each other, then you need a separate Rigidbody for each one.

    If you want to make your life easy and avoid constantly fighting with the physics engine to get the behavior you want, then you should use no Rigidbodies at all (or at the very least, make them kinematic).
     
    Joe-Censored, krupps and Ryiah like this.
  3. krupps

    krupps

    Joined:
    Oct 17, 2017
    Posts:
    159
    JoeStrout likes this.