Josh wanted a compression-m value exported for gear, so he can animate
them more accurately.
This commit is contained in:
parent
a56e35ef74
commit
6a614dba49
3 changed files with 5 additions and 0 deletions
|
@ -180,9 +180,11 @@ void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
|
||||||
// First off, make sure that the gear "tip" is below the ground.
|
// First off, make sure that the gear "tip" is below the ground.
|
||||||
// If it's not, there's no force.
|
// If it's not, there's no force.
|
||||||
float a = ground[3] - Math::dot3(_pos, ground);
|
float a = ground[3] - Math::dot3(_pos, ground);
|
||||||
|
_compressDist = -a;
|
||||||
if(a > 0) {
|
if(a > 0) {
|
||||||
_wow = 0;
|
_wow = 0;
|
||||||
_frac = 0;
|
_frac = 0;
|
||||||
|
_compressDist = 0;
|
||||||
_rollSpeed = 0;
|
_rollSpeed = 0;
|
||||||
_casterAngle = 0;
|
_casterAngle = 0;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -66,6 +66,7 @@ public:
|
||||||
void getForce(float* force, float* contact);
|
void getForce(float* force, float* contact);
|
||||||
float getWoW();
|
float getWoW();
|
||||||
float getCompressFraction();
|
float getCompressFraction();
|
||||||
|
float getCompressDist() { return _compressDist; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float calcFriction(float wgt, float v);
|
float calcFriction(float wgt, float v);
|
||||||
|
@ -84,6 +85,7 @@ private:
|
||||||
float _contact[3];
|
float _contact[3];
|
||||||
float _wow;
|
float _wow;
|
||||||
float _frac;
|
float _frac;
|
||||||
|
float _compressDist;
|
||||||
double _global_ground[4];
|
double _global_ground[4];
|
||||||
float _global_vel[3];
|
float _global_vel[3];
|
||||||
float _casterAngle;
|
float _casterAngle;
|
||||||
|
|
|
@ -461,6 +461,7 @@ 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("compression-m", g->getCompressDist());
|
||||||
node->setFloatValue("caster-angle-deg", g->getCasterAngle() * RAD2DEG);
|
node->setFloatValue("caster-angle-deg", g->getCasterAngle() * RAD2DEG);
|
||||||
node->setFloatValue("rollspeed-ms", g->getRollSpeed());
|
node->setFloatValue("rollspeed-ms", g->getRollSpeed());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue