From da946fb14c3c378e95fc1c88945a08be4f1fa1e7 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Mon, 21 Mar 2022 13:57:38 +0000 Subject: [PATCH] src/FDM/YASim/FGFDM.cpp: allow backwards compatibility of gear contact points/surfaces. We now allow an aircraft to specify both simple gear contact points (which will be automatically used by old Flightgear builds), and also gear contact surfaces (which will be automatically used by new Flightgear builds). When parsing gear specifications, if specified we now use 'wheel-x', 'wheel-y' and 'wheel-z' in preference to 'x', 'y' and 'z' for the wheel centre point. These new 'wheel-*' values will be ignored by old Flightgear builds. So to work with both old and new Flightgear builds, an aircraft should specify old-style contact points with 'x', 'y' and 'z' as before, and new-style contact surfaces with 'wheel-x', 'wheel-y' and 'wheel-z', and 'wheel-radius' and 'tyre-radius'. --- src/FDM/YASim/FGFDM.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 97b94101e..78b28d469 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -1041,8 +1041,18 @@ void FGFDM::parseGear(const XMLAttributes* a) float v[3]; Gear* g = new Gear(); _currObj = g; - attrf_xyz(a, v); + + /* Override (x, y, z) with wheel-* if specified. */ + if (a->hasAttribute("wheel-x")) { + v[0] = attrf(a, "wheel-x"); + v[1] = attrf(a, "wheel-y"); + v[2] = attrf(a, "wheel-z"); + } + else { + attrf_xyz(a, v); + } g->setPosition(v); + float nrm = Math::mag3(v); if (_vehicle_radius < nrm) _vehicle_radius = nrm;