CompoundShape and Child Collision Detection

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
LuckySpammer
Posts: 2
Joined: Mon Mar 19, 2012 8:29 pm

CompoundShape and Child Collision Detection

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: CompoundShape and Child Collision Detection

Post 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.
LuckySpammer
Posts: 2
Joined: Mon Mar 19, 2012 8:29 pm

Re: CompoundShape and Child Collision Detection

Post by LuckySpammer »

You're the man - The development version fixed it. I'll stay on the dev branch for now.
Post Reply