1
0
Fork 0

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'.
This commit is contained in:
Julian Smith 2022-03-21 13:57:38 +00:00
parent 5fb8c39057
commit da946fb14c

View file

@ -1041,8 +1041,18 @@ void FGFDM::parseGear(const XMLAttributes* a)
float v[3]; float v[3];
Gear* g = new Gear(); Gear* g = new Gear();
_currObj = g; _currObj = g;
/* 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); attrf_xyz(a, v);
}
g->setPosition(v); g->setPosition(v);
float nrm = Math::mag3(v); float nrm = Math::mag3(v);
if (_vehicle_radius < nrm) if (_vehicle_radius < nrm)
_vehicle_radius = nrm; _vehicle_radius = nrm;