[ODE] Trouble balancing "hover" rays over very short distances
Jon Watte
hplus-ode at mindcontrol.org
Fri Feb 4 12:00:28 MST 2005
// Grab out the data for the sensor
vector3 sensorPos, pushDir;
sensorList->Get(sensorPos, pushDir);
Is pushDir normalized at this point?
// Grab the relevant portion of the current velocity
vector3 curVelocity = nOpende::BodyGetLinearVel(this->tempBodyID);
vector3 velDir = curVelocity;
velDir.norm();
float relevantVel = curVelocity.len() * (velDir.dot(pushDir));
If not, then the dot won't give you a normalized result.
Also, because velDir is not normalized, you don't need to
multiply by velocity length again -- that will give you a
vector of magnitude squared.
Any suggestions are welcome. The best idea I've got at the moment is
to decide that repulsors at that distance are pretty useless anyways
(they don't provide enough distance between the ground and character
to allow significantly more mobility than if the character's geom were
just dragging on the ground), and just not use them at distances below
0.5.
You clearly want to limit the amount of force you can apply
in a single step. For me, 0.5 units is about a foot and a half,
though, so that would be a pretty normal distance -- it would
help if you told us what your units are! (inches?)
I would formulate the repulsor spring using the same predictive
feedback control system that I recommend for most things :-)
Figure out where you want to be; where you are; where you're
going, and apply a force that makes you be where you want to be
some time in the future (like, at least 3-4 steps in the future).
After all, character leg strength is not such that they can jump
from kneeling to standing in one time step, unless your time step
is really large.
You can do most of what you want with pure scalars, too. Something
like this:
d = distanceAboveGround();
g = desiredDistanceAboveGround();
v = currentVelocity() dot up();
t = d + v * PREDICTION_TIME;
f = (g - t) / PREDICTION_TIME * bodyMass();
clampMagnitude( f, 0, MAX_LEG_STRENGTH );
addScaledForce( f, up() );
Cheers,
/ h+
More information about the ODE
mailing list