Search Unity

What affect do colliders have on a rigidbody

Discussion in 'Physics' started by unitynewb, Jan 13, 2017.

  1. unitynewb

    unitynewb

    Joined:
    Feb 22, 2009
    Posts:
    235
    I have a car that I have set the center of mass on. Everything seems fine and works as expected, but i noticed that the car still behaves differently when I add a new mesh with a mesh collider. I basically want to be able to add another mesh collider on the car, but keep the behaviour the same. I have also tried setting the center of mass after I add the collider and it has the same problem.

    Code (CSharp):
    1.                     Debug.Log(rBody.centerOfMass.x + "," + rBody.centerOfMass.y + "," + rBody.centerOfMass.z + " - " + rBody.worldCenterOfMass.x + "," + rBody.worldCenterOfMass.y + "," + rBody.worldCenterOfMass.z + " - " + rBody.mass);
    2.                     rBody.centerOfMass = centerOfMass;
    3.                     Debug.Log(rBody.centerOfMass.x + "," + rBody.centerOfMass.y + "," + rBody.centerOfMass.z + " - " + rBody.worldCenterOfMass.x + "," + rBody.worldCenterOfMass.y + "," + rBody.worldCenterOfMass.z + " - " + rBody.mass);
    4.  
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,554
  3. unitynewb

    unitynewb

    Joined:
    Feb 22, 2009
    Posts:
    235
    Edy likes this.