Quote:Original post by Anonymous Poster
I'm smelling the perfect place to use Boost to send Newton that class function.
boost?
Quote:Original post by Anonymous Poster
I'm smelling the perfect place to use Boost to send Newton that class function.
Quote:Original post by VanillaSnake21If you're asking what Boost is, it's a collection of C++ libraries that compliment and extend the standard C++ library (some of these libraries are actually on their way to becoming part of the SC++L).Quote:Original post by Anonymous Poster
I'm smelling the perfect place to use Boost to send Newton that class function.
boost?
c:\Documents and Settings\Owner\My Documents\Visual Studio Projects Physics Tester 2003\Physics.cpp(34) :error C2664: 'NewtonBodySetForceAndTorqueCallback' : cannot convert parameter 2 from 'void (const NewtonBody *,float)' to 'NewtonApplyForceAndTorque'None of the functions with this name in scope match the target type
It looks to me as if Newton is expecting a pointer to a function with a different signature than that of your callback function. A quick Google search for NewtonApplyForceAndTorque turns up the following:typedef void (*NewtonApplyForceAndTorque) (const NewtonBody* body);
Which matches yours, except for the second parameter of type float.Quote:Original post by jykQuote:Original post by VanillaSnake21If you're asking what Boost is, it's a collection of C++ libraries that compliment and extend the standard C++ library (some of these libraries are actually on there way to becoming part of the SC++L).Quote:Original post by Anonymous Poster
I'm smelling the perfect place to use Boost to send Newton that class function.
boost?
Before considering Boost though, let's take a look at your error:It looks to me as if Newton is expecting a pointer to a function with a different signature than that of your callback function. A quick Google search for NewtonApplyForceAndTorque turns up the following:c:\Documents and Settings\Owner\My Documents\Visual Studio Projects Physics Tester 2003\Physics.cpp(34) :error C2664: 'NewtonBodySetForceAndTorqueCallback' : cannot convert parameter 2 from 'void (const NewtonBody *,float)' to 'NewtonApplyForceAndTorque'None of the functions with this name in scope match the target type
Which matches yours, except for the second parameter of type float.typedef void (*NewtonApplyForceAndTorque) (const NewtonBody* body);
So the short answer is, drop the second parameter from your function and it will probably work. I can't really give you the long answer without investigating the Newton API though (I'm not really sure how the callback is supposed to work, or what led you to believe there was supposed to be a 'gravity' parameter).
As for Boost, I'm not sure a Boost library can be applied directly here (emphasis on 'directly'). NewtonBodySetForceAndTorqueCallback() is expecting a pointer to a function with a specific signature, no more, no less, and I don't think there's any way to 'trick' the Newton API into accepting a more sophisticated delegate object in its place. There are certainly more sophisticated things that you could do on your end with respect to callbacks, delegates, and so forth, but I can't really comment on that further without being more familiar with the Newton API.