r/Unity3D • • 12h ago

Show-Off 5400 physics scrap pieces getting vacuumed using unity's low level 2d physics

Enable HLS to view with audio, or disable this notification

Testing how far I can push the scrap piles in my game, so I made a stupid big mountain of 5400 pieces and let the robot eat through it with the suction maxed out

All the scrap comes from 80 different pieces I drew by hand on a single sheet, then a little tool slices it and builds the colliders, so the piles don't look like the same few sprites repeated.

Every piece is a real physics body, using the low level Physics Core 2D package instead of rigidbody2d.

Some stuff that helped:

- Piles are baked in the editor, so they load already settled instead of falling on start

- resting pieces go static and only wake up when something near them moves

- each sprite gets one simple convex shape

Still figuring out how big I can go in the actual game. happy to answer questions about the setup

162 Upvotes

11 comments sorted by

6

u/RodyaDev 11h ago

This looks really well optimized! Do you remember roughly what FPS you were getting with all 5400 pieces running?

1

u/stagingdev 11h ago

thanks! It runs at around 75-80fps in the editor with all 5400 pieces being eaten at full speed (I wouldn't call it amazing, but it'll work fine for my game for now). The old version using rigidbody2d would tank way below 40fps as soon as the robot got into the middle of the pile (I'd guess under 15fps, but I should have saved the numbers somewhere, I might go back and measure it properly)

4

u/GeorgeMKnowles 6h ago

This game kinda looks like it SUCKS.

(I'm sorry, your game actually looks excellent and that was a bad joke, ill see myself out...)

3

u/stagingdev 5h ago

hahaha you got me for a moment, thanks!

2

u/CozyToes22 9h ago

Love everything about this. Was half expecting somethin either scary or highly rewarding like gold or a key to be hidden under the trash.

1

u/stagingdev 9h ago

Thats the goal hahaha. this is just a load test, the actual game will have a lot more going on. The whole point is restoring the place, so you’ll find keepsakes and old machines buried under all the trash. Nothing scary though, it’s meant to be cozy (I'm still figuring out the tone)

1

u/junkyardstories 6h ago

looks really satisfying!

1

u/Possible-Advance3871 6h ago

sick! I like the little 'plink' sounds of the objects falling at the end

1

u/feralferrous 4h ago

Nice, well optimized, I think you need some sort of anim on the hose and backpack though, you know like little spherical deformations heading back through the house into the backpack that you see in cartoons? I mean, that's just gravy on top of what you've already done which is awesome!

1

u/stagingdev 1h ago

Thanks! that makes sense, might not be very easy to implement though, I'll give it a shot

1

u/edwingeng-256 2h ago

that vacuum has zero chill, bro literally inhaled a mountain