NewtonCollisionDestructor() issue

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCollisionDestructor() issue

Postby thedmd » Mon Oct 26, 2009 6:58 am

Hello Julio,

I found NewtonCollisionDestructor() a little problematic. I'm working on managed version of Newton, but there are some problems with managing object destruction time. In this case NewtonCollision objects exacly. Callback NewtonCollisionDestructor() is set in NewtonWorld and it is called just with one argument, pointer to NewtonCollision. Becouse of that I cannot invoke proper managed callback.
In practise I can call callback for NewtonWorld which created NewtonCollision which is safe until NewtonCollisionMakeUnique() is called. After that I need to track NewtonWorld object.

Instead of making a fancy workarounds and 'current' world tracking I wish to ask you about doing following modification in API:

Code: Select all
typedef void (*NewtonCollisionDestructor) (const NewtonWorld* world, const NewtonCollision* collision);
thedmd
 

Re: NewtonCollisionDestructor() issue

Postby Julio Jerez » Mon Oct 26, 2009 7:49 am

It is not a problem but you most call
void NewtonReleaseCollision (const NewtonWorld* newtonWorld, const NewtonCollision* collision)

from a world, isn't that sufficient?
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionDestructor() issue

Postby JernejL » Mon Oct 26, 2009 8:49 am

The problem is, he uses callback to handle actual validation of destruction and there he only knows collision handle and not newton world, adding a newtoncollisiongetworld should solve the problem.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: NewtonCollisionDestructor() issue

Postby Julio Jerez » Mon Oct 26, 2009 9:05 am

I see,
Ok I add the extra argument
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionDestructor() issue

Postby thedmd » Mon Oct 26, 2009 11:14 am

NewtonCollisionGetWorld() in fact solves the problem, but there is not actual world bounded to NewtonCollision itself. Referenced World is only known while calling NewtonReleaseCollision(). Becouse of that I think additional parameter in callback is better solution.

Thank's for (quick) support.
thedmd
 


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron