Delfi wrote:What are these.. "pair of ids" you talk about? what do the IDs reprisent in your logic?
As far as I know NewtonMaterial is defined for a unique pair of two group ID's. I'm trying to follow Newton as much as possible.
Delfi wrote:Maybe NewtonBodyGetMaterialGroupID is what you are looking for? you can call it for 2 bodies.. and then you are able to retrieve or set material parameters..
Yes, but to do that I need to have two Bodies.
I will describe by problem a little more deep. I want do provide managed version of function:
- Code: Select all
void NewtonMaterialSetCollisionCallback (const NewtonWorld* newtonWorld, int id0, int id1, void* userData, NewtonOnAABBOverlap aabbOverlap, NewtonContactsProcess process);
Which in managed code looks in that way:
- Code: Select all
void SetMaterialCollisionCallback(World world, int id0, int id1, object userData, AABBOverlapCallback overlapCallback, ProcessContactsCallback processCallback);
On my side I need to store
userData object and two delegates
overlapCallback and
processCallback. Ok, this can be done without much trouble. I just have to cache those values. Then we got two similar functions:
- Code: Select all
void* NewtonMaterialGetUserData (const NewtonWorld* newtonWorld, int id0, int id1);
void *NewtonMaterialGetMaterialPairUserData (const NewtonMaterial* material);
In managed code:
- Code: Select all
object GetMaterialUserData(World world, int id0, int id1);
object GetMaterialUserData(Material material);
Both of them need to return same
userData value that has been set in SetMaterialCollisionCallback(). But in last case I'm unable to identify from which ID's this material was created and which managed object I have to return.
So I think there are two ways to solve this problem:
- add a function which give NewtonMaterial from ID's
- add a function which allow to get ID's from which NewtonMaterial is build
After some considerations I think this last one will be a better solition, becouse only some additional data will be exposed. And this may not be the case for first one.
There is also a possibility that I miss something important, but still I'm trying to do not.