Search Unity

Turn off collider 'weights' in physics

Discussion in 'Physics' started by PelvisParsley, Aug 7, 2018.

  1. PelvisParsley

    PelvisParsley

    Joined:
    Aug 9, 2016
    Posts:
    89
    I want to imitate a half filled bottle using physics, its working great and looks something like this:
    Capture.PNG

    The box collider acting as a weight. The thing is, I want the rest of the body to collide as well. I tried Rigidbody.CenterOfMass but it doesnt do anything. Is there any way to get this functionality with a full collider, or add another collider that doesnt contribute to the center of mass
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    Keep the collider for the entire bottle, then configure the mass and the center of mass. That's the way to do it. Most likely you're not configuring the center of mass properly.
     
  3. PelvisParsley

    PelvisParsley

    Joined:
    Aug 9, 2016
    Posts:
    89
    What do you mean not configuring it properly? Could you elaborate please. I have created an empty GameObject, and assign its position as the COM at runtime. Tried using both Local and World space. But the bottle still rotates at the center of all colliders
     
  4. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    First, I'd use the bottle mesh itself as collider (add a mesh collider, then mark it as convex). Then, configure the center of mass to be at the bottom of the bottle. That's the way it works, I don't know how could I elaborate further. The documentation explains how to use the center of mass property.