Newton Tutorial

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Newton Tutorial

Post by TheGameMaker »

Hi, i found a error i the Newton tutorial:

Code: Select all

Setting up the scene 

g_newtonmap = NewtonCreateTreeCollision(nWorld, NULL);
NewtonTreeCollisionBeginBuild(g_newtonmap);
int cMeshBuffer, j;
int v1i, v2i, v3i;
IMeshBuffer *mb;

float vArray[9]; // vertex array (3*3 floats)

int tmpCount = 0;

for (cMeshBuffer=0; cMeshBuffergetMesh(0)->getMeshBufferCount(); cMeshBuffer++)
{
mb = g_map->getMesh(0)->getMeshBuffer(cMeshBuffer);

video::S3DVertex2TCoords* mb_vertices = (irr::video::S3DVertex2TCoords*)mb->getVertices();

u16* mb_indices  = mb->getIndices();

// add each triangle from the mesh
for (j=0; jgetIndexCount(); j+=3) !!!!!Here is something wrong ^^
{
v1i = mb_indices[j];
v2i = mb_indices[j+1];
v3i = mb_indices[j+2];

vArray[0] = mb_vertices[v1i].Pos.X;
vArray[1] = mb_vertices[v1i].Pos.Y;
vArray[2] = mb_vertices[v1i].Pos.Z;
vArray[3] = mb_vertices[v2i].Pos.X;
vArray[4] = mb_vertices[v2i].Pos.Y;
vArray[5] = mb_vertices[v2i].Pos.Z;
vArray[6] = mb_vertices[v3i].Pos.X;
vArray[7] = mb_vertices[v3i].Pos.Y;
vArray[8] = mb_vertices[v3i].Pos.Z;

NewtonTreeCollisionAddFace(g_newtonmap, 3, (float*)vArray, 12, 1);
}

}
NewtonTreeCollisionEndBuild(g_newtonmap, 0);
g_newtonmapbody = NewtonCreateBody(nWorld, g_newtonmap);
should be

Code: Select all

for (j=0; j<mb->getIndexCount(); j+=3)
TGM
game
Posts: 13
Joined: Sun Jul 09, 2006 2:47 pm

Post by game »

thanks for posting I hope it will work this time!
Post Reply