From 4f4a81d12b245a1a16470ac314f3c715e53c4b7f Mon Sep 17 00:00:00 2001 From: Colin Geniet Date: Sun, 17 Jan 2021 21:35:48 +0100 Subject: [PATCH] Submodels: Fix initial position offset Fixes https://sourceforge.net/p/flightgear/codetickets/2521/ For submodels with rotation offsets, the rotation was applied to the translation offset. This is incorrect: translation offsets should be in the aircraft local frame, and thus are not affected by submodel rotation offsets. --- src/AIModel/submodel.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index f591679cd..c0fbd528b 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -712,9 +712,9 @@ void FGSubmodelMgr::loadSubmodels() SGVec3d FGSubmodelMgr::getCartOffsetPos(submodel* sm) const { // Transform to the right coordinate frame, configuration is done in - // the x-forward, y-right, z-up coordinates (feet), computation - // in the simulation usual body x-forward, y-right, z-down coordinates - // (meters) ) + // either x-backward, y-right, z-up coordinates (meter), + // or (deprecated) x-forward, y-right, z-up coordinates (feet). + // computation in the simulation usual body x-forward, y-right, z-down coordinates (meters) SGVec3d offset; if (sm->offsets_in_meter) { offset = SGVec3d(-sm->x_offset->get_value(), @@ -736,11 +736,6 @@ SGVec3d FGSubmodelMgr::getCartOffsetPos(submodel* sm) const IC.elevation, IC.roll); - // postrotate by any pitch/heasing/roll offset - hlTrans *= SGQuatd::fromYawPitchRollDeg(sm->yaw_offset->get_value(), - sm->pitch_offset->get_value(), - 0.0); - // The offset converted to the usual body fixed coordinate system // rotated to the earth-fixed coordinates axis SGVec3d off = hlTrans.backTransform(offset);