Here is the class
- Code: Select all
#include "PhysicsManager.h"
PhysicsManager::PhysicsManager() {
nWorld = NewtonCreate();
}
PhysicsManager::~PhysicsManager() {
// TODO Auto-generated destructor stub
}
void PhysicsManager::addHullCollisionBody(IMeshSceneNode* node){
NewtonCollision* collision =NewtonCreateConvexHull(nWorld,4,(const float*)(node->getMesh()->getMeshBuffer(0)->getVertices()),12,0,0,NULL);
NewtonBody* body=NewtonCreateBody(nWorld,collision);
UserData userData;
userData.node=node;
NewtonBodySetUserData(body,&userData);
NewtonBodySetForceAndTorqueCallback(body,ApplyForceAndTorqueEvent);//this is where im getting the error
}
void PhysicsManager::update(){
NewtonUpdate(nWorld,.016);
}
void _cdecl PhysicsManager::ApplyForceAndTorqueEvent (const NewtonBody* body,float matrix,int x){//this is the method I want to be the callback
cout<<"apply force and torque event callback"<<endl;
}
and here is the error: "error: argument of type `void (PhysicsManager::)(const NewtonBody*, float, int)' does not match `void (*)(const NewtonBody*, float, int)'"
hopefully there is a simple cast I can do to fix it, but I haven't been able to figure it out.