Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Is it possible to move object by rotation with single rigidBody?

Discussion in 'Physics' started by syjgin, May 21, 2024.

  1. syjgin

    syjgin

    Joined:
    Feb 13, 2015
    Posts:
    139
    Hi.
    Is it possible to move object with single root rigidBody and multiple colliders inside? I want to move object with a voxel wheels, but looks like there are necessary multiple rigid bodies with hinge joints. But that solution is poorly compatible with drag and drop: when you quickly move object, that consists of multiple rigid bodies, it temporaly desintegrates by separate parts.
    But without joints object can't be moved by the wheels, as you can see in the sample project attached. Maybe, it's possible to do this without joints?
     

    Attached Files:

  2. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    2,063
    Yes, you can have a single rigidbody with multiple colliders inside. This is a very common setup, called a compound collider.
     
    Edy likes this.
  3. syjgin

    syjgin

    Joined:
    Feb 13, 2015
    Posts:
    139
    Yes, but let's try attached example: such compound collider can't be used to car wheel like movement: without multiple rigid bodies game object will not be able to roll from it's initial position
     
  4. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    2,063
    You can't have objects independently move with respect to each other if you have a single rigidbody as in your original question:

    The only way to have two objects move independently is for both to be rigidbodies. If you then want to constrain their relative movement in some way (limiting translation and only allowing rotation, for example) then you *must* use joints.

    Note that joints aren't perfect, so large hierarchies of objects and/or large mass differences in objects joined by joints may exhibit incorrect behavior. You have articulated bodies as an alternative, which are a lot more robust for these cases but come with their own limitations and somewhat increased cost.