[ODE] TriMesh ok with one index, another ordering for index makes collisions unstable

Jani Laakso jani.laakso at itmill.com
Sun Feb 8 10:19:21 MST 2004


I was under impression that TriMesh "soup" does not require any special 
ordering (like GL strips,fans), is this so?

Here's a simple TriMesh build up with 6 vertices and 4 index. It is like 
a roof of a simple house but upside down (same as V shape). It contains 
two "same" indices, first one works but the second one makes simulations 
"explode" (bodies gain high velocities) with any Geoms that come in 
contact with this TriMesh Geom.

Has anyone any clue why ODE acts differently if I change index ordering, 
even though the actual definition is the same. The result should be the 
same for both indices. I have tried also other indices with same 
definition, only ordering is changed, but I can't tell why the second 
index here is invalid?

TriMesh is defined like a "heightmap" where Z is height value and X,Y 
are coordinates stepped by 20.0f.
0--1--2
|\ |\ |
| \| \|
3--4--5

        float[] vertices = new float[] {
                0.0f, 0.0f, 10.0f,
                20.0f, 0.0f, 0.0f,
                40.0f, 0.0f, 10.0f,
                0.0f, 20.0f, 10.0f,
                20.0f, 20.0f, 0.0f,
                40.0f, 20.0f, 10.0f,
        };
       
        int[] index;
       
        // Works
        index = new int[] {
                2,5,1,
                5,4,1,
                1,4,0,
                4,3,0
        };
       
        // Does _not_ work, objects fall through and gain high velocities
        if (false)
        index = new int[] {
                0,3,4,
                0,4,1,
                1,4,5,
                1,5,2
        };
       
        GeomTriMesh triMesh = new GeomTriMesh("v-shape", vertices, index);
        triMesh.setPosition(-20, -10, 5);

-- 
Jani Laakso / IT Mill Ltd | Tel. +358 40 5898086 | http://www.itmill.com




More information about the ODE mailing list