[ODE] First steps and collision management.
gzanshin at gmail.com
Fri Jan 12 09:19:29 MST 2007
I've read the manual but I just need the simplest example to start. I'm
using 0.7 wrapped by ODE.NET2 and programming in C# in a XNA-GS environment.
I think I understood a bit but there's something I can't seem to grasp.
After initializing the world, the space, a box (in both) and a plane (only
geom), I start iterating quicksteps.
The box does fall, then it collides and the collision events are thrown.
¿What do I do now?
Do I have to "manually" calculate what are the effects of the collision and
apply them to the box?
Thanks for your help.
// No need to keep reading, just a sample of my code in case the problem is
I'm not using correct initial values.
protected override void Initialize()
w = new ODE.World();
w.Gravity = new Vector3(0f, 0f, -9.81f);
w.ERP = 0.2f;
b = new Body(w);
b.Position = new Vector3(0f, 0f, 10f);
b.Mass = Mass.Box(1f, 2f, 2f, 2f);
//The collision space
s = new Space();
s.Collider = new CollisionDelegate(Collision);
//The box's geom
geom = new ODE.Geoms.Box(2f, 2f, 2f);
geom.RigidBody = b;
geom.Collide += new ODE.Geoms.GeomContactEventHandler
ground = new ODE.Geoms.Plane(new Vector3(0f, 0f, 1f), 0f);
ground.Collide += new ODE.Geoms.GeomContactEventHandler
private void PhysicsUpdate(GameTime gameTime)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ODE