I've downloaded the very latest beta and I noticed the begin/process/end callbacks have been changed to the aaboverlaps/process callbacks. I having a problem with this. The new code should look like this:
- Code: Select all
for (void* contact = NewtonContactJointGetFirstContact (contactJoint); contact; contact = NewtonContactJointGetNextContact (contactJoint, contact))
{
NewtonMaterial* material;
material = NewtonContactGetMaterial (contact);
NewtonMaterialSetContactElasticity (material, restitution);
}
(code taken from the BasicRestitution demo).
How does NewtonMaterialSetContactElasticity know for which contact I am setting the elasiticity? Does NewtonContactJointGetFirst/NextContact remember which contact it returned last and this one is used?
Is there a way to do this here:
- Code: Select all
void* contact1 = NewtonContactJointGetFirstContact (contactJoint);
void* contact2 = NewtonContactJointGetNextContact (contactJoint, contact1);
NewtonMaterialSetContactElasticity (material, 0.5f); // this should affect contact1
NewtonMaterialSetContactElasticity (material, 0.2f); // this should affect contact2
Maybe NewtonMaterialSetContactElasticity can look like
- Code: Select all
NEWTON_API void NewtonMaterialSetContactElasticity (const NewtonMaterial* material, const void* contact, dFloat restitution);
or
NEWTON_API void NewtonMaterialSetContactElasticity (const void* contact, dFloat restitution);
Then I could do
- Code: Select all
void* contact1 = NewtonContactJointGetFirstContact (contactJoint);
void* contact2 = NewtonContactJointGetNextContact (contactJoint, contact1);
NewtonMaterialSetContactElasticity (material, contact1, restitution); // this should affect contact1 (first version)
or
NewtonMaterialSetContactElasticity (contact2, restitution); // this should affect contact2 (second version)
The same question applies to all the other NewtonMaterialSetContact* functions like NewtonMaterialSetContactNormalAcceleration, NewtonMaterialContactRotateTangentDirections, etc..
-Matthias
P.S.: Any chance this is integrated into one of the next versions? http://www.newtongamedynamics.com/forum ... a64ccf423f