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.
sgold
March 15, 2020, 6:44pm
2
What collision group does the floor belong to?
sgold
March 15, 2020, 6:48pm
4
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.
sgold
March 15, 2020, 6:58pm
6
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
sgold
March 15, 2020, 7:19pm
8
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?
sgold
March 15, 2020, 7:35pm
10
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.
sgold
March 16, 2020, 7:12pm
12
Collision groups aren’t very efficient. And they have important side effects, as you’ve seen.
1 Like