After buying minecraft and playing that for a straight month I’m finally edging closer and closer back to work. So I started thinking about how inventory would be done.
In many games with inventories they come in a grid-based form. Items can only be placed on these grids - some items are bigger than others and take up more grids. Smaller items must stack. Items can’t rotate, ectect. I wanted to do away with many of these, yet keep the basic appearance.
My solution (which I can’t find any examples of) is to have the conventional 2-d view of your inventory, a backpack. There is no grid, items freely fall and nudge up against each other. Bullets small items would not stack, themselves also being an individual object with it’s own physics.
I want the physics always active though - running should shuffle them for example. So my questions are…
A: How can I render this in front of the players camera - kind of an overlay effect.
B: When the player moves items about (no grid / snapping) I want it to easily pass objects - however I also want it to slowly push objects away. Lastly, I need to make sure objects can’t condense / jitter around. In short - how can I make physics for the backpack (while keeping regular gameplay physics the same, inventory is real time) more slippery?
(posted once, don’t think it went through)
Sounds like Tetris in a bag 
Tbh I can think of better things to do with my precious clockcycles than stack items in the inventory.
Nothing comes for free.
I’m looking for answers, not opinions. How to show the inventory on top of the regular render (not UI, as it has physics) and how to use physics for a smooth experience.
Every opinion is a suggestion, =D, just a question why wouldn’t you want the bullets to stack, i thought it would be cleaner then 100 bullets lying down the bottom of the screen, although that would look cool but trying to find the right bullets could be a problem.
well so you would have to have a box to contain the objects (expands to fit the camera) if you dont wont it to be using the GUI. but if it’s for multi-player I dont think that would be a practical use but you cant render on top of the unity GUI.
i think this is what you are looking for
What you are describing is the behaviour of 3d physics, not 2d. Where items can be on top of each other, and slowly push others aside. I guess you could simulate this in 2d physics, but then you would have to describe the exact effect that you want, since it’s not just a “realistic” effect, it’s something else that exists in your mind only.
So the way to go would in my opinion would be to have a 3d bag, and 3d object models, and just throw them all in the bag with rigidbodies, affected by gravity and pushing each other, shuffling, etc. Then you’d put all this in a remote part of your scene (outside the play area), and add another camera just for this, it can be a 2D orthographic camera to get a 2D bag appearance. The bag should of course be set so that it’s bottom is facing down (for the gravity), and the camera would look at it top down. Then when running, you can give the bag itself (which btw is not affected by gravity) some velocity to bounce it up and down, which will in turn cause all the items inside to move accordingly.
That said, I have to state my opinion, that other than performance issues this might cost, it sounds like such a bad player experience… spending so much time shuffling things around the bag looking for a bullet in the bottom doesn’t sound like a fun gaming experience to me.