// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <simgear/compiler.h>
#include <iostream>
#include <simgear/debug/logstream.hxx>
+#include <simgear/scene/model/placement.hxx>
+#include <simgear/scene/model/placementtrans.hxx>
+
+#include <Scenery/scenery.hxx>
#include "multiplay.hxx"
if (get_direction() == SG_IO_IN) {
- globals->get_multiplayer_rx_mgr()->ProcessData();
+ globals->get_multiplayer_mgr()->ProcessData();
} else if (get_direction() == SG_IO_OUT) {
- globals->get_multiplayer_tx_mgr()->
- SendMyPosition(globals->get_aircraft_model()->get3DModel()->get_POS());
+ sgMat4 posTrans;
+ globals->get_aircraft_model()->get3DModel()->getTransform()->getTransform(posTrans);
+ Point3D center = globals->get_scenery()->get_center();
+ sgdVec3 PlayerPosition;
+ sgdSetVec3(PlayerPosition, posTrans[3][0] + center[0],
+ posTrans[3][1] + center[1], posTrans[3][2] + center[2]);
+ sgQuat PlayerOrientation;
+ sgMatrixToQuat(PlayerOrientation, posTrans);
+
+ globals->get_multiplayer_mgr()->SendMyPosition(PlayerOrientation, PlayerPosition);
}
if (get_direction() == SG_IO_IN) {
- globals->get_multiplayer_rx_mgr()->Close();
+ globals->get_multiplayer_mgr()->Close();
} else if (get_direction() == SG_IO_OUT) {
- globals->get_multiplayer_tx_mgr()->Close();
+// globals->get_multiplayer_mgr()->Close();
}