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?
4.5 changed how rotational inertia is calculated. A straight-up fix is available here: http://forum.unity3d.com/threads/248602-4-5-Physics-Inertia-fix-InertiaCalculator-component-and-editor Alternatively, you can mess around with the Rigidbody2D.inertia property to get a value you like.
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.
This has been fixed and will be in the next patch release. Sorry for any problems that this may have caused.
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)
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.
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.
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.
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.
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.
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...
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.
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!
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.
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.
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,
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.
Thanks Melv, any idea on time estimates? If not, what do you suggest to individuals who relied on this? Revert back to 4.3 or follow the link Pyrian posted? Thanks http://forum.unity3d.com/threads/24...ia-fix-InertiaCalculator-component-and-editor
Unity 4.5.1 patch1 was just released: http://forum.unity3d.com/threads/unity-patch-releases.246198/#post-1662438 Not entirely sure Melvyn's fix made it into this one, but I sure hope so. Give it a try and let us know!
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.
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..
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.
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.
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.
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.
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.
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.
Wondering if your problem is related to the following: http://forum.unity3d.com/threads/help-fixing-a-major-flaw-in-unity2d.244014/#post-1674575
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.
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?
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): 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?
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?
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)?
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.
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
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.