How to update triangle meshes in Flex every game frame...


I am trying to update the position of vertices at every frame for a properly constructed triangle mesh constructed with NvFlexCreateTriangeMesh() and updated with NvFlexUpdateTriangleMesh() (See docs

Every works perfectly if I create and update my triangle mesh ONCE during construction but I get CUDA errors 4 in ‘cudaMemcpyAsync’ when I try to call NvFlexUpdateTriangleMesh{} during the update frame.

I have tried shifting my per-frame call to NvFlexUpdateTriangleMesh() at different times relative to per-frame Flex pull-from-GPU, modify structures, push-to-GPU but nothing works.

Q1: Can triangle meshes have their vertices updated once a frame?

Q2: If so, when can I update?

Q3: What memory flag do I use? (Host, HostAsync, Device, DeviceAsync)

Many thanks for any clue you might have… grasping at straws for days!!


Figured it out thanks. Problem is I was feeding a bad pointer into it! Arg!!! :)