Search Unity

2D physics broken in Unity 4.5?

Discussion in '2D' started by Ardmark, Jun 1, 2014.

  1. Ardmark

    Ardmark

    Joined:
    Oct 24, 2012
    Posts:
    11
    I'm working on a simple game, with a ball rolling through some pipes. In Unity 4.3.4, everything was perfect with the default settings - no physics materials used, and the ball would roll very realistically. I upgraded to 4.5, now the ball just 'slides' when it hits an angled edge collider, it is as though the angular momentum is not being calculated correctly. Imaging the ball is falling straight down and hits a 45 degree angle - it does not acquire any angular velocity, it just bounces without rotating at all (in 4.3.4, it would acquire spin when it struck the collider). Then when it hits a horizontal collider, the lack of angular velocity causes it to stick (well not actually stick, just slow down unrealistically). I tried all combinations of material properties (friction and bounce) but this just made things worse.
    I've just reverted to 4.3.4 and everything is fine again. Works in 4.3.4, broken in 4.5

    Should I be doing something different in 4.5, am I missing something new, or is there a bug in the 2D physics?
     
  2. Pyrian

    Pyrian

    Joined:
    Mar 27, 2014
    Posts:
    299
  3. Ardmark

    Ardmark

    Joined:
    Oct 24, 2012
    Posts:
    11
    Seems like a lot of extra work, but thanks for pointing it out. I think I'll stick with 4.3 to finish this project, then upgrade again. Hopefully this will get sorted in a future version.
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    This has been fixed and will be in the next patch release.

    Sorry for any problems that this may have caused.
     
  5. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    483
    4.5 has broken a really trivial project that I've been messing with. It's a 'Thrust'-style game - a 2D spacecraft that can be rotated and have thrust applied. The ship would just seem to suddenly lose velocity every second or two.

    I managed to reproduce it in a test scene with a single 2D rigidbody and no colliders, and found that if the object has been rotated manually (e.g. transform.Rotate) around Z, and has interpolation enabled, it will exhibit this strange loss of velocity.

    Without interpolation, it was OK (but not smooth). Without the rotation but with interpolation, it was OK.

    I submitted a bug, but it got marked as a duplicate (maybe of this one?) - but it's definitely related to interpolation...

    (Bug report is here: http://fogbugz.unity3d.com/default.asp?610672_n8gq83dolsrrjnri , test scene was uploaded with it)
     
    Last edited: Jun 3, 2014
  6. Atrej

    Atrej

    Joined:
    Feb 17, 2013
    Posts:
    3
    ETA on the next patch?
     
  7. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    46
    Relieved to know I wasn't the only one experiencing this. Looking forward to the update, although I'd be worried if I were shipping right now.
     
  8. kingworks

    kingworks

    Joined:
    Feb 17, 2014
    Posts:
    16
    Yeah, I'm pretty much boned until this (2D physics) is fixed and the new GUI comes out.
     
  9. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    I have another thread in regular Support forum regarding this, but maybe it will get more thoughts here: I am noticing in 4.5 that my Rigidbody2D's Interpolation isn't working as smoothly as 4.3. I've changed nothing except Unity versions and now my character jitters badly all the time. Anyone have any problems with something similar? Thanks.
     
  10. JasonB

    JasonB

    Joined:
    Dec 29, 2010
    Posts:
    71
    Sadly the patch released yesterday didn't fix any of these issues. Super disappointed. Melv said the inertia bug would at least be there.

    Many games rely on physics behaving as expected, and with the (confirmed) inertia calculation bug causing objects to roll nearly forever like they're filled with water and the (confirmed) bug where 2D physics objects are no longer drawing any behavior from their Physics2D materials (bounce doesn't work), 2D physics are completely ruined until a patch comes.

    If you're working on a game that uses 2D rigidbodies, do not under any circumstances upgrade to 4.5. It's a mess, and those are just the bugs that I know of.

    I really wish they would include more people in testing these major updates before they go out so obvious issues like this can be fixed first.
     
    Last edited: Jun 7, 2014
  11. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    4.5.1 isn't a patch, it's a standard release. The issue was only raised after 4.5.1 was in the QA pipeline. The fix has been applied to the first patch for 4.5.1 which should be out soon.

    The original change was out for many months during alpha and beta cycles but wasn't reported. I would say that this issue doesn't mean 4.5 "is a mess" and has been rectified pretty quickly after being reported.
     
  12. ViNull

    ViNull

    Joined:
    Apr 14, 2013
    Posts:
    6
    How do we get access to the beta and alpha builds? It sounds like there isn't many 2D tester involved right now if these bugs were never reported. It may not be a "mess" but it is unusable at the moment.
     
  13. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    483
    Yeah, I'm having real problems with interpolation in 4.5 (see my post a few comments up). Haven't seen any acknowledgement of this as a bug though, and my bug was closed as a duplicate (they probably got hundreds of '2D physics is broken!' bugs) - but I'm not convinced that this is the same bug as either of the confirmed bugs...
     
  14. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    Hopefully it's the same issue. I know I'm not losing my mind because I can hop back and forth between 4.3 and 4.5 and 4.3 is smooth and 4.5 is bizarre/inconsistent. I wasn't able to reproduce in a small test project, however - so I'm wondering if it's an issue when there is other stuff going on.

    Though in my case, it has nothing to do with rotation. Also, I should add that this isn't just an Editor thing because even when building and deploying to my device, the issue is still there.
     
  15. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    I just checked that and yes, it's marked as a duplicate of another issue reporting the same thing. Know that this doesn't mean the bug report will be ignored, quite the opposite, as was stated in the reply to your bug report, the information you provided will be used in resolving the issue.

    Oh, and there are currently 14 bug reports for 2D physics!

    More importantly, forgot to mention that I'll be looking at this issue later today! :)
     
    Last edited: Jun 9, 2014
  16. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    Hopefully it is related to my bug 612479. Many thanks.
     
  17. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    So I've reproduced the interpolation issue and yes, there are a few reports producing the same effect. I'll identify what's wrong and get a fix into the next patch release.
     
  18. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    Great to hear.
     
  19. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    Note that I reopened your case and fixed the interpolation issue against it. It wasn't a duplicate after all but its description was identical to another case which was why it was unfortunately flagged as a duplicate.
     
  20. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    483
    Nice one, good to know that there's a fix coming :)
     
  21. Kovac

    Kovac

    Joined:
    Jan 30, 2012
    Posts:
    8
    Hey Melv,
    I've just tried the latest update (4.5.1f3?) and am still having no luck with impulses allowing for much rotational inertia as they did in 4.3. I think the easiest way to test this is having an object linked and offset from the main object and using that to applyForceAtPosition. Any help is appreciated.

    Thanks,
     
  22. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    The fix wasn't available for 4.5.1 (that was already on its way out the door) but got put into 4.5.1 patch #1. There are no 2D physics changes in 4.5.1.
     
  23. Kovac

    Kovac

    Joined:
    Jan 30, 2012
    Posts:
    8
  24. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    223
  25. Bitawu

    Bitawu

    Joined:
    May 11, 2013
    Posts:
    14
    Still experiencing the stuttering issue. Seems to be exactly every second while moving the object is pushed back slightly - even with interpolation off. If interpolation is on the opposing force is much greater and more prolonged. Guess I will go back to 4.3 again until this issue is fixed.
     
  26. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    I think the inertia bug was resolved, but pretty sure the interpolation fix didn't make it.
     
  27. mba-7skygames

    mba-7skygames

    Joined:
    Aug 21, 2013
    Posts:
    1
    I'd really like to see 2D fixed finally! It's nice that inertia issue is now fixed, but without interpolation working 4.5 is still unusable.

    Also I have a major overall slowdown of the game physics both in emulator and on device. It looks like all objects speed is 2 times smaller..
     
  28. bQvle

    bQvle

    Joined:
    Jul 18, 2013
    Posts:
    14
    mba-7skygames: try change to exterpolation, then it will probertly run twise as fast.. I had this problem when I was changing the rotation of the rigidbody, I think its getting fixed in 4.5.2 from what I see in the bug section.

    lets hope thats an overall Interp fix.
     
  29. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    Any estimate on when a patch will be released? Thanks.
     
  30. devean

    devean

    Joined:
    May 20, 2014
    Posts:
    14
    I am working on a racing game. There is a character preview in that. When I updated my unity from 4.3 to 4.5 , the 4 menu characters have not been visible since then, I have tried many things . checked them. But not able to see those 4 main menu characters. Can anybody help me regarding that. The two images that i have uploaded point to hierarchy and the main menu which is visible now.. rest all things are working fine. just that main menu is not working properly.
     
  31. XxStrukaXx

    XxStrukaXx

    Joined:
    Sep 25, 2013
    Posts:
    7
    I just upgraded to 4.5 and the whole game got broken. Physics wise I had to go through most of my colliders changing sizes (maybe when it recompiled the assets or something) to fix it. And now a simple script, that was working in the 4.3.4, doesn't work anymore.
     
  32. Pyrian

    Pyrian

    Joined:
    Mar 27, 2014
    Posts:
    299
    What does that script do? Maybe we can help.
     
  33. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    505
    What's the state of 2D Physics in 4.5.2? I went back to 4.3 for my physics but want to move on when Unity's ready.
     
  34. Sisso

    Sisso

    Joined:
    Sep 29, 2009
    Posts:
    195
    For me is fixed in 4.5.1p2
     
  35. Bitawu

    Bitawu

    Joined:
    May 11, 2013
    Posts:
    14
    Yeah, 4.5.1p2 fixed this for me as well. Thanks Unity folks!
     
  36. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    My problem must be entirely different, then. This is pretty frustrating that I am unable to reproduce it in a small sample project. Perhaps there is more going on that I'm not understanding? My player moves perfectly smooth in 4.3 and so jittery in 4.5, even with the latest patch.

    Completely lost on what to do.
     
  37. Pyrian

    Pyrian

    Joined:
    Mar 27, 2014
    Posts:
    299
    Hey helios, if you can't reproduce the issue in a small project, maybe make a copy of your full project where it's happening, and trim features off one by one until it either stops happening or you get a small sample? If the former, you'll at least have a major clue as to where the cause is.
     
  38. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,920
    Wondering if your problem is related to the following:
    http://forum.unity3d.com/threads/help-fixing-a-major-flaw-in-unity2d.244014/#post-1674575
     
  39. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    Thanks for the reply. That's interesting, but I'm not so sure it's the same thing. This is happening specifically on my physics-based character and nothing else on screen (and even "looks" like classic non-interpolated movement). I'm going to start stripping down my player controls little by little and see if anything else I'm running in the FixedUpdate is causing this. Will report back.

    Thanks for the continued support, guys.
     
  40. bQvle

    bQvle

    Joined:
    Jul 18, 2013
    Posts:
    14
    After updating to 4.5.2 most of my 2d Interpolation problems has dissapered. but even though it runs smoothly, i get random interp lags/stutter.. mini lags, pretty frequently 1-2 spikes every second or so, and they are not "even/pattern-like".

    Anyone else got this problem?
     
  41. quarag

    quarag

    Joined:
    Nov 3, 2013
    Posts:
    16
    I'm also curious if interpolation works correctly (same as in 4.3.3) in a new version.
     
  42. Zelek

    Zelek

    Joined:
    Jun 12, 2010
    Posts:
    87
    I also ran into a problem with Rigidbody interpolation after moving from 4.3 to 4.5. My problem hasn't been fixed by any of the patches or the latest release, however. Basically, rigidbody movement with interpolation stutters in 4.5, and is about half as fast. I tracked the problem down to a simple line of code that handles my Z sorting:
    Code (CSharp):
    1. transform.position = new Vector3(transform.position.x, transform.position.y, newZ);
    If I remove this code, 4.5 functions like 4.3. Any idea why this would be a problem? Is there some way I can work around it?
     
  43. JimboFBX

    JimboFBX

    Joined:
    Dec 17, 2013
    Posts:
    17
    I'm going to chime in and say that I had to revert my game back to 4.3 after upgrading to 4.5 due to this. The forces I was applying to certain objects became negligible which resulted in them standing still. This is a little frustrating because it looked like 4.5 improved hit detection, which is flaky in 4.3. For example, if I have a fast moving projectile that hits both a target which it destroys and a wall which stops it in the same fixed update, sometimes it won't detect it hitting the target. In my small experience with 4.5 it looked like this was fixed, but maybe I'm just being hopeful.

    Another issue I noticed (in code that I wrote in 4.5) is that if I apply a force to a stopped object, then check its velocity, the velocity is always zero for that frame. Not sure if this is intentional behavior to help avoid race conditions but is there some other variable I'm supposed to inspect against rather than resorting to using a boolean or co-routine that delays the check until the next fixed frame?
     
  44. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    Ok, I might be going crazy but I'm pretty sure the latest version FIXED the weird rigidbody interpolation issues I was having. Was anything fixed that could have been the cause for this (or any stutter of any kind)?
     
  45. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    505
    Physics2D is broken on Mac I've just found. My balloon blowing game in 4.5 copied from PC (Android) to Mac (iOS) doesn't work correctly with strong gravity and glitched angular velocities (applying an angular velocity causes a sudden jump in rotation before spinning). The gravity problem is fixed when the balloon is cloned after the level has loaded. The angular velocity response isn't fixed with this technique. That's on 4.5.2.p2.
     
  46. Tekksin

    Tekksin

    Joined:
    Oct 20, 2013
    Posts:
    32
    Is everybody still having issues with this? I just got unity 4.5.4 and my rigidbody movement on my character is working horrendously, while everything else is unaffected. transform.translate works, because it doesn't use the rigidbody for movement, but going up and down slopes in my game looks terrible with that, so I have to move using velocity in rigidbody.

    Lets keep this issue alive, because I'm still having problems. I made a thread about it here for more info: http://answers.unity3d.com/question...player-movement-stuttering.html#answer-793571
     
  47. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Reading your post on 'answers' I can see I have a similar setup. I had fixed all my stuttering issues on 4.3 (a lot of work, including setting the interpolation mode to 'interpolate'. After upgrading to 4.5.2 the character stutter came back and I was able to fix it by changing interpolation mode back to 'none'. Also, if you have an animator on the same object where the rigidbody2d is they interfere with each other. Hope this helps.