[ODE] Static objects start rotating?

James Frye fryeja at us.ibm.com
Sun Aug 12 13:33:49 MST 2007


"Jon Watte (ODE)" <hplus-ode at mindcontrol.org> wrote on 08/12/2007 08:51:55
AM:

> First, are you creating a ground? If so, how?
> Are you using gravity? If so, how much?
> Are you using fixed or variable step size?
> What does your nearcallback look like? What joints are created, if any,
> each step?
>
> If you have, say, a plane for ground, and you use reasonable gravity, a
> step size of 0.01, and create at least 3 contacts per body (preferrably
> more), it should come to rest pretty quickly, although a little
> rotational and linear inertial dampening each step certainly helps.

The ground plane & gravity are set with

  dWorldSetGravity (world, 0.0, 0.0, -9.81);
  dCreatePlane (space, 0.0, 0.0, 1.0, 0.0);

I'm using a fixed timestep, dT = 0.005 sec.  That was selected because it
gave close to realistic time in other models, and let me put off doing
real timing code.

The nearCallback code is

  b1 = dGeomGetBody (o1);
  b2 = dGeomGetBody (o2);

  /* exit without doing anything if the two bodies are connected by a joint */

  if (b1 && b2 && dAreConnected (b1, b2))
    return;

  contact.surface.mode = 0;
  contact.surface.mu   = 0.1;
  contact.surface.mu2  = 0.0;
  if (dCollide (o1, o2, 0, &contact.geom, sizeof (dContactGeom)))
  {
    c = dJointCreateContact (world, contactgroup, &contact);
    dJointAttach (c, b1, b2);
  }

This was copied straight out of one of the test programs.  (After, of
course running it through indent to de-obfuscate it.).

There aren't any joints or other bodies in the code, since it's my
version of a "Hello, World", the simplest case of one body just sitting
there that I intend to keep adding to until I get my working model.,

Thanks,
James



More information about the ODE mailing list