Bird wrote:I'd like to remove nodes from a CompoundCollision during NewtonMaterialSetCollisionCallback. Is it possible to know on which node the contact occurred when the Collision type is CompoundCollision?
that is not a good idea, removeing object from a callcback will use the memory manager, and will lead to a guarantee crash. In newton teh memory manage is a pool base, and use free list to allocate report chunf of regualr size.
the memory mamegr is not thread safe by design, because doij that will bring teh ebnegien to a groudn hold on spin locks.
The mamory manage is use extesivally in eh engien to simply teh coding, and ti will required a lot of work, almost a New engine to make it posible to remove and add object form call back.
teh other issues with compound is that a compound may be colliding with more that one body, and it si possible that the part you removed is already saved on anothe contact pair, if remove then later that conat will be prossesing and dead pointer. solve that will also reqired lao of refering counting and will also bring the angine to a cloll.
you will have to place those part into a temporaty list and then remove then when the call back exits.
if you are going to write to memory you can use these funtion if you are using the engine with microthreads
void NewtonWorldCriticalSectionLock (const NewtonWorld* const newtonWorld);
// write to memory
void NewtonWorldCriticalSectionUnlock (const NewtonWorld* const newtonWorld);
or you can use teh thread id, to write per thread to local data, and you do no need to use critacal sections.
sorry about that but that is a very big task for the engien design now.