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

Bob Cober AzCoder at cox.net
Sun Feb 8 07:00:25 MST 2004


I think the order of the vertices(clockwise or counter-clockwise) that 
make up a triangle does have an effect on the TriMesh collisions.  My 
experience was that the collision takes the normal of the triangle into 
account - similar to the way OpenGL calculates one-sided lighting.

I think the "explode" you are seeing is when the body collides and hits 
an inward pointing normal, then the collision adds to the penetration 
velocity.

I will post more if I learn more......



Jani Laakso wrote:

> 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);
>




More information about the ODE mailing list