Search Unity

U5: Rigidbody maxAngularVelocity reset to default every time it's disabled+enabled

Discussion in 'Physics' started by JibbSmart, Mar 10, 2015.

  1. JibbSmart

    JibbSmart

    Joined:
    Feb 18, 2013
    Posts:
    26
    Converting to Unity 5 has been mostly good so far. My latest problem was with the cars in my game having their maxAngularVelocity capped much much lower than they were before.

    I added "GetComponent.<Rigidbody>().maxAngularVelocity = 1000.0;" in Start(), but that didn't seem to do anything.

    I added some Debug.Log, and found that every time the car is disabled and then enabled again, the rigidbody's maxAngularVelocity gets reset to 7. No other rigidbody parameters (at least that I've checked) seem to suffer this problem.

    Is this intended behaviour? Is there a better way to overcome this problem than to set this value manually every time the car is enabled?

    Thanks,
    Jibb
     
  2. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    Bump!

    Ive spend an entire day tracking this down. Any fix for this?

    Same situation for me, set maxAngularVelocity to something, setActive off, then back on, now maxAngularVelocity is back to 7.

    Thanks for any ideas!!
     
  3. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    After a bit more playing around, it looks like toggling setActive was altering a couple of other values as well. If "Auto Configure Connected Anchor" is active on a ConfigurableJoint when setActive is reenabled, the Connected Anchor offsets change.

    I also had issues with collision states becoming confused, and generally things not behaving as they should. So for now, Im completely avoiding any use of setActive.

    Has anyone else experienced any strangeness with setActive?
     
  4. Oliver-Bogdan

    Oliver-Bogdan

    Joined:
    Dec 30, 2014
    Posts:
    4
    Had the same issue. This bug is still present in 5.4.2, the only solution I found is to manually set maxAngularVelocity of FixedUpdate back to the corresponding value.