[NEWBIE] Callbacks's parameters

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[NEWBIE] Callbacks's parameters

Postby Kapitan » Thu Oct 09, 2008 1:01 pm

Hi guys i have a simple newbie question :D

When i use Callbacks (any type), i've seen
in some example that the parameter is
always a NewtonBody *...

But how can i pass to my callback function other
parameters?

Thanks for answers.
Kapitan
 
Posts: 37
Joined: Thu Apr 17, 2008 6:07 pm

Re: [NEWBIE] Callbacks's parameters

Postby JernejL » Thu Oct 09, 2008 4:03 pm

you set a userdata pointer for your newton bodies which points at that data.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [NEWBIE] Callbacks's parameters

Postby Kapitan » Thu Oct 09, 2008 5:03 pm

Yep, but for example NewtonForEachPolygonDo
wants a callback, but it iterates on polygons,
so what is the object i have to manage in
the body of my function?

And/Or what are the parameters aka variables
in the scope of the function that i can manage?
Kapitan
 
Posts: 37
Joined: Thu Apr 17, 2008 6:07 pm

Re: [NEWBIE] Callbacks's parameters

Postby JernejL » Thu Oct 09, 2008 7:18 pm

Please try to be a bit clearer what you want to do, the NewtonForEachPolygonDo calls your callback for each individual callback, you can only read that data and not change it.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [NEWBIE] Callbacks's parameters

Postby Kapitan » Sat Oct 11, 2008 6:39 am

I've partially resolved.

I was wrong with the callback call...

i've a callback function in my object
and i've found i have to make it static
to work...
Kapitan
 
Posts: 37
Joined: Thu Apr 17, 2008 6:07 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 23 guests

cron