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.
This commit is contained in:
parent
02814ebe35
commit
4f4a81d12b
1 changed files with 3 additions and 8 deletions
|
@ -712,9 +712,9 @@ void FGSubmodelMgr::loadSubmodels()
|
||||||
SGVec3d FGSubmodelMgr::getCartOffsetPos(submodel* sm) const
|
SGVec3d FGSubmodelMgr::getCartOffsetPos(submodel* sm) const
|
||||||
{
|
{
|
||||||
// Transform to the right coordinate frame, configuration is done in
|
// Transform to the right coordinate frame, configuration is done in
|
||||||
// the x-forward, y-right, z-up coordinates (feet), computation
|
// either x-backward, y-right, z-up coordinates (meter),
|
||||||
// in the simulation usual body x-forward, y-right, z-down coordinates
|
// or (deprecated) x-forward, y-right, z-up coordinates (feet).
|
||||||
// (meters) )
|
// computation in the simulation usual body x-forward, y-right, z-down coordinates (meters)
|
||||||
SGVec3d offset;
|
SGVec3d offset;
|
||||||
if (sm->offsets_in_meter) {
|
if (sm->offsets_in_meter) {
|
||||||
offset = SGVec3d(-sm->x_offset->get_value(),
|
offset = SGVec3d(-sm->x_offset->get_value(),
|
||||||
|
@ -736,11 +736,6 @@ SGVec3d FGSubmodelMgr::getCartOffsetPos(submodel* sm) const
|
||||||
IC.elevation,
|
IC.elevation,
|
||||||
IC.roll);
|
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
|
// The offset converted to the usual body fixed coordinate system
|
||||||
// rotated to the earth-fixed coordinates axis
|
// rotated to the earth-fixed coordinates axis
|
||||||
SGVec3d off = hlTrans.backTransform(offset);
|
SGVec3d off = hlTrans.backTransform(offset);
|
||||||
|
|
Loading…
Reference in a new issue