Hello everybody,
I’m tryng to create a simple body with a GeomTriMesh, but when I try I got the error “inertia must be positive definite” and the body doesn’t collide with any other body.
The code for creating the vertices and indices of the GeomTriMesh should be correct because if used for the Java3D IndexedTriangleArray it works perfectly:
int numVertex = 4 * 3;
int indexCount = 12;
float[] vertices = new float[numVertex];
int[] indices = new int[indexCount];
float size = 1f;
vertices[0 * 3 + 0] = 0;
vertices[0 * 3 + 1] = 0;
vertices[0 * 3 + 2] = 0;
vertices[1 * 3 + 0] = size;
vertices[1 * 3 + 1] = 0;
vertices[1 * 3 + 2] = 0;
vertices[2 * 3 + 0] = 0;
vertices[2 * 3 + 1] = size;
vertices[2 * 3 + 2] = 0;
vertices[3 * 3 + 0] = 0;
vertices[3 * 3 + 1] = 0;
vertices[3 * 3 + 2] = size;
int j = 0;
indices[j++] = 1;
indices[j++] = 2;
indices[j++] = 3;
indices[j++] = 0;
indices[j++] = 2;
indices[j++] = 1;
indices[j++] = 2;
indices[j++] = 0;
indices[j++] = 3;
indices[j++] = 3;
indices[j++] = 0;
indices[j++] = 1;
Then I just add:
Body body = new Body("pippo", world, new GeomTriMesh(vertices, indices));
And BOOM the error message appear on the screen.
Can anyone try to help me?