[SOLVED] About HelloPhysics when i setCollisionGroup and setCollideWithGroups

when i setCollisionGroup and setCollideWithGroups, the bricks are fall through the floor…

brick_phy.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);
brick_phy.setCollideWithGroups(PhysicsCollisionObject.COLLISION_GROUP_02);

i dont understand what happend, and sorry for my english.

What collision group does the floor belong to?

its default

1 Like

Which would be COLLISION_GROUP_01. So the floor and the bricks don’t collide. So there’s no contact force and nothing to keep the bricks from falling through the floor.

here is my expectation, i want my bullet shoot the brick, and doesnt shoot the floor, so i setCollisionGroup on bullet and brick, then implementsPhysicsCollisionGroupListener to fiter event, but now it doesnt work, what should i do? thanks.

If the bullet misses the bricks, do you want it to pass through the floor?

no, just like normal. but shoot the brick, i will add some effects on the collision point, so i need differentiate them.

1 Like

So use the default collision group for all objects. When a collision is detected, determine what objects were involved and handle accordingly.

but the collision() has too much event, so i want use collide() to filter, so i have this question…
Is there any better way?

I believe my suggestion is the best way.

Thanks, i just worried about whether too much conditional judgment will affect efficiency.
After all, I only care about a few collisions.

Collision groups aren’t very efficient. And they have important side effects, as you’ve seen.

1 Like

thanks again!

1 Like