Page 1 of 1

Collision Event/Delegate Issues

Posted: Thu May 17, 2012 4:30 pm
by Stevemata
I'm getting an error that reads:

Error 48 No overload for 'InitialCollisionDetected' matches delegate 'BEPUphysics.Collidables.Events.InitialCollisionDetectedEventHandler<BEPUphysics.Collidables.StaticMesh>'

Here is where I add the delegate to my static mesh

Code: Select all

mesh.Events.InitialCollisionDetected += InitialCollisionDetected;
Here is my event

Code: Select all

public void InitialCollisionDetected(EntityCollidable sender, Collidable other, CollidablePairHandler collisionPair)
        {
        }
What mistake am I making?

Re: Collision Event/Delegate Issues

Posted: Thu May 17, 2012 4:33 pm
by Norbo
The StaticMesh is not an EntityCollidable; the sender should be a StaticMesh.

Re: Collision Event/Delegate Issues

Posted: Thu May 17, 2012 4:39 pm
by Stevemata
Oh Man. Yeah, makes perfect, obvious, sense. Okay. This event and delegate stuff is intimidating. Okay, no error now but my event isn't being triggered when I walk on the specific mesh I'm applying it to. Is there another event handler/manager that I need to add my event to do get this work correctly?

Re: Collision Event/Delegate Issues

Posted: Thu May 17, 2012 4:51 pm
by Norbo
Is there another event handler/manager that I need to add my event to do get this work correctly?
Nope, but if I remember correctly, there's a bug in v1.1 that causes deferred collision events (past-tense names) on static objects (StaticMesh, Terrain, InstanceMesh) to fail. Using immediate collision events (present-tense names) would avoid the problem, but then multithreading needs to be taken into account.

Updating to the development version should fix the problem.

Re: Collision Event/Delegate Issues

Posted: Thu May 17, 2012 5:12 pm
by Stevemata
Yep, switching to the development version corrected the issue. Awesome stuff dude.