From 910bd2c0fd390239541f139d079e3a32bcd55b25 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 18 May 2019 16:20:31 +0100 Subject: [PATCH] Fix for sub-model initial offsets The offset in body coordinates is needed by the FGAIBallistic in some cases, restore this. --- src/AIModel/submodel.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index fbf0cb3a4..838d21648 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -394,6 +394,18 @@ void FGSubmodelMgr::transform(submodel *sm) userpos.setLongitudeDeg(IC.lon); userpos.setElevationFt(IC.alt); + if (sm->offsets_in_meter) { + _x_offset = -sm->x_offset->get_value() * SG_METER_TO_FEET; + _y_offset = sm->y_offset->get_value() * SG_METER_TO_FEET; + _z_offset = sm->z_offset->get_value() * SG_METER_TO_FEET; + } + else { + _x_offset = sm->x_offset->get_value(); + _y_offset = sm->y_offset->get_value(); + _z_offset = sm->z_offset->get_value(); + } + + // this updates the 'offsetpos' member of us setOffsetPos(sm); // Compute initial orientation using yaw and pitch offsets and parent's orientation