Sometime cocos2d-x physics in my game is wrong?

I wrote a game for test . In my game , there are coin and a ground . Coin contact with ground return true (can get through) but sometime (5%-10%) the coin go through the ground :frowning: . Is that my fault or cocos2d-x ??

is the ground just a segment shape with no width?

then that will be easily penetrated by small or fast moving objects.

gitve the segment shape some width will solve this problem

the ground width is 2 pixel ! but you’re right , I’ll make the ground thicker and test . Thank for support

hey ! It doesn’t work ! I create edgebox with width 4 , then 10 pixel , the coin sometime just go throught (4pixel ground) , and sometime stuck in the space inside the ground (10 pixel-width-ground).

auto b = PhysicsBody::createEdgeBox(Size(_tileMap->getContentSize().width - 4,4));	
b->setContactTestBitmask(true);
b->setCollisionBitmask(GROUND_COLLISION_BITMASK);

onContactBegin

if ( ( COIN_COLLISION_BITMASK == a->getCollisionBitmask( )) 
|| ( COIN_COLLISION_BITMASK == b->getCollisionBitmask( )) )
    {
	if (COIN_COLLISION_BITMASK == a->getCollisionBitmask( ) && COIN_COLLISION_BITMASK == b->getCollisionBitmask( )) return false;

	if (GROUND_COLLISION_BITMASK == a->getCollisionBitmask( ) || GROUND_COLLISION_BITMASK == b->getCollisionBitmask( )) return true;
        return false;
    }