[ODE] Trimesh question

Riley Lark rileylark at gmail.com
Thu Nov 2 11:43:22 MST 2006


I am trying to get trimeshes to work in my system and I am having
trouble just getting a simple pyramid to work properly.  The top
vertex of the pyramid behaves perfectly, never penetrating any other
objects significantly or anything like that, but the 4 corner vertices
don't act properly at all, and there seems to be a mysterious 6th
vertex out the bottom of the pyramid that will prop the stupid thing
up in an otherwise very unlikely spot.  Screenshot:
http://files.larkolicio.us/modball/images/badtrimesh.png  That
screenshot is stable - the object has stopped moving.  As you can see
that one vertex is well into the ground (which is a box, not another
trimesh) and is propped up at a funny angle.


This is another stable view of the pyramid:
http://files.larkolicio.us/modball/images/badtrimesh2.png

In this second screenshot the bottom vertices are behaving properly,
but that mysterious 6th vertex is propping the thing up.  About 9
times out of 10 the green side of the pyramid ends up on top (there is
only 1 green side).  The black and white side is the bottom.

I define my vertices and triangles (somewhat redundantly) as follows:

dReal vertices[6*3*3] =
{
	//RED SIDE:
	-1, -1, 0,
	0, 0, 2,
	-1, 1, 0,

	//YELLOW SIDE:
	-1, 1, 0,
	0, 0, 2,
	1, 1, 0,

	//GREEN SIDE:
	1, 1, 0,
	0, 0, 2,
	1, -1, 0,
	
	//BLUE SIDE:
	1, -1, 0,
	0, 0, 2,
	-1, -1, 0,
	
	//WHITE HALF-SIDE:
	-1, 1, 0,
	-1, -1, 0,
	1, 1, 0,
	
	//BLACK HALF-SIDE:
	-1, -1, 0,
	1, -1, 0,
	1, 1, 0,
};

int indices[6][3] =
{
	{0, 1, 2},
	{3, 4, 5},
	{6, 7, 8},
	{9, 10, 11},
	{12, 13, 14},
	{15, 16, 17},
};

And I load them with:

	dGeomTriMeshDataBuildSimple(s.tmData, vertices, 18, (const int
*)(&(indices[0])), 18);
	//dGeomTriMeshDataBuildSingle(s.tmData, vertices, sizeof(dReal)*3,
18, indices, 9, sizeof(indices[0])*3);

	geomID = dCreateTriMesh(spaceID, s.tmData, NULL, NULL, NULL);



I am really stumped... I'm using version 0.7 of ODE with trimesh
support enabled, dReal == float.

Thanks for any help!  And let me know if this is an inappropriate post
for this mailing list.


More information about the ODE mailing list