[RESOLVED] problem with AI DESIRED SPEED simulation variable

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
yufsa
Posts: 3
Joined: Sat Sep 14, 2019 12:25 pm

[RESOLVED] problem with AI DESIRED SPEED simulation variable

Post 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
yufsa
Posts: 3
Joined: Sat Sep 14, 2019 12:25 pm

Re: problem with AI DESIRED SPEED simulation variable

Post 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
Locked