NVIDIAGameWorks / FleX

Other
670 stars 100 forks source link

NvFlexGetContacts Contact Count #11

Closed laurie-hedge closed 7 years ago

laurie-hedge commented 7 years ago

I'm trying to use NvFlexGetContacts, but I'm a little confused about the max contact count. The documentation comment in the header says the following.

@param[out] counts Pointer to a buffer of contact counts for each particle (will be <= 4), this buffer should be maxParticles in length

However when I call NvFlexGetContacts on my solver, I'm the counts buffer is filled with numbers from 0-6, not 0-4. I'm not sure if this is a Flex bug, or a documentation bug, or simply me misunderstanding something or doing something wrong. However I'm a bit concerned because for the planes and velocities buffers, the documentation comments say the following.

@param[out] planes Pointer to a destination buffer containing the contact planes for the particle, each particle can have up to 4 contact planes so this buffer should be 16*maxParticles in length @param[out] velocities Pointer to a destination buffer containing the velocity of the contact point on the shape in world space, the index of the shape (corresponding to the shape in NvFlexSetShapes() is stored in the w component), each particle can have up to 4 contact planes so this buffer should be 16*maxParticles in length

I've been sizing my planes and velocities buffers accordingly, but presumably if the max contact count is really 6 rather than 4, then these would need to be 24*maxParticles in length instead of 16*maxParticles.

Any advice on this would be much appreciated. Cheers!

Laurie

mmacklin commented 7 years ago

Hi Laurie,

Sorry this is a bug in the documentation for one of the previous versions. Indeed we increased the per-particle contact plane count to 6. So you should allocate 6*maxparticles for these buffers. We fixed the docs in the latest version:

https://github.com/NVIDIAGameWorks/FleX/blob/master/include/NvFlex.h

Cheers, Miles

laurie-hedge commented 7 years ago

Hi Miles,

Thanks for the speedy response and fix!

Laurie