Search Unity

Major Bug : Position Constrained RigidBody2Ds snap to origin.

Discussion in 'Physics' started by DanSuperGP, Jul 21, 2015.

  1. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    I initially discovered this problem in 5.1.1 and submitted a bug, but it's still sitting open and hasn't received any response and it's still happening in 5.1.2. This is a problem on multiple projects we are working on right now.

    It's a simple problem to demonstrate. Rigidbody2Ds with freeze position X constraints will randomly snap to the origin and become unmovable. They cannot be dragged from their position with the move tool while running, and if you pause and move them they will immediately snap back when play resumes. Any other rigidbody2d who's collider contacts the stuck rigidbody becomes stuck as well.

    This was submitted on 7/8/2015 as Case 710667, but I didn't mention it on the forums because I figured something this significant would have been noticed already. I'm now bringing it up since it doesn't seem to have been addressed and is still happening in 5.1.2
     
  2. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Bump / Ping @MelvMay

    Any chance you could take a look at the Case 710667 related to this?
     
  3. kikokomakika

    kikokomakika

    Joined:
    Sep 24, 2014
    Posts:
    1
    I made a video to demonstrate the part of the bug.

    It's really a major bug, it's completely game breaker. I spent nearly a week, to figure out the problem. Now one of my major features have to be leaved off, because there is no solution for this right now. Please, do something about it.
     
  4. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Yeah. That's exactly what I'm seeing. It's affecting two projects my team is working on right now.
     
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,420
    Yes, the problem is being looked at. We've had several bug reports about this issue. All of them appear to happen only under OSX where NaNs/Infinities are returned from Box2D for the position of the rigid-body. When a NaN/Infinities is seen for position, corrective action is taken and the position is reset to zero.

    As to WHY Box2D is returning NaN/Infinities for position, we don't know yet but it's most certainly related to the joint used for constraints.
     
    Last edited: Jul 27, 2015
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,420
    All reports are useful: Do you have a simple reproduction case handy you can post?
     
  7. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    So, a joint is being used for constraints even if the Rigidbody2d doesn't have a joint attached?
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,420
    Yes, there's no other way to constrain bodies in Box2D.
     
  9. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,420
    You may be pleased to hear that I have just isolated and fixed the issue. I am now producing a build on our build-farm to get this confirmed by QA. I'll update you when I know more.
     
  10. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Super awesome! Thanks!

    I knew you were the right person to ask!
     
  11. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    It was happening on my teammates Windows machine as well...
     
  12. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,420
    It passed the provisional QA and is currently being reviewed, then on its way to the patch system.

    Sorry this took so long to get fixed.
     
    DanSuperGP likes this.
  13. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,420
    The fix has landed in 5.1.2p3 which, if all goes well, is due for release on 5th August. QA have verified that it fixes all known reports so hopefully it'll solve your cases as well.