- const sgVec4 *t = _location->getTransformMatrix();
- SGMatrixd rotation;
- for (unsigned i = 0; i < 4; ++i)
- for (unsigned j = 0; j < 4; ++j)
- rotation(i, j) = t[j][i];
- SGVec3d pos(_location->get_absolute_view_pos());
- _transform->setTransform(pos, rotation);
+ // The orientation, composed from the horizontal local orientation and the
+ // orientation wrt the horizontal local frame
+ SGQuatd orient = SGQuatd::fromLonLat(_position);
+ orient *= SGQuatd::fromYawPitchRollDeg(_heading_deg, _pitch_deg, _roll_deg);
+ // Convert to the scenegraph orientation where we just rotate around
+ // the y axis 180 degrees.
+ orient *= SGQuatd::fromRealImag(0, SGVec3d(0, 1, 0));
+
+ _transform->setAttitude(toOsg(orient));