[ODE] Jitters

Jon Watte hplus-ode at mindcontrol.org
Mon Nov 8 10:45:34 MST 2004


Ouch! The problem is that dBodyGetXxxx returns pointers 
into the actual data used by ODE. You're slamming the actual 
velocity values kept in the bodies when you do the *= !
Just stepping into this with the debugger would probably have 
shown you this, assuming you're building ODE from source 
(which you should be doing).

Instead, you can change your code to:

  dBodyAddForce( body, v[0]*-0.01, v[1]*-0.01, v[2]*-0.01 );

Same for torque.

Cheers,

			/ h+

-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Tim
Rightnour
Sent: Monday, November 08, 2004 10:06 AM
To: ODE
Subject: RE: [ODE] Jitters



On 08-Nov-2004 Jon Watte wrote:
>> > Basically the *= -0.01 on each of the
> 
>> shouldnt that be -= 0.01 ???
> You could also get current velocity/avelocity and apply a torque 
> or force that's that *= -0.01. I find this preferrable to slamming 
> the velocities directly.

There seems to be a bit of confusion here as to what I was doing, so I'll post
the code I used:

void apply_damping(dBodyID body) {
    dReal *v = dBodyGetLinearVel(body);
    dReal *x = dBodyGetAngularVel(body);

    v[0] *= -0.01f;
    v[1] *= -0.01f;
    v[2] *= -0.01f;
    dBodyAddForce(body, v[0], v[1], v[2]);
    x[0] *= -0.01f;
    x[1] *= -0.01f;
    x[2] *= -0.01f;
    dBodyAddTorque(body, x[0], x[1], x[2]);
}

I tried applying this to all bodies prior to calling dWorldStep for each cycle
of the loop.  I also tried applying it after dWorldStep instead, with the same
results.  Or was I supposed to do this in my nearCallBack?

---
Tim Rightnour <root at garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
NetBSD supported hardware database: http://mail-index.netbsd.org/cgi-bin/hw.cgi
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode




More information about the ODE mailing list