[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Callbacks not working properly when mixing Obj-c & C

Callbacks not working properly when mixing Obj-c & C

Discuss any Chipmunk bugs here.

Callbacks not working properly when mixing Obj-c & C

Postby ndizazzo » Tue Feb 22, 2011 2:35 am

ndizazzo
 
Posts: 15
Joined: Thu Feb 10, 2011 7:53 pm

Re: Callbacks not working properly when mixing Obj-c & C

Postby ndizazzo » Tue Feb 22, 2011 2:50 am

Now that I've been reading through cpSpace.c, I don't think this is a bug, just a mis-understanding of the API.

The method name of cpSpaceAddCollisionHandler() implies that we're ADDING (possibly more than one addition?) individual methods to handle collisions between objects of type a, and type b. In a class-based language, this would mean that if an object adds one of it's instance methods as a collision handler, the address would be different for every instance.

In reality, it's a generic method to handle collisions based on objects of collision_type a, and collision_type b. It tracks only one method to handle these collisions.

1) Can we move this topic elsewhere?
2) Still looking for ideas regarding how to overcome this issue based on my set up. Any ideas?
ndizazzo
 
Posts: 15
Joined: Thu Feb 10, 2011 7:53 pm

Re: Callbacks not working properly when mixing Obj-c & C

Postby ndizazzo » Tue Feb 22, 2011 3:06 am

ndizazzo
 
Posts: 15
Joined: Thu Feb 10, 2011 7:53 pm

Re: Callbacks not working properly when mixing Obj-c & C

Postby ndizazzo » Tue Feb 22, 2011 3:25 am

ndizazzo
 
Posts: 15
Joined: Thu Feb 10, 2011 7:53 pm

Re: Callbacks not working properly when mixing Obj-c & C

Postby markhula » Tue Feb 22, 2011 7:04 am

Hey,

Just to let you know I enjoyed the read. :-)
And although no fan of obj-c; I did implement a similar setup so that body->data actually points back to my real object, to avoid a similar problem.

Cheers
markhula
 
Posts: 188
Joined: Wed Feb 02, 2011 4:23 am

Re: Callbacks not working properly when mixing Obj-c & C

Postby slembcke » Tue Feb 22, 2011 9:48 am

Yep, that is the intended way to do things. Bodies, shapes, and joints all have a data pointer that you can set to point to whatever game object that owns the physics object.
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


Return to Bugs

Who is online

Users browsing this forum: No registered users and 3 guests

cron