I want to extract the vertices of a my3d-mesh to create a newton-collision with these values. The mesh is a flat plane with a shape of an circle. The circle is rendered correctely, but my ouput is strange. So the newton collision is corrupted, too.
Code: Select all
IMeshBuffer* mb = dPortals->getMesh()->getMesh(0)->getMeshBuffer(mbc);
video::S3DVertex* mb_vertices = (irr::video::S3DVertex*)mb->getVertices();
u16* mb_indices = mb->getIndices();
vector3df cloud [mb->getIndexCount()];
printf("IndexCount: %i\n",mb->getIndexCount());
int v1i, v2i, v3i;
// add each triangle from the mesh
for (j=0; j<mb->getIndexCount(); j++)
{
v1i = mb_indices[j];
cloud[j] = vector3df(mb_vertices[v1i].Pos.X,mb_vertices[v1i].Pos.Y,mb_vertices[v1i].Pos.Z);
//Output
printf("Vertex#%i: X:%f Y:%f Z:%f\n,j,cloud[j].X,cloud[j].Y,cloud[j].Z);
}
collision = NewtonCreateConvexHull (nWorld, mb->getIndexCount(), &cloud[0].X, sizeof (vector3df), NULL);
As you see there're some NAN's in there. Is this a valid output for a mesh?
If yes, what do I have to do to only get the native vertices-coordinates?