- Home /
Stack of 2D blocks acts like a rubber
Base: we are building 2D game like a tetris, where blocks are stacked on top of each other. Blocks should be physical, this is a constraint.
Problem: when vertical column of blocks falls down, it behaves like a stack of rubber blocks, bouncing up and down for a few seconds after landing earth and it is very annoing.
Goal: we want all blocks to act like solid stone squares, not like rubber.
Our attempts:
Make all blocks Monobehaviour and use tricks like this: (http://answers.unity3d.com/questions/180132/several-box-colliders-stacked-on-top-of-eachother.html ). Due to the total number of blocks, this method has killed all performance.
Play with
Preferences->Physics2D
values (Baumgarte, Min penetration
), but nothing really helped (although behaviour changed a little).Check it in both Unity4 and Unity5.
Try
BoxCollider2D
andEdgeCollider
for block.
Question: i believe that terrain built with blocks is relatevely popular thing. Do you have any ideas how to solve our problem?
Have you checked if your collider is actually using a bouncer?
This raises sooo many questions about what you are actually trying to do and what would be the best way to achieve it.
How many objects do you have colliding with each other on average ? And do you really need physics? $$anonymous$$ost 2D or even 3D puzzle games don't have real physics unless the game mechanic depends on it. Tetris certainly doesn't use a physics engine.
A terrain built with blocks a la $$anonymous$$inecraft? In that type of Voxel games one thing to remember is that the blocks are mostly placed in predeter$$anonymous$$ed positions and become "static" when placed. This enables many kinds of optimizations and blocks are seldom (never?) dangling on top of each other causing collision checks.
The beauty in Voxel graphics is that you are actually modifying 3D meshes and their data, so what looks like a hill made of a 100 cubes is actually a single 3D mesh that causes very little strain on the system.
1) Do you mean Bounciness
of Physical material? If yes, it is set to 0.
2) Yes, may be analogy with tetris is not perfect: i tried to illustrate "2D blocks on top of each other" idea (about 10-20 in a stack).
Yes, we need physics for other purposes, and it (surpisingly) works now without any performance problems. But i understand how good is to have static blocks in terms of physics engine.