2D Tower stacking problem

Howdy,

I’m trying to recreate an old game “Tower bloxx deluxe” I used to enjoy. “Tower of Babel” is another example but it has other stacking mechanics.

After the floors are dropped it looks like a couple of floors experience the impact of the dropped floor.
The floors get slightly rotated and start pushing each other.

What I’ve done/tried so far:

  • As soon as a floor goes off screen, the RigidBody2D component is removed.
  • Increasing/decreasing mass (even stacking them from heavy to light).
  • Physics 2D material with 0 bounce and 30 friction.
  • Resetting the rotation.
  • Changed values of linear and angular drag.
  • Collision detection is continuous.
  • Interpolate is set to Interpolate.
  • Tried adding springs but they break when added them on OnCollisionEnter2D.
  • Freezing x/y/z but with freezing the wobbliness is missing

Any ideas, tips, direction?

Kind regards,
Tom

Do you need the lower buried floors to keep being physics objects? If so you might need to live with high number of solver iterations in the physics settings. Increasing damping of things might help, or even adding Fixed Joints between them, but you would need to select a breaking force if you wanted them to separate again.

Otherwise if you only care about the stacking of the final block, once it comes to rest just Destroy() its Rigidbody and the next one will need to rest on top of it.

Exactly as above. Whilst you can do stuff like add a constraint to stop them rotating etc, change the body-type to Static or remove the Rigidbody2D and you’re done. Ensure you’re using continuous collision detection for the thing dropping and constrain the rotation and likely just have a bounce of zero.

Your problem is that you likely left everything at defaults in terms of solver iterations and thought adding more physics components would help with stability. Bad idea. If you don’t need a physics-based stack to be simulated, don’t.

Note: Interpolation is how often it updates the Transform, it has no effect on the physics simulation.

So in the example, the RigidBody2D was already removed when it went off screen. I want to keep some kind of wobble on the floors that are visible.

About the Solver iterations, since it is under the Physics tab, does this also apply to Physics 2D or are they separated?
Increasing Velocity and position iterations in Physics 2D helped a bit. I’m not sure how high this can be and how much impact it has on performance.

9146080--1271044--upload_2023-7-14_7-50-52.png

9146080--1271047--upload_2023-7-14_7-51-23.png

Thank you already for the insights!

2D and 3D physics are separate systems, use the one you’re using.

Test it. Your game doesn’t exactly look like you’re doing much so it’ll have no effect from what I can see. Also, the iterations are not always used, it’s a limit on how many it can use should it need to.

Also, as stated above, use continuous collision detection.