[ODE] Trimesh collision problem

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Mar 20 08:07:04 MST 2007


Are dVertex and iPoly globals or class members? ODE does not copy the 
triangle data; you have to make sure it stays valid.

Cheers,

          / h+


Jürgen Ladstätter wrote:
> Hi all,
> Currently I'm trying to do some trimesh collision with a single triangle,
> but the collision does not occur :(
> Precompiler Flag dTRIMESH_ENABLED is set, sourcecode looks as follows:
>
>
> 		// 1st Vertexpoint coordinates
> 		dVertex[0] = 0;
> 		dVertex[1] = 297;
> 		dVertex[2] = 800;
> 		// 2nd Vertexpoint coordinates
> 		dVertex[3] = 297;
> 		dVertex[4] = 297;
> 		dVertex[5] = 800;
> 		// 3rd Vertexpoint coordinates
> 		dVertex[6] = 297;
> 		dVertex[7] = 0;
> 		dVertex[8] = 800;
>
> 		// Polygon combo
> 		iPoly[0] = 0;
> 		iPoly[1] = 1;
> 		iPoly[2] = 2;
>
> 		dTriMeshDataID idTrimeshData = dGeomTriMeshDataCreate();
> 		dGeomTriMeshDataBuildSimple( idTrimeshData, dVertex, 3,
> iPoly, 1);
> 		dGeomID idTrimesh = dCreateTriMesh( g_ikCDSpace,
> idTrimeshData, NULL, NULL, NULL );
> 		// create an ODE ray within the global Space and the length
> of the Renderdevice Z distance
> 		dGeomID ray = dCreateRay( g_ikCDSpace,
> g_pkGameShell->GetRenderDevice()->GetZFar() );
> 		dGeomRaySet( ray, 280, 280, 780, 280, 280, 820 );
>
> 		dContactGeom contact;
> 		if( dCollide( ray, idTrimesh, 0, &contact,
> sizeof(dContactGeom) ) != 0)
> 			log << "yes";
>
> 		dGeomTriMeshDataDestroy(idTrimeshData);
>
>
> maybe you find anything?
> Kind regards, juergen
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode
>
>
>   


More information about the ODE mailing list