[ODE] [Beginner] General Informations

Aurélien .... kinju59 at gmail.com
Mon Dec 5 19:05:25 MST 2005


Hi All,

I have integrate the ODE to my project and I would like if what I done is
good.

First of all, I made a Singleton which create a world and a space, set a
default gravity and create a plane:

_worldID = dWorldCreate();
_spaceID = dSimpleSpaceCreate(0);
dWorldSetGravity(_worldID, 0.0f, -9.8f, 0.0f);
dCreatePlane (_spaceID,0,1,0,0);

Then, after loaded my .X file (I'm using DirectX) I build the TriMesh:

_bodyID = dBodyCreate(ODE::GetInstance()->GetWorldID());
_triMeshDataID = dGeomTriMeshDataCreate();
dGeomTriMeshDataBuildDouble(_triMeshDataID, vertexTab, sizeof(float),
_mesh->GetNumVertices(), indexTab, _mesh->GetNumFaces() * 3, 3*sizeof(int));
_geomID = dCreateTriMesh(ODE::GetInstance()->GetSpaceID(), _triMeshDataID,
NULL, NULL, NULL);
dGeomSetBody(_geomID,_bodyID);

Then, I apply a Mass (I don't know if Values are reals)

dMass _mass;
_mass.mass = 0.4;
dBodySetMass(_bodyID, &_mass);

Then, in response to a key typed on keyboard, I apply force to my body (I
don't know if values are reals):

dBodyAddForce(_bodyID, 0.0, 10.0, 0.0);

To finish, I advance the time at every frame:

dWorldStep(ODE::GetInstance()->GetWorldID(), 0.01);

So, when I execute my projet, I see the first scene. But when I type the key
to apply the force, all disapear, I can't see anything. Is there something
not correct?

Other question, I would like if we could create a ground associated to a
TriMesh instead a plane?

And last question, at every frame, I have the elapsed time in millis since
the last frame. I tried to make this:
dWorldStep(ODE::GetInstance()->GetWorldID(), fElapsedTime);
Even when the time is 0.5 for example, I receive an assert error which say
me that the stepTime must be > 0... Why?

Thank you very much all :)

Kinju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20051206/edd7fd93/attachment.htm


More information about the ODE mailing list