Export "rollspeed-ms" and "caster-angle-deg" properties for gear
objects. Josh Babcock wanted these for the B-29 model so he can properly animate the gear.
This commit is contained in:
parent
d28e99d913
commit
7eb194b3f8
3 changed files with 17 additions and 4 deletions
|
@ -230,10 +230,6 @@ void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
|
||||||
_wow = (fmag - damp) * -Math::dot3(cmpr, ground);
|
_wow = (fmag - damp) * -Math::dot3(cmpr, ground);
|
||||||
Math::mul3(-_wow, ground, _force);
|
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
|
// Wheels are funky. Split the velocity along the ground plane
|
||||||
// into rolling and skidding components. Assuming small angles,
|
// into rolling and skidding components. Assuming small angles,
|
||||||
// we generate "forward" and "left" unit vectors (the compression
|
// we generate "forward" and "left" unit vectors (the compression
|
||||||
|
@ -272,6 +268,15 @@ void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
|
||||||
float vskid = Math::dot3(cv, skid);
|
float vskid = Math::dot3(cv, skid);
|
||||||
float wgt = Math::dot3(_force, gup); // force into the ground
|
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 fsteer = _brake * calcFriction(wgt, vsteer);
|
||||||
float fskid = calcFriction(wgt, vskid);
|
float fskid = calcFriction(wgt, vskid);
|
||||||
if(vsteer > 0) fsteer = -fsteer;
|
if(vsteer > 0) fsteer = -fsteer;
|
||||||
|
|
|
@ -52,6 +52,8 @@ public:
|
||||||
float getRotation();
|
float getRotation();
|
||||||
float getExtension();
|
float getExtension();
|
||||||
bool getCastering();
|
bool getCastering();
|
||||||
|
float getCasterAngle() { return _casterAngle; }
|
||||||
|
float getRollSpeed() { return _rollSpeed; }
|
||||||
|
|
||||||
// Takes a velocity of the aircraft relative to ground, a rotation
|
// Takes a velocity of the aircraft relative to ground, a rotation
|
||||||
// vector, and a ground plane (all specified in local coordinates)
|
// vector, and a ground plane (all specified in local coordinates)
|
||||||
|
@ -84,6 +86,8 @@ private:
|
||||||
float _frac;
|
float _frac;
|
||||||
double _global_ground[4];
|
double _global_ground[4];
|
||||||
float _global_vel[3];
|
float _global_vel[3];
|
||||||
|
float _casterAngle;
|
||||||
|
float _rollSpeed;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace yasim
|
}; // namespace yasim
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include "YASim.hxx"
|
#include "YASim.hxx"
|
||||||
|
|
||||||
|
#include <fenv.h> // SIGFPE DEBUG
|
||||||
|
|
||||||
using namespace yasim;
|
using namespace yasim;
|
||||||
|
|
||||||
static const float YASIM_PI = 3.14159265358979323846;
|
static const float YASIM_PI = 3.14159265358979323846;
|
||||||
|
@ -459,6 +461,8 @@ void YASim::copyFromYASim()
|
||||||
node->setBoolValue("has-brake", g->getBrake() != 0);
|
node->setBoolValue("has-brake", g->getBrake() != 0);
|
||||||
node->setBoolValue("wow", g->getCompressFraction() != 0);
|
node->setBoolValue("wow", g->getCompressFraction() != 0);
|
||||||
node->setFloatValue("compression-norm", g->getCompressFraction());
|
node->setFloatValue("compression-norm", g->getCompressFraction());
|
||||||
|
node->setFloatValue("caster-angle-deg", g->getCasterAngle() * RAD2DEG);
|
||||||
|
node->setFloatValue("rollspeed-ms", g->getRollSpeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
Hook* h = airplane->getHook();
|
Hook* h = airplane->getHook();
|
||||||
|
|
Loading…
Reference in a new issue