[ODE] First steps and collision management.

Zanshin gzanshin at gmail.com
Fri Jan 12 09:19:29 MST 2007

```   Hi

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?

// ------------------
// No need to keep reading, just a sample of my code in case the problem is
I'm not using correct initial values.

//Global
ODE.World w;
ODE.Body b;
ODE.Space s;
ODE.Geoms.Plane ground;
ODE.Geoms.Box geom;

//Initialization
protected override void Initialize()
{
//ODE World
w = new ODE.World();
w.Gravity = new Vector3(0f, 0f, -9.81f);
w.ERP = 0.2f;

//The box
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
(geom_Collide);

//The ground
ground = new ODE.Geoms.Plane(new Vector3(0f, 0f, 1f), 0f);
ground.Collide += new ODE.Geoms.GeomContactEventHandler
(ground_Collide);

base.Initialize();
}

private void PhysicsUpdate(GameTime gameTime)
{
s.Collide();
w.QuickStep(1f, 1);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mooshika.org/pipermail/ode/attachments/20070112/47ff928d/attachment.htm
```