Enhancing collision callbacks.

Discuss new features and future development.

Would you like this functionality:

Sooner! I have awesome uses for this.
5
100%
Later. Please don't break my code that relies on trunk!
0
No votes
 
Total votes : 5

Re: Enhancing collision callbacks.

Postby dieterweb » Mon Nov 23, 2009 1:47 pm

ok, got you.

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

Thomas
Visit our game Blog: http://zombiesmash.gamedrs.com or follow us on twitter: http://twitter.com/zombiesmash
dieterweb
 
Posts: 176
Joined: Fri Feb 27, 2009 7:12 am
Location: Germany

Re: Enhancing collision callbacks.

Postby maximile » Tue Nov 24, 2009 5:09 pm

Thanks Scott. It's great when new features are added to play with!
maximile
 
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK

Re: Enhancing collision callbacks.

Postby dieterweb » Wed Nov 25, 2009 4:44 am

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
Visit our game Blog: http://zombiesmash.gamedrs.com or follow us on twitter: http://twitter.com/zombiesmash
dieterweb
 
Posts: 176
Joined: Fri Feb 27, 2009 7:12 am
Location: Germany

Re: Enhancing collision callbacks.

Postby slembcke » Wed Nov 25, 2009 9:13 am

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)
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Previous

Return to Features/Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron