@@ -23,6 +23,13 @@ int main()
|
|||||||
// Open Socket
|
// Open Socket
|
||||||
const char* IP = "127.0.0.1"; //IP Address of computer running X-Plane
|
const char* IP = "127.0.0.1"; //IP Address of computer running X-Plane
|
||||||
XPCSocket sock = openUDP(IP);
|
XPCSocket sock = openUDP(IP);
|
||||||
|
float tVal[1];
|
||||||
|
int tSize;
|
||||||
|
if (getDREF(sock, "sim/test/test_float", tVal, &tSize) < 0)
|
||||||
|
{
|
||||||
|
printf("Error establishing connecting. Unable to read data from X-Plane.");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Location/Orientation (sendPOSI)
|
// Set Location/Orientation (sendPOSI)
|
||||||
// Set Up Position Array
|
// Set Up Position Array
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class Main
|
|||||||
System.out.println("Setting up simulation...");
|
System.out.println("Setting up simulation...");
|
||||||
try(XPlaneConnect xpc = new XPlaneConnect())
|
try(XPlaneConnect xpc = new XPlaneConnect())
|
||||||
{
|
{
|
||||||
System.out.println("Setting inbound port");
|
// Ensure connection established.
|
||||||
xpc.setCONN(49055);
|
xpc.getDREF("sim/test/test_float");
|
||||||
|
|
||||||
System.out.println("Setting player aircraft position");
|
System.out.println("Setting player aircraft position");
|
||||||
float[] posi = new float[] {37.524F, -122.06899F, 2500, 0, 0, 0, 1};
|
float[] posi = new float[] {37.524F, -122.06899F, 2500, 0, 0, 0, 1};
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ import XPlaneConnect.*
|
|||||||
disp('xplaneconnect Example Script-');
|
disp('xplaneconnect Example Script-');
|
||||||
disp('Setting up Simulation');
|
disp('Setting up Simulation');
|
||||||
Socket = openUDP(49005);
|
Socket = openUDP(49005);
|
||||||
|
|
||||||
|
%% Ensure connected
|
||||||
|
getDREFs('sim/test/test_float')
|
||||||
|
|
||||||
%% Set position of the player aircraft
|
%% Set position of the player aircraft
|
||||||
disp('Setting position');
|
disp('Setting position');
|
||||||
pauseSim(1);
|
pauseSim(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user