This project has moved. For the latest updates, please go here.

OnSeparation never executes

Dec 6, 2009 at 1:48 PM

I'm having a problem where OnSeparation never executes for me. I'm just using simple rectangles, not even rotated or anything so it's easy to spot when it should execute. Here's some of the code I'm using:


//creates the player geom and adds the methods to their events
_playerGeom = GeomFactory.Instance.CreateRectangleGeom(PhysSim, _playerBody, 30, 1);
_playerGeom.OnCollision += OnCollision;
_playerGeom.OnSeparation += OnSeparation;

//my OnSeperation event
private void OnSeparation(Geom g1, Geom g2)
     _onGround = false;

Am I doing anything wrong there? The OnCollision method executes with no problem.



Dec 6, 2009 at 3:25 PM

The OnSeparation delegate fires like it should. Try setting a breakpoint inside your OnSeparation method and run the project with debugging enabled.

Dec 6, 2009 at 4:12 PM

I've tried that, the OnSeparation method never gets executed.

Dec 6, 2009 at 4:48 PM

I just changed Demo2 from SimpleSamples to use the OnSeparation delegate and it works like it should. You have to check if it is the correct geometry that you subscribe to the OnSeparaion delegate and you need to make sure no collisiongroup or other filtering is enabled.

Dec 6, 2009 at 5:07 PM

The only parts of my code where _playerGeom is used are the ones posted above. I haven't set any CollisionGroups, what other filtering could cause an issue with this?

Dec 6, 2009 at 5:26 PM

I've sent you an email. I can take a look at the issue if you want.

Dec 6, 2009 at 5:37 PM
Edited Dec 6, 2009 at 5:41 PM

Think I've got this fixed now. I was using 2.1.2 which has a bug with the OnSeparation event not being fired. Will confirm in a few minutes.


Yes, that was the problem.