From bb9a8a1850ddca5e28db800577e9ad507440639e Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Thu, 16 Mar 2017 09:39:58 +0100 Subject: [PATCH] YASim backward compatibility fix for ground effect calculation (added if isVersionOrNewer). --- src/FDM/YASim/Airplane.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp index e5e4e1845..1b69c2ce7 100644 --- a/src/FDM/YASim/Airplane.cpp +++ b/src/FDM/YASim/Airplane.cpp @@ -657,6 +657,14 @@ void Airplane::compile() float gespan = 0; gespan = _wing->getSpan(); _wing->getBase(gepos); + if(!isVersionOrNewer( Version::YASIM_VERSION_2017_2 )) { + //old code + //float span = _length * Math::cos(_sweep) * Math::cos(_dihedral); + //span = 2*(span + Math::abs(_base[2])); + gespan -= 2*gepos[1]; // cut away base (y-distance) + gespan += 2*Math::abs(gepos[2]); // add (wrong) z-distance + } + baseN->getChild("wing", 0)->getNode("gnd-eff-span", true)->setFloatValue(gespan); // where does the hard coded factor 0.15 come from? _model.setGroundEffect(gepos, gespan, 0.15f); }