[solved]Using physics to simulate objects sliding around a frying pan

So I’m working on a cooking game and I’m trying to implement physics for the player to “shake” things in a frying pan, similar to this:
giphy

I know I need to put an invisible “ring” of objects around the edges of the pan to simulate walls, but they don’t stay stuck to the pan object when it’s being dragged. The pan has draggable behavior and the walls have sticker behavior to stick to the pan + physics2 behavior because the egg needs to bounce off them. With physics off, they stick perfectly, but with it on, they bounce around like elastics while dragging the pan around. I made an egg object too with a custom collision mask outline the edges of the texture, but I haven’t put physics on it yet because I’m unsure if I need friction joints on the egg and the pan.

image
image
image

You’ll have problems there. Get rid of the sticker behaviour, and use something like a weld joint instead, to fix the rim to the pan.

Thanks, I got it working. I used weld joints to anchor the boundary sprites to the frying pan sprite, a mouse joint to drag the handle, then used a friction joint between the pan face and the steak, and set the steak to have friction wherever it’s at. Here’s the finished result, the “ghost drift” of the items when it’s still is from the circle collision masks squeezing in the corners:
ezgif-2-c4290815b7



I got a lot of ideas from one of the example games demonstrating physics engines

2 Likes