Can anyone here help?
Code: Select all
collision = NewtonCreateTreeCollision(physworld, NULL);
NewtonTreeCollisionBeginBuild(collision);
// loop through, adding triangles.
mesh->grab();
singleframe = mesh;
totalbuffers = singleframe->getMeshBufferCount();
for (int i = 0; i < totalbuffers; i++)
{
meshbuffer = singleframe->getMeshBuffer(i);
meshbuffer->grab();
//mb_vertices = (irr::video::S3DVertex2TCoords*)meshbuffer->getVertices();
//mb_indices = meshbuffer->getVertices();
mb_vertices_total = meshbuffer->getVertexCount();
for (int a = 0; a < mb_vertices_total-2; a++)
{
for (int b = 0; b < 3; b++)
{
p[b] = meshbuffer->getPosition(a+b);
newvertex[b][0] = p[b].X;
newvertex[b][1] = p[b].Y;
newvertex[b][2] = p[b].Z;
}
NewtonTreeCollisionAddFace(
collision,
3,
&newvertex[0][0],
sizeof(float)*3,
1);
nonlua_debug("Adding triangle " << a << " of " << mb_vertices_total-2,LVL_INFO);
}
meshbuffer->drop();
}
singleframe = 0;
mesh->drop();
NewtonTreeCollisionEndBuild(collision, 0);