Collision Event/Delegate Issues

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Collision Event/Delegate Issues

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

Re: Collision Event/Delegate Issues

Post by Norbo »

The StaticMesh is not an EntityCollidable; the sender should be a StaticMesh.
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Collision Event/Delegate Issues

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

Re: Collision Event/Delegate Issues

Post 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.
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Collision Event/Delegate Issues

Post by Stevemata »

Yep, switching to the development version corrected the issue. Awesome stuff dude.
Post Reply