Unity god devs help! Trying to have realistic ticket physics in game.

Ok so I spent an entire day trying to get realistic ticket physics into a game.

Remember when you were a kid and tickets came out of an arcade machine? Im trying to do that.

No normally they end up folding into stacks of 5, so I want that as well. Now I knew that having realtime hinge physics for potentially 100 tickets wasnt gonna be it. So I figured Id set up a rigidbody simulation in blender and use that! Coolio!

One I had that set up and working, which was looking PERFECT, I ran into some problems.

Firstly, I have to do the rigidbody simulation with thin cubes, so there is a slight gap in between the “tickets”. I figured this wouldnt be a problem since I can convert the rigidbody physics into keyframes in blender. Then I could just have one long ticket mesh and use the animation to deform it.

But when importing the animation into unity it has each ticket as a seperate animation with tons of keyframes, a TON of data. So I tried to have a bone for each ticket, and have loop cuts so they could bend, but this turned out to be a nightmare.

As Im writing this Im thinking this could be more of a blender question, but really the issue is how to take my physics simulation into unity in an efficient way!

I would assume each ticket is a plane or paper thin cube.

If your goal is only to stack them, I would not give each ticket a collider unless the joints require them but I don’t think they do. Omitting the colliders, or at least disabling self-collision, will make this perform a lot better since physics simulation takes a hefty toll for every contact point - if you stack a lot of cubes onto one another this slows down a lot until the stack has mostly toppled over.

My thought is adding a hinge joint that rotates only around one axis to connect the two paper thin tickets, and use the angular limit to prevent the upper ticket from folding into/over the lower ticket. The limit could be extremely close to being flat, like 359.8 degrees. That way the other end of the upper ticket would slightly be elevated from the lower ticket, and when you repeat that process you get an automatic stacking behaviour (stack becomes thicker).

Thanks for the reply!

I want to create the simulation in blender and then import into Unity. There could potentially be 200 tickets, and 200 hinge joints aint gonna do it in real time.

I get the desired behaviour in blender, I just cant figure out how to utilize that in Unity.

The 200 hinge joints shouldn’t be much of an issue, unless you target Web or low end mobile. It’s the “ticket intercollision” if you have any that will cause a drop in performance. Try stacking 200 tickets without joints to see if that slows down already.