[ODEJava] TriMesh

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?

Are you using the latest CVS?

I think so. I downloaded this two files:

odejava-2004-10-30_cvs.zip and
2004-10-30_windows.zip

but I didn’t recompile anything. I there a problem?

The strange thing is that the other geometry works perfectly, only the TriMesh doesn’t.

What can it be?

I’m a stupid! :-[

It wasn’t the last version! Now I downloaded the new one with WinCVS and it’s working.

Anyway thanks for answer me.

No problem. Glad to hear it’s working!