Page 2 of 2

Re: Enhancing collision callbacks.

Posted: Mon Nov 23, 2009 1:47 pm
by dieterweb
ok, got you.

That's great. I have really some use for the collide callback.

Thomas

Re: Enhancing collision callbacks.

Posted: Tue Nov 24, 2009 5:09 pm
by maximile
Thanks Scott. It's great when new features are added to play with!

Re: Enhancing collision callbacks.

Posted: Wed Nov 25, 2009 4:44 am
by dieterweb
Can I get the info if a collision is the first (i.e. the one which invoked the collide callback) directly in the postSolve callback? Or do I have to flag those somehow myself in the collide callback?

Thomas

Re: Enhancing collision callbacks.

Posted: Wed Nov 25, 2009 9:13 am
by slembcke
dieterweb wrote:Can I get the info if a collision is the first (i.e. the one which invoked the collide callback) directly in the postSolve callback? Or do I have to flag those somehow myself in the collide callback?

Thomas
Yup, I thought of that too. Originally I wasn't going to make a separate callback for begin and preSolve, but decided it would be nicer with two instead of always putting in an if-else.

The following function returns true if this is the first step that the shapes were touching. I use it in the new player control demo to re-enable player friction the step after a collision starts so that the high impact forces don't also generate high friction forces.

Code: Select all

cpArbiterIsFirstContact(cpArbiter *arb)