[ODE] move body and encapsulated objects in ODE

Sharad Gupta sharadgupta at ariworld.com
Mon May 1 06:00:22 MST 2006


Hi,

I am new to ODE and just started integerated it with my graphics engine. My graphics engine is based on Direct 3d and i use .x files which have hierarchical meshes. My graphics engine application can independently move these sub meshes (composite objects). 

My doubts are:

1) Cordinate system. Do i need to interchange my coordinates. I reason i am asking this question is that in one of the ODE examples gravity is set like dWorldSetGravity (world,0,0,-0.01); So this made me wonder if the up direction (the y axis in direct 3d) is actually the z in ODE. Please help. I am confused.

2) Since i am using triangulated meshes, do i need to use boxes/cylinders/spheres etc to build corresponding shape in ODE. My meshes and submeshes are quite complex and probably it may not be possible for me to represent it using ODE shapes. I attempted writing something like this.

void* FI_CreateODEGeom(void* vertices, void* indices, int vertexcount, int indexcount)
{ 
 dTriMeshDataID data1 = dGeomTriMeshDataCreate();
 dGeomTriMeshDataBuildSimple(data1,(dReal*)vertices,vertexcount,indices,indexcount);
 // build the trimesh geom 
 dGeomID geom=dCreateTriMesh(0,data1,0,0,0);
 dGeomID transformID = dCreateGeomTransform( theSpace ); 
 //get the body to which you want to attach this geom
 dGeomSetBody( transformID, odeObject->body );
 dGeomTransformSetCleanup (transformID, 1);
 dGeomTransformSetGeom( transformID, geom ); 
 // keep a pointer to our ode wrapper object, we could need this in the collision callback etc
 dGeomSetData(transformID,(void*)odeObject); 
 odeObject->geom[odeObject->noOfGeoms++] = transformID;
 return (void*)transformID;
}

3) How to do setposition of body and its many geoms's? Initially at the time of creation, i am assuming that i need to set the position and orientation of all the geoms with respect to the body. How do i specify the center of mass/pivot of my body with reference to which i would be settin the geoms's position and orientation? Thereafter, If i do setpositon of only body then would the attached geom's also move. 

4) In the ODE text_boxstack example, i could not understand this bit for composite objects under case 'x';

// move all encapsulated objects so that the center of mass is (0,0,0)
      for (k=0; k<2; k++) {
  dGeomSetPosition (g2[k],
     dpos[k][0]-m.c[0],
     dpos[k][1]-m.c[1],
     dpos[k][2]-m.c[2]);


Can someone explain please ? I would be grateful for your help..


Thanks,
Sharad Gupta
sharad at ariworld dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060501/ee5f2da1/attachment.htm


More information about the ODE mailing list