- Home /
2D physics settings for solid 2D objects with polygon collider
I have recently updated Unity from 4.3 to 4.6. Unfortunately, when I opened my 2D game project, the behaviour of 2D physics changed too, resulting in significant gameplay problems (for instance items are more squeezable)
So my question is simple: Is there any combination of physics 2D settings in 4.6 that gives exactly the same behaviour as the physics 2D in Unity 4.3?
The difference is highlighted here:
The first one is in 4.3: it works OK. The second one is in 4.6: the same project, but now the behaviour is different:
I am using simple hexagonal grid and I am generating new elements from the bottom.
I'm not sure I understand: Can you be more specific about "more squeezable" ? What kind of colliders, what is happening vs what was happening etc...
A guess: in 4.5 the transform hierarchy order was changed: it's now sorted "by transform" ins$$anonymous$$d of alphabetically. $$anonymous$$aybe the order some objects are updated changed, causing more penetrations (is that what you mean by squeezable ?). $$anonymous$$aybe the physics 2D projects settings were not correctly converted ?
I am making tetris-like game, where ins$$anonymous$$d of tetris bricks, there are hexagons falling down and they kind of stack on each other. But on the higher levels, the hexagons seem to be affected more by gravity and "squeeze" the ones below them. I am using polygon collider with hexagon shape.Look at the image, first is ok (4.3), second is the same project but migrated to 4.6:
it shows levels (floors) around 8-11
I have updated my question with example GIFs. Again it's exactly the same project, the same files, the same scripts, the same variables. Anti-aliasing difference can also be seen there.
Ok, this is due to more penetration between objects. If it's caused by some changes in the physics engine then it's difficult to know exactly why...
Did you try changing the project's physics2D settings ? $$anonymous$$aybe increasing or decreasing some number of iterations or tolerance could help. Also decreasing the fixed update delta time in the time settings could help but will have an effect on performances.
A more general remark: that's a lot of colliders, and the polygon colliders is an expensive one! The way the colliders are stacked is kind of a worst case too for physics engine (lots of contacts all the time) so I'm surprised that it works so well with 4.3. If it's a tetris-like gameplay, it might be faster to move the objects with a script that will simulate some physics behavior but without real physics, like it's done in tetris. If it's possible, this would be faster on mobile devices.
Well, I'm sorry I can't help you more here. $$anonymous$$aybe people in the physics section of the forums could help ?
Well yeah, that's actually the question itself: what values should be increased/decreased (there are many new). Even the documentation for 2d physics settings is not up to date.
I am, of course, using scripts to simulate same features, but I wanted to hightlight the difference in physics2d in two different versions so I made this simple example with no scripts having much effect on the physics.
Your answer
Follow this Question
Related Questions
Collision 2d is not working perfectly 0 Answers
Using collider to gameobject detect attack or not 2 Answers
Is it possible to rotate a 2d collider in 3d? 0 Answers
Creating 2D collider from 3D mesh 0 Answers