Page 1 of 1

CompoundShape and Child Collision Detection

Posted: Mon Mar 19, 2012 8:38 pm
by LuckySpammer
Hello. Newb here to BEPU and physics engines in general. So far I feel very spoiled by BEPU - it's great.

I feel like this is a simple question but couldn't figure it out from existing forum posts.

I have a CompoundBody made of two Shapes. I want both shapes to be collidable with other entities, and that's working fine. However I only want to catch collision events for one of the shapes in the CompoundBody, not all of them. How is this achieved?

I tried the following but the event is never raised.

Code: Select all

compound.CollisionInformation.Children[0].CollisionInformation.Events.InitialCollisionDetected +=
(sender, other, pair) => { bla bla };
The event is raised if I attach it to the entire compound.

Re: CompoundShape and Child Collision Detection

Posted: Mon Mar 19, 2012 8:43 pm
by Norbo
That's actually a known bug in v1.1. Child collidables didn't get added to the deferred event dispatcher properly. The "immediate" version of the event (DetectingInitialCollision) would work, though such events occur in-line with the (possibly multithreaded) execution of the engine, so they have different allowed operations.

Deferred child events are fixed in the development version.

Re: CompoundShape and Child Collision Detection

Posted: Mon Mar 19, 2012 9:03 pm
by LuckySpammer
You're the man - The development version fixed it. I'll stay on the dev branch for now.