From 6a614dba498c762a4c7a5801391c9ba6c4a8592a Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Nov 2005 17:35:42 +0000 Subject: [PATCH] Josh wanted a compression-m value exported for gear, so he can animate them more accurately. --- src/FDM/YASim/Gear.cpp | 2 ++ src/FDM/YASim/Gear.hpp | 2 ++ src/FDM/YASim/YASim.cxx | 1 + 3 files changed, 5 insertions(+) diff --git a/src/FDM/YASim/Gear.cpp b/src/FDM/YASim/Gear.cpp index 7950c2ef2..1936c3594 100644 --- a/src/FDM/YASim/Gear.cpp +++ b/src/FDM/YASim/Gear.cpp @@ -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. // If it's not, there's no force. float a = ground[3] - Math::dot3(_pos, ground); + _compressDist = -a; if(a > 0) { _wow = 0; _frac = 0; + _compressDist = 0; _rollSpeed = 0; _casterAngle = 0; return; diff --git a/src/FDM/YASim/Gear.hpp b/src/FDM/YASim/Gear.hpp index 6b0301fe1..435ca4973 100644 --- a/src/FDM/YASim/Gear.hpp +++ b/src/FDM/YASim/Gear.hpp @@ -66,6 +66,7 @@ public: void getForce(float* force, float* contact); float getWoW(); float getCompressFraction(); + float getCompressDist() { return _compressDist; } private: float calcFriction(float wgt, float v); @@ -84,6 +85,7 @@ private: float _contact[3]; float _wow; float _frac; + float _compressDist; double _global_ground[4]; float _global_vel[3]; float _casterAngle; diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index febabc481..c9f51e9c7 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -461,6 +461,7 @@ void YASim::copyFromYASim() node->setBoolValue("has-brake", g->getBrake() != 0); node->setBoolValue("wow", g->getCompressFraction() != 0); node->setFloatValue("compression-norm", g->getCompressFraction()); + node->setFloatValue("compression-m", g->getCompressDist()); node->setFloatValue("caster-angle-deg", g->getCasterAngle() * RAD2DEG); node->setFloatValue("rollspeed-ms", g->getRollSpeed()); }