# [ODE] Convex/TriMesh collisions?

Rodrigo Hernandez kwizatz at aeongames.com
Fri Mar 2 12:10:56 MST 2007

```Mark Williams wrote:
> Thanks for the quick reply! Are any of the convex colliders fully
> working in the 0.8 release?
Plane/Convex and I think Ray/Convex, there may be some sphere/convex,
but I cant really remember, my idea was that convex/convex being the
most important
was to be inplemented first, box/convex was a simplification of
convex/convex, ray/convex and sphere/convex would not be so hard to
implement and
capsule/convex was sort of a combination of ray and sphere.
convex/convex is not done, so the others are not there, but at one time
someone asked for ray/convex and I sort of gave him ideas and
implemented my own
(I think the 2 implementations are there, but only one is active).
>  Also, is there any particular order to the
> data I pass in to dCreateConvex, especially the polygon vertex ID list?
>
>
Well, in general the plane list must coincide with the polygon list
(polygon 0 must be coplanar with plane 0 and so on),
then the polygon index list must have the points in counter clockwise
order (I am not sure if this is a must, it is for OpenGL rendering),
and the index list is the count of points that represent the polygon
followed by that amount of indexes, followed by the next polygon point
count,
and then the actual indices and so on, you have an example of how to it
on test_boxstack, here is for illustration purposes:

dReal planes[]= // planes for a cube, these should coincide with the
face/polygon array
{
1.0f ,0.0f ,0.0f ,0.25f,
0.0f ,1.0f ,0.0f ,0.25f,
0.0f ,0.0f ,1.0f ,0.25f,
-1.0f,0.0f ,0.0f ,0.25f,
0.0f ,-1.0f,0.0f ,0.25f,
0.0f ,0.0f ,-1.0f,0.25f
};
const unsigned int planecount=6;

dReal points[]= // points for a cube
{
0.25f,0.25f,0.25f,  //  point 0
-0.25f,0.25f,0.25f, //  point 1

0.25f,-0.25f,0.25f, //  point 2
-0.25f,-0.25f,0.25f,//  point 3

0.25f,0.25f,-0.25f, //  point 4
-0.25f,0.25f,-0.25f,//  point 5

0.25f,-0.25f,-0.25f,//  point 6
-0.25f,-0.25f,-0.25f,// point 7
};
const unsigned int pointcount=8;
unsigned int polygons[] = //Polygons for a cube (6 squares), index
count, then indices
{
4,0,2,6,4, // positive X
4,1,0,4,5, // positive Y
4,0,1,3,2, // positive Z
4,3,1,5,7, // negative X
4,2,3,7,6, // negative Y
4,5,4,6,7, // negative Z
};

> Thanks again,
>
> Mark
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode
>
>

```