Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Here's my situation:

I have several objects that contain a body and a fixture. They are set to sensor = true;

atmosphere = BodyFactory.CreateCircle(world, atmosphereRadius / Level.METER_IN_PIXELS, 1f, new Vector2(pos.X, pos.Y));
atmosphere.IsSensor = true;

//JointFactory.CreateWeldJoint(world, this.getBody(), atmosphere, getBody().LocalCenter, atmosphere.LocalCenter);

this.registerBeginContact(new BeginContactDelegate(this.OnBeginContact));
this.registerEndContact(new EndContactDelegate(this.OnEndContact));

I commented out the join part because it didn't seem to make a difference either way. When the object we control goes enters any of these bodies, the even its fired properly. However, when the player object leaves the sensor field, it doesn't fire the OnEndContact method, EXCEPT if it was the last object that I call

this.registerEndContact(new EndContactDelegate(this.OnEndContact));

When my OnEndContact method is called by the EndContact event in ContactManager, it is called for ALL the delegates I registered, including the ones that are tied to the objects that are not getting these events to fire. The OnBeginContact delegates work perfectly, firing for every object, but the EndContact event does not.

Does anyone have any idea why this is happening or is this a bug in Farseer?

for reference my register methods look like this

public void registerBeginContact(BeginContactDelegate action)
{
    getLevel().getWorld().ContactManager.BeginContact += action;
}


public void registerEndContact(EndContactDelegate action)
{
    getLevel().getWorld().ContactManager.EndContact += action;
}

Thanks in advance.

this is also posted on the farseer code plex page Faeseer EndContact Discussion

share|improve this question
    
I assume you've search all of your own code for a call of the form ContactManager.EndContact = action. –  Joshua Drake Apr 26 '12 at 15:29
    
I can double check but the only place the delegates are being accessed is in the constructor of that class which all of these collidable objects are extending. So its that code I quoted here and that's it. Unless someone understands farseer better I'll just have to brute force this feature. I was hoping there was another way to register EndContact events –  Flostation Apr 26 '12 at 22:55
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.