Sign in to follow this  

Toakamak Terrain Problem

This topic is 4376 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I've gone through the codesampler tutorial, to get a terrain mesh using 3ds up and running. I've checked that the vertices and indices stored in the neTriangleMesh triMesh; structure are correct, by rendering them as a wireframe overlay, but all my rigid bodies don't seem to collide at all. http://img16.imageshack.us/img16/5955/screen045nt.jpg and here's the f() for setting up the mesh
int		CPhysicsManager::addTriangleMeshBody( t3DObject* pObject ){

	if(nCounter_triangleMeshBody<MAX_TRIANGLEMESHBODIES){

		nCounter_triangleMeshBody++;

		pTMB[nCounter_triangleMeshBody]					=	new	tTriangleMeshBody;

		pTMB[nCounter_triangleMeshBody]->numOfTriangles	=	pObject->numOfFaces;
		pTMB[nCounter_triangleMeshBody]->numOfVerts		=	pObject->numOfVerts;

		int		numOfTriangles	=	pTMB[nCounter_triangleMeshBody]->numOfTriangles;
		int		numOfVerts		=	pTMB[nCounter_triangleMeshBody]->numOfVerts;


		pTMB[nCounter_triangleMeshBody]->triVertices	=	new neV3 [numOfVerts];
		pTMB[nCounter_triangleMeshBody]->triData		=	new	neTriangle [numOfTriangles];


		//	fill in the array
		for(int i=0;i<numOfVerts;++i){
			pTMB[nCounter_triangleMeshBody]->triVertices[i].Set( pObject->pVerts[i].x, pObject->pVerts[i].y, pObject->pVerts[i].z);
		}


		for(int j = 0; j < numOfTriangles; j ++)
		{
			pTMB[nCounter_triangleMeshBody]->triData[j].indices[0]	=	pObject->pFaces[j].vertIndex[0];
			pTMB[nCounter_triangleMeshBody]->triData[j].indices[1]	=	pObject->pFaces[j].vertIndex[1];
			pTMB[nCounter_triangleMeshBody]->triData[j].indices[2]	=	pObject->pFaces[j].vertIndex[2];
			pTMB[nCounter_triangleMeshBody]->triData[j].flag		=	neTriangle::NE_TRI_TRIANGLE;
			pTMB[nCounter_triangleMeshBody]->triData[j].materialID	=	0;
		}
		


		pTMB[nCounter_triangleMeshBody]->triMesh.vertices		= pTMB[nCounter_triangleMeshBody]->triVertices;
		pTMB[nCounter_triangleMeshBody]->triMesh.triangleCount	= numOfTriangles;
		pTMB[nCounter_triangleMeshBody]->triMesh.triangles		= pTMB[nCounter_triangleMeshBody]->triData;


		return nCounter_triangleMeshBody;
	}
	else{
		return -1;
	}
}




I've had problems with y and x being reversed in the past, but this doesn't seem to be the case i don't think. Anyway, i'm stuck!!!!!

Share this post


Link to post
Share on other sites

This topic is 4376 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this