Does CompoundCollisionShape mean ”BoundingBoxCollisionShape”?

I’ve noticed a strange behavior when using a CompoundCollisionShape. It seems it uses the bounding box of its ChildCollisionShapes. Is that intended?







Here’s the code:

[java]

public void simpleInitApp()

{

//…

BoxCollisionShape box_coll = new BoxCollisionShape(new Vector3f(0.25f, 0.25f, 0.25f));

CompoundCollisionShape comp_coll = new CompoundCollisionShape();

comp_coll.addChildShape(box_coll, new Vector3f(5.406f, 0.250f, 8.183f));

comp_coll.addChildShape(box_coll, new Vector3f(8.132f, 0.250f, 5.185f));

finish = new GhostControl(comp_coll);

tiltNode.addControl(finish);

bulletAppState.getPhysicsSpace().add(finish);

//…

}



public void simpleUpdate(float tpf)

{

//…

if (finish.getOverlappingObjects().contains(ball_phy))

{

log.severe(“FINISH HIM!!!”); // breakpoint here => screenshot

}

//…

}

[/java]

A CompoundCollisionShape allows combining multiple base shapes to generate a more sophisticated shape.

That’s right. And since I wouldn’t call the bounding box of its children “sophisticated”, it might not be intended as it is. But that’s the question.

That’s just the visuals. No worries about that! Despite it’s just a compound collision shape, not a hull collision shape xD.

The author of Bullet says: “The btCompoundShape allows to store multiple other btCollisionShapes. This allows for moving concave collision objects. This is more general than the static concave btBvhTriangleMeshShape. It has an (optional) dynamic aabb tree to accelerate early rejection tests.”



I just plugged in native bullet. It behaves the same. Seems to be intended or I’m not using it correctly. Anyway, two different GhostControls work and I’ll just do it that way.

I still didn’t get your point. The image doesn’t help. And I’ve used compound collision shapes a lot a few months ago, and I’ve never noticed any strange behavior with that.

I also don’t get what you mean. You create a compound shape of three boxes, they all three appear in the screenshot…?

Ok, the screenshot is not very good. The CompoundCollisionShape consists only of two boxes - each positioned at one of the two exits of the labyrinth - to detect if someone found a way out. The labyrinth mesh is not part of the CompoundCollisionShape. It’s just the two boxes.



If I move the ball into the (imagined) bounding box of the two boxes, the condition in line 17

[java]finish.getOverlappingObjects().contains(ball_phy)[/java]

becomes true. I would have expected this condition to become only true if the ball hits one of the two boxes. The debug wireframe shows the CompoundCollisionShape as two separate boxes, but it behaves different.

Ah, you want to use the GhostObjects to check for overlaps… Might be that only works for the bounding/single shapes, yeah. But you can simply use multiple GhostObjects… But I don’t know really, check the bullet manuals I guess.