[ODE] Newbie TriMesh problems

The Hutch the.hutch at virgin.net
Fri Apr 7 06:40:09 MST 2006


OK - so it turned out the problems I was experiencing were caused by an
incorrectly set rotation matrix. After tracking down the cause - it was
because I thought Quaternions were in the form:

	x, y, z, w

and not

	w, x, y, z

That has now fixed some of my problems.

However, I am still experiencing difficulties. A quick reminder: I have a
large TriMesh representing my terrain and a single sphere. When I keep the
terrain flat it works fine, the ball bounces on the spot as you would
expect. However, as soon as I add a substantial amount of height data, there
appear to be "holes" in the tri mesh - the sphere just passes straight
through it.

I have debugged the code as best I can - I slow time right down when the
sphere is intersecting the terrain - then I step through. In the function
"dCollideSTL" it never flags a contact. So it retuns in the test:

	if (! Collider.GetContactStatus()) {
		// no collision occurred
		return 0;
	}

I would really appreciate some help with this.

Rich




-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of The
Hutch
Sent: 06 April 2006 15:23
To: ode at q12.org
Subject: [ODE] Newbie TriMesh problems


Greetings,

I have only recently started to use ODE and am having trouble with
TriMesh's. I am attempting to have a sphere bounce around a TriMesh
landscape.

In my world I have a left handed coord system with Y up. Everything works
fine for the most degenerate of cases (i.e. a flat terrain) but as soon as I
add a little height that's when things start to go wrong. It was necessary
for me to change the orientation of my triangles in order for the normals to
be pointing in the correct direction.

The setup of my TriMesh is as follows:

...

// Assume the existance of a class called xTerrainMesh that contains a
// collection of CollisionTri's

int iNumTris  = xTerrainMesh.GetNumTris();
int iNumVerts = 3 * iNumTris;

m_pxVerts = new dVector3[iNumVerts];
m_pxTris  = new int[3 * iNumTris];

int i  = 0;

CollisionTri* pxTri = xTerrainMesh.GetFirstTri();
for( int iTri = 0; iTri < xTerrainMesh.GetNumTris(); ++iTri, pxTri =
pxTri->m_pxNext )
{
    m_pxVerts[i][0] = pxTri->m_xA.fX;
    m_pxVerts[i][1] = pxTri->m_xA.fY;
    m_pxVerts[i][2] = pxTri->m_xA.fZ;
    m_pxTris[i] = i;
    i++;

    m_pxVerts[i][0] = pxTri->m_xC.fX;
    m_pxVerts[i][1] = pxTri->m_xC.fY;
    m_pxVerts[i][2] = pxTri->m_xC.fZ;
    m_pxTris[i] = i;
    i++;

    m_pxVerts[i][0] = pxTri->m_xB.fX;
    m_pxVerts[i][1] = pxTri->m_xB.fY;
    m_pxVerts[i][2] = pxTri->m_xB.fZ;
    m_pxTris[i] = i;
    i++;
}

m_pTriMeshData = dGeomTriMeshDataCreate();

dGeomTriMeshDataBuildSimple( m_pTriMeshData,
					 (dReal*)m_pxVerts, iNumVerts,
						 m_pxTris, 3 * iNumTris );

...

So my questions are:

[1] Is there somewhere I can get more TriMesh help or examples?
[2] What am I missing?  Do other people use TriMesh's or are they using
their own collision detection routines?

Any help would be very much appreciated.

Thanks,

Rich


_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode




More information about the ODE mailing list