Search Unity

Order of setting rigidbody mass and centre of mass affect wheel collider behaviour

Discussion in 'Editor & General Support' started by Nition, Sep 21, 2014.

  1. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    I've been trying to work out why people's vehicles are behaving incorrectly when parts of them are destroyed in my game.

    Turns out that the order that you set rigidbody.mass and rigidbody.centerOfMass affects the behaviour of wheel colliders.

    I've attached a test program which shows the issue. I've also sent a bug report, but this might be good for people to know.

    I'm also having some trouble beyond the simple ordering issue. It seems like changing rigidbody.mass and rigidbody.centerOfMass while using objects with wheelcolliders can mess up the wheelcollider behaviour no matter what order you do them in. I don't have a test program for that but it happens in my main app. Right now I'm still trying to work out a way to "reset" the system so the wheel colliders will behave like they should if the updated values were the initial values. Large reductions in mass on-the-fly seem to create super floaty wheel behaviour.

    Edit: OK, here's an all-encompassing workaround:
    Code (csharp):
    1.  
    2. wheel.enabled = false;
    3. wheel.enabled = true;
    4.  
    This seems to force the wheels to update correctly.
     

    Attached Files:

    Last edited: Sep 21, 2014
  2. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    Unity QA got back to me today, just saying that they were able to reproduce the issue.