Page 1 of 1

[RESOLVED] problem with AI DESIRED SPEED simulation variable

Posted: Sat Sep 14, 2019 12:41 pm
by yufsa
I have p3d 4.5 and developing small C# application ,the problem is with AI DESIRED SPEED simulation variable sometimes it works ,sometimes it doesn't .
the code i have written is:

//define flight speed variables struct
simconnect.AddToDataDefinition(DEFINITIONS.SpeedStruct, "AI DESIRED SPEED", "Knots", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_CLIENTDATATYPE_FLOAT64);

//set data on desired speed variable
simconnect.SetDataOnSimObject(DEFINITIONS.SpeedStruct, PlaneId, 0, desired_speed);

simconnect.ClearDataDefinition(DEFINITIONS.SpeedStruct);


I have noticed that it doesnt work after using command which include AI WAYPOINT LIST as a simulation variable e.g.

SIMCONNECT_DATA_WAYPOINT[] wp = new SIMCONNECT_DATA_WAYPOINT[2];
simconnect.AddToDataDefinition(DEFINITIONS.Waypoints, "AI WAYPOINT LIST", "number", SIMCONNECT_DATATYPE.WAYPOINT, 0.0f, SimConnect.SIMCONNECT_UNUSED);

does anyone have an insight or am I missing something?
thx and regards

Re: problem with AI DESIRED SPEED simulation variable

Posted: Thu Oct 03, 2019 6:59 am
by yufsa
I found the problem after several trials , changing desired speed using AI DESIRED SPEED sim variable doesn't work while a command that uses AI WAYPOINT LIST is being executed, it works only after the last waypoint in the list is reached,
unlike changing desired heading using AI DESIRED HEADING which suppresses waypoints command that an AI controlled object should follow and work immediately.

thx and regards
yufsa