[ODE] Feeding Quake 3 BSP map to ODE via Tri Mesh

Chuck M. thechuckster at gmail.com
Sun Aug 22 15:35:59 MST 2004


Thanks for your help, however I've only partially solved the problem
by switching from Quick Step to World Step -- now tri mesh collision
detection works for boxes but not spheres on my Quake 3 BSP level but
both boxes and spehres work fine for my landscape, which leads me to
think that the problem lies in how I am feeding in the vertex data.

The following is a code snippet of my code:

void CQuake3BSP::creategeom()
{
	long ActVertexCount;
	long ActIndexCount;
	dVector3* Vertices;
	int* Indices;
	dTriMeshDataID Data;

	ActVertexCount = (int)m_numMeshVerts;
	ActIndexCount = (int)m_numMeshVerts;

	Vertices = new dVector3[ActVertexCount];
	Indices = new int[ActIndexCount];

	int arraycounter=0;

	for(int i=0; i<m_numOfFaces; i++)
	{
		for(int j=0; j < m_pFaces[i].numMeshVerts; j++)
		{
			int offset = m_pMeshVerts[m_pFaces[i].meshVertIndex + j] +
m_pFaces[i].startVertIndex;

			Vertices[arraycounter][0] = m_pVerts[offset].vPosition.x;
			Vertices[arraycounter][1] = m_pVerts[offset].vPosition.y;
			Vertices[arraycounter][2] = m_pVerts[offset].vPosition.z;

			Indices[arraycounter] = arraycounter;
			arraycounter++;
		}
	}

	Data = dGeomTriMeshDataCreate();
	dGeomTriMeshDataBuildSimple(Data, (dReal*)Vertices, ActVertexCount,
Indices, ActIndexCount);
	  
	geom = dCreateTriMesh(space, Data, 0, 0, 0);
}

What possibly could be wrong?

-- 
thechuckster.beigetower.org


More information about the ODE mailing list