I used
- Code: Select all
defaultGroupID = NewtonMaterialGetDefaultGroupID(nWorld);
NewtonMaterialSetCollisionCallback (nWorld,defaultGroupID,defaultGroupID,NULL,NULL,contactProcess);
to set the callback, and my callback is...
- Code: Select all
static void contactProcess(const NewtonJoint* contact, dFloat timestep, int threadIndex){
dFloat contactSpeed= NewtonMaterialGetContactNormalSpeed (NewtonContactGetMaterial(contact));
cout<<contactSpeed<<endl;
}
The callback is called everytime a collision occurs, so that works fine, but I can't figure out how to get the contactSpeed from what the callback function provides (I can't figure out how to get the material for the contact)
What I currently have in the callback function crashes on contact.
Thanks in advance.
EDIT: I figured out I needed to convert the NewtonJoint contact into an actual contact, and then it works perfectly. Sorry for bothering
- Code: Select all
static void contactProcess(const NewtonJoint* contact, dFloat timestep, int threadIndex){
dFloat contactSpeed= NewtonMaterialGetContactNormalSpeed (NewtonContactGetMaterial(NewtonContactJointGetFirstContact (contact)));
cout<<contactSpeed<<endl;
}