[ODE] Smooth driving.

Jude Osborn judeosborn at gmail.com
Thu Sep 2 10:25:05 MST 2004


I"m making the usual car arcade game with sphere goms for wheels. I'm
creating my race tracks in 3D studio max and have made them about as
smooth as they're going to get. However, I continue to struggle with
my ODE car bumping and stopping when it gets to bends in the road or
hills, due to the very, very slight polygon rise. So I was wondering
if any can suggest some ODE physics settings that might make my car
take corners and hills smoothly. I'm not really interested in realism
-- I just want a simple arcade feel with a bit of skidding, and most
importantly I want my vehicle to drive smoothly. -- That's the
absolute priority.

By the way, I am using the Approx1 surface option as per the ODE FAQ,
but it's not helping at all. Here are the settings in my collide
callback function (in C#, using a modified version of David's .NET
wrapper):

ContactGeom[] cgeoms = o1.Collide(o2, 3);
if (cgeoms.Length > 0) 
{
	Contact[] contacts = Contact.FromContactGeomArray(cgeoms);

	for (int i = 0 ; i < contacts.Length ; i++) 
	{
		contacts[i].Surface.mode =  SurfaceMode.Bounce;// | SurfaceMode.Approx1;
		contacts[i].Surface.mu = 150;
		contacts[i].Surface.slip2 = 0.03f;
		contacts[i].Surface.bounce = 0.3f;
		contacts[i].Surface.bounce_vel = 0.05f;

		if (contacts[i].Geom.Geom1.Body == LeftRearWheelBody ||
contacts[i].Geom.Geom1.Body == RightRearWheelBody ||
contacts[i].Geom.Geom1.Body == LeftFrontWheelBody ||
contacts[i].Geom.Geom1.Body == RightFrontWheelBody) {
			contacts[i].Surface.mode |= SurfaceMode.Slip2 | SurfaceMode.Approx1
| SurfaceMode.FDir1;
			contacts[i].Fdir1 = contacts[i].Geom.Geom1.Body.LinearVelocity;
			Ode.Vector3 vel = contacts[i].Geom.Geom1.Body.LinearVelocity;
			float v = (float) Math.Sqrt(vel.X*vel.X + vel.Y*vel.Y + vel.Z*vel.Z);
			contacts[i].Surface.slip2 = .004f * v;
		}
		ContactJoint cj = new ContactJoint(_world, _contactGroup, contacts[i]);
		cj.Attach(contacts[i].Geom.Geom1.Body, contacts[i].Geom.Geom2.Body);
	}
}


More information about the ODE mailing list