interposition of Physics Bodies

I have problems with the collision between two Physic Bodies. I will explain my case, I have a basket at the bottom of screen which can be dragged left and right, then some eggs fall down from the top of the screen. When I have eggs inside the basket and I drag it, the eggs start interposing with the basket edges, till go outside.

I explained my case but that happen always between two Physics Bodies in movement.

Any idea how to avoid this problem?

PnzWR.png

--Basket body basket = display.newImageRect("basket.png", 100, 55); basket.name = "basket" basket.x = screenW\*0.5 basket.y = screenH - 106 physics.addBody( basket, "static", physicsData:get("basketSmall")) --Basket physicsData ["basketSmall"] = { { pe\_fixture\_id = "", density = 1, friction = 0, bounce = 0, filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 }, shape = { 49, -27.5 , 40, 27.5 , 25, 15.5 , 33, -27.5 } } ... } --Egg body egg = display.newImageRect( "egg.png", 21, 28 ) egg.x, egg.y = 100, 100 egg.name = "egg" physics.addBody( egg, physicsData:get("eggSmall")) --Egg physicsData ["eggSmall"] = { { pe\_fixture\_id = "", density = 1, friction = 0, bounce = 0, filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 }, shape = { 11, -7.5 , 11, 8.5 , 4, 14.5 , -4, 14.5 , -11, 8.5 , -11, -6.5 , -4, -14.5 , 6, -14.5 } } }

If you don’t want the eggs to fall out the basket you should probably remove them as moving the basket will cause forces against them and they will pile up until they fall out.

I’d suggest either:

Once an egg is completely inside the basket simply remove it and increment a counter to track the number of eggs in the basket,

or…

Create a weld joint between the basket and the eggs when they are completely inside the basket to stop them falling out.

Hi @horacebury,

Thank you! I didn’t know about weld joint in Corona. In my case removing the egg when is inside, is the best choice but my intention was solve it keeping the eggs inside. Like that I can solve a similar problem in other projects. 

Do you know about a good link of joint in Corona?

Thanks!

Erm, the Corona SDK API documentation…

http://docs.coronalabs.com/daily/api/type/Joint/index.html

http://docs.coronalabs.com/daily/api/library/physics/newJoint.html

http://docs.coronalabs.com/daily/guide/physics/physicsJoints/index.html

If you don’t want the eggs to fall out the basket you should probably remove them as moving the basket will cause forces against them and they will pile up until they fall out.

I’d suggest either:

Once an egg is completely inside the basket simply remove it and increment a counter to track the number of eggs in the basket,

or…

Create a weld joint between the basket and the eggs when they are completely inside the basket to stop them falling out.

Hi @horacebury,

Thank you! I didn’t know about weld joint in Corona. In my case removing the egg when is inside, is the best choice but my intention was solve it keeping the eggs inside. Like that I can solve a similar problem in other projects. 

Do you know about a good link of joint in Corona?

Thanks!

Erm, the Corona SDK API documentation…

http://docs.coronalabs.com/daily/api/type/Joint/index.html

http://docs.coronalabs.com/daily/api/library/physics/newJoint.html

http://docs.coronalabs.com/daily/guide/physics/physicsJoints/index.html