ODE Ruby

ODE - Open Dynamics Engine

“ODE is an open source, high performance library for simulating rigid body dynamics.”
says introduction on ODE web page

ODER - ODE Ruby

ODE Ruby is direct binding to ODE library.
It’s not Object Oriented like Ruby ODE.
It is designed to be as similar as possible to the original ODE API.
In fact ODER binding is generated directly from ODE headers using SWIG.
Thanks to this you can use original ODE API documentation as a documentation for ODER. Moreover, when a new version of ODE appears, simply run rake in ODER directory. Your ODER binding will be regenerated with new ODE calls.

You may need to adjust line 42 of rakefile to point gcc to your ruby installation directory.

Usage notes

Usage example

require 'ode'  
include Ode  

world = dWorldCreate()  
dWorldSetGravity(world,0,-9.81,0)  

ball = dBodyCreate(world)  

mass = DMass.new  
dMassSetSphere(mass,1,1)  
dBodySetMass(ball,mass)  

dBodySetPosition(ball,0,10,0)  

1.upto(100) {  
        dWorldStep(world,0.01)  
        puts "Ball position: "+dBodyGetPosition(ball).inspect  
}

result:

Ball position: [0.0, 9.99901866912842, 0.0]
Ball position: [0.0, 9.99705696105957, 0.0]
...
Ball position: [0.0, 5.14404773712158, 0.0]
Ball position: [0.0, 5.04594755172729, 0.0]

More examples can be found in source tarball.

downloads: