Physics overlapping

Physics overlapping
0
#1

when i create two physics object they can collide each other and overlapping so how to create object like character they can not ovelapping to another physics object

like this type object when the ball drop inside the object then after when move the object the ball move outside of the object so can you please tell me how to create this type of body they contain another physics body 12

0 Likes

#2

What physics framework are you using? box2d? cocos2d physics?
Anyway i don’t understand your question, if i see your image, everything are colliding with everything.
The object that contains the balls (we can call it as “tumbler”), are colliding with the balls. I’m imagining the tumbler as a custom shape with N vertices.

0 Likes

#3

The elements on the floor have fallen out of the tumbler

0 Likes

#4

For the cocos2d-x built in engine

set bitmasks if you haven’t so already and return false.

Some example code with missing parts so I don’t just feed you the answer


bool/void XYZ::Overlapcode(**work out what goes here**)
{
	PhysicsBody *A = XYZ;
	PhysicsBody *B = XYZ;


	if ((2 == A->getCollisionBitmask() && 3 == B->getCollisionBitmask()) || (3 == B->getCollisionBitmask() && 2 == A->getCollisionBitmask())){}

return false
}
0 Likes