So, I am creating application, that will cook PhysX shape from wavefront .obj model file. My code for the cooking function is this:
PxTriangleMeshDesc meshDesc;
meshDesc.points.count = vertices.size();
meshDesc.triangles.count = indices.size();
meshDesc.points.stride = 4*3;
meshDesc.triangles.stride = 4*3;
meshDesc.points.data = vertex_array;
meshDesc.triangles.data = index_array;
MemoryWriteBuffer buf;
bool status = nxCooking->cookTriangleMesh(meshDesc, buf);
however, it always fails at the last line, giving me System.AccessViolationException
with additional info Attempted to read or write protected memory.
I believe this has something to do with the c++ winform using managed types, and being more memory safe. Am I right? If so, how can I possibly work it around? The MemoryWriteBuffer is part of PhysX SDK, located in PxToolkit