Hi,
i wanna read vertices from a mesh. the problem is: i dont know the format of the vertices.
I tried to read the vertex format from the mesh and pass the type via the GetType method to the lockvertex buffer method:
VertexFormats meshVertexFormat = mesh.VertexFormat;
Array verts = mesh.LockVertexBuffer(meshVertexFormat.GetType(), LockFlags.None, mesh.NumberVertices);
but if i execute this code ill get an unhandled exception of type 'System.ArgumentException': Additional information: Object contains non-primitive or non-blittable data.
and even if this would work i still wouldnt know how to cast verts to the appropriate array type. so i need something like this (which doesnt compile in this form):
Type t = mesh.VertexFormat.GetType();
t[] verts = (t[])mesh.LockVertexBuffer(t, LockFlags.None, mesh.NumberVertices);
anybody knows how to get the vertices? (maybe with some kind of reflection?)