jueves, 15 de abril de 2010


After seeing my own simulator running there is a whole lot of things that I wish it had.
All this stuff is more or less complicated to achieve, but from my previous research I have found some Open Source engines from which I can learn a lot.

The best documented one so far is ODE (www.ode.org), and also the one I intend to merge with Blender.
So, I present a very quick and thorough overview on how this works, in order to have some scope.

The first thing to disentangle is how it gets working. For that, just looking at the user's manual one gets the following algorithm:

1.-Create a Dynamics world
  • This basically means to make an instance of the dxWorld struct.
2.-Create the bodies
  • Attach the bodies to the world (this means adding data to the dxBody* array of the dynamics world).
  • Set their properties (position and orientation of point of reference, its linear and angular velocities, the mass of the bodies and some other stuff of the like).
3.-Create the joints
  • Attach the joints to the world (by adding data to the dxJoints* array of the dynamics world)
  • Set their properties (depending of the selected type of joint, one has to provide different details).
4.-Manage collisions
  • Create a new collision world (just by making an instance to the dxSpace struct).
  • Create a joint group where collisions will be stored temporarily for every frame step.
  • Apply forces to bodies.
  • Adjust joint parameters.
  • Call collision detection.
  • Create a contact joint for every detected collision point and add it to the collision joint group.
  • Take a simulation step.
  • Clear the collision joint group.
6.-Destroy the dynamics and the collision worlds (wow, that sounds evil...hehehe).

All of this seems fairly easy to do but then one has to get to know where and how things have been implemented. This is when things become a bit harder.
I am sure the file structure and the class definitions make perfect sense for the programmers of this engine.
Fortunately, they have been careful enough so as to comment everything in an understandable way, for which I feel deeply grateful.
After some digging, I have managed to restructure the ode/src folder into the following topics:
  • Accessories
    • Memory management
    • Math
    • Matrix handling
    • External applications
  • Collision
  • Core
  • Joints
  • Primitives
  • Solver
Which means one can tackle the engine in an ordered manner and find things when needed.

From a theoretical point of view, this engine presents the following features:
  • A Lagrange multiplier velocity based model from Trinkle and Stewart
  • A friction model from Baraff
  • A Danzig LCP solver

No hay comentarios:

Publicar un comentario en la entrada