I really need some help here. No matter what I try, I cannot get a collision mesh built correctly. I'm using the ManualObject implementation from "OgreManualObject2.h".
In my simple test scenario, I want to create a collision representation for a cube.
I get data from newton dynamics. The vertexArray is as follows:
Code: Select all
vertexArray,24
[0] 1.00000000 float
[1] 0.000000000 float
[2] -1.00000000 float
[3] 1.00000000 float
[4] 0.000000000 float
[5] -1.00000000 float
[6] 1.00000000 float
[7] 0.000000000 float
[8] -1.00000000 float
[9] 1.00000000 float
[10] 0.000000000 float
[11] 1.00000000 float
[12] 1.00000000 float
[13] 0.000000000 float
[14] 1.00000000 float
[15] 1.00000000 float
[16] 0.000000000 float
[17] 1.00000000 float
[18] -1.00000000 float
[19] 0.000000000 float
[20] -1.00000000 float
[21] -1.00000000 float
[22] 0.000000000 float
[23] -1.00000000 float
Code: Select all
indexArray,36
[0] 0 unsigned int
[1] 4 unsigned int
[2] 10 unsigned int
[3] 0 unsigned int
[4] 10 unsigned int
[5] 6 unsigned int
[6] 1 unsigned int
[7] 8 unsigned int
[8] 17 unsigned int
[9] 1 unsigned int
[10] 17 unsigned int
[11] 18 unsigned int
[12] 2 unsigned int
[13] 20 unsigned int
[14] 21 unsigned int
[15] 2 unsigned int
[16] 21 unsigned int
[17] 3 unsigned int
[18] 5 unsigned int
[19] 22 unsigned int
[20] 12 unsigned int
[21] 5 unsigned int
[22] 12 unsigned int
[23] 9 unsigned int
[24] 7 unsigned int
[25] 11 unsigned int
[26] 13 unsigned int
[27] 7 unsigned int
[28] 13 unsigned int
[29] 15 unsigned int
[30] 14 unsigned int
[31] 23 unsigned int
[32] 19 unsigned int
[33] 14 unsigned int
[34] 19 unsigned int
[35] 16 unsigned int
Code: Select all
object->begin("BlueNoLightning", Ogre::OperationType::OT_LINE_LIST);
int idx = 0;
int connectIdx = 0;
for (int i = 0; i < indexCount; i++)
{
idx = i;
object->position(vertexArray[(idx * 3) + 0], vertexArray[(idx * 3) + 1], vertexArray[(idx * 3) + 2]);
++idx;
object->position(vertexArray[(idx * 3) + 0], vertexArray[(idx * 3) + 1], vertexArray[(idx * 3) + 2]);
connectIdx = i;
object->line(connectIdx++, connectIdx++);
}
object->end();
When I changed:
Code: Select all
object->line(connectIdx++, connectIdx++);
Code: Select all
object->line(indexArray[connectIdx++], indexArray[connectIdx++]);
I tried thousands of variations, but without success.
I hope somebody can help me out here.
Regards and Thanks in advance
Lax