On Collision Event Confusion

Topics: Developer Forum, User Forum
Oct 20, 2010 at 10:39 PM

Hi, I know this question has been posted before and answered but I simple don't understand the explanation on how to get this to work. All I want to do is work out when two Fixtures collide how hard they hit each other taking into account force/impulse and their mass. 

I have read over and tried to get to work all the main posts on this topic that are referenced on other posts such as:

http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=227369

http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=227109

and mainly

http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=226860

When I try to do as explained in these posts mainly the last one I am unable to compile and get the follow two errors when using the following code

Code:

[In constructor]
objFixture.PostSolve += 
this.PostSolve;

[Somewhere 
in the class]
private void PostSolve(ContactConstraint contactConstraint)
{
            
}

Errors:

Error    1          Operator '+=' cannot be applied to operands of type 'FarseerPhysics.Dynamics.CollisionEventHandler' and 'method group'

Error    2          No overload for 'PostSolve' matches delegate 'FarseerPhysics.Dynamics.CollisionEventHandler'

 

I was at a loss to how he said in the post it worked fine when the code he said he was using results in this problem for me.

I was hoping if someone would be able to explain how to set a method to the on collision of a fixture allowing me to access the impulse values when the collide occurred. Also if I am going around this the wrong way and a better implantation is possible I am open to everything.

Thanks for your time.

Developer
Oct 22, 2010 at 1:59 AM

Easiest way to create events is to type objFixture.PostSolve += and then hit tab. This will create the proper function for you to experiment with. I could be wrong, if this doesn't work send me a demo and I'll have a quick look.

Oct 25, 2010 at 12:26 PM

Thanks very much for your help.