_wow = (fmag - damp) * -Math::dot3(cmpr, ground);
Math::mul3(-_wow, ground, _force);
- // Castering gear feel no force in the ground plane
- if(_castering)
- return;
-
// Wheels are funky. Split the velocity along the ground plane
// into rolling and skidding components. Assuming small angles,
// we generate "forward" and "left" unit vectors (the compression
float vskid = Math::dot3(cv, skid);
float wgt = Math::dot3(_force, gup); // force into the ground
+ if(_castering) {
+ _rollSpeed = Math::sqrt(vsteer*vsteer + vskid*vskid);
+ _casterAngle = Math::atan2(vskid, vsteer);
+ return;
+ } else {
+ _rollSpeed = vsteer;
+ _casterAngle = 0;
+ }
+
float fsteer = _brake * calcFriction(wgt, vsteer);
float fskid = calcFriction(wgt, vskid);
if(vsteer > 0) fsteer = -fsteer;
float getRotation();
float getExtension();
bool getCastering();
+ float getCasterAngle() { return _casterAngle; }
+ float getRollSpeed() { return _rollSpeed; }
// Takes a velocity of the aircraft relative to ground, a rotation
// vector, and a ground plane (all specified in local coordinates)
float _frac;
double _global_ground[4];
float _global_vel[3];
+ float _casterAngle;
+ float _rollSpeed;
};
}; // namespace yasim
#include "YASim.hxx"
+#include <fenv.h> // SIGFPE DEBUG
+
using namespace yasim;
static const float YASIM_PI = 3.14159265358979323846;
node->setBoolValue("has-brake", g->getBrake() != 0);
node->setBoolValue("wow", g->getCompressFraction() != 0);
node->setFloatValue("compression-norm", g->getCompressFraction());
+ node->setFloatValue("caster-angle-deg", g->getCasterAngle() * RAD2DEG);
+ node->setFloatValue("rollspeed-ms", g->getRollSpeed());
}
Hook* h = airplane->getHook();