[ODE] Having trouble modifying ODE to save facc/tacc - ?
Megan Fox
shalinor at circustent.us
Mon Aug 9 19:50:07 MST 2004
As per a suggestion from this list on how to get the forces that were
applied to a body in the previous frame, I modified quickstep.cpp
accordingly:
// zero all force accumulators
for (i=0; i<nb; i++) {
body[i]->old_facc[0] = body[i]->facc[0];
body[i]->old_facc[1] = body[i]->facc[1];
body[i]->old_facc[2] = body[i]->facc[2];
body[i]->old_tacc[0] = body[i]->tacc[0];
body[i]->old_tacc[1] = body[i]->tacc[1];
body[i]->old_tacc[2] = body[i]->tacc[2];
dSetZero (body[i]->facc,3);
dSetZero (body[i]->tacc,3);
}
I also modified both dInternalStepIsland in step.cpp:
// zero all force accumulators
for (i=0; i<nb; i++) {
body[i]->old_facc[0] = body[i]->facc[0];
body[i]->old_facc[1] = body[i]->facc[1];
body[i]->old_facc[2] = body[i]->facc[2];
body[i]->old_facc[3] = body[i]->facc[3];
body[i]->old_tacc[0] = body[i]->tacc[0];
body[i]->old_tacc[1] = body[i]->tacc[1];
body[i]->old_tacc[2] = body[i]->tacc[2];
body[i]->old_tacc[3] = body[i]->tacc[3];
body[i]->facc[0] = 0;
body[i]->facc[1] = 0;
body[i]->facc[2] = 0;
body[i]->facc[3] = 0;
body[i]->tacc[0] = 0;
body[i]->tacc[1] = 0;
body[i]->tacc[2] = 0;
body[i]->tacc[3] = 0;
}
And then I added a couple of grab methods for the two old values.
... except I'm still having the forces reported as 0. Is there somewhere
else forces are being zero'ed out I need to catch?
Or - perhaps this is the better question - is there some other way I should
be grabbing out the actual forces affecting a particular body?
I need the force vectors in the creature AI. A creature can apply a counter
force of up to X magnitude per frame, forces above that advancing a
"stumble" meter (which, apon reaching a certain value, indicates the entity
is stumbling under forces greater than it can deal with and that it is no
longer under its own control). Etc.
If I could just use the angular and linear velocities, that'd be great, but
I'm unclear how to convert a velocity to the equivalent force value (such
that I could add the negated force to the entity and observe a complete
halting of motion in a single time step).
-Megan Fox / "Shalinor"
Lead Developer, Elium Project (http://www.elium.tk)
More information about the ODE
mailing list