• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 Setting and clearing waypoint arrays

Messages
1,040
Country
ca-ontario
I have an ground vehicle object to which I set a waypoint drive plan (I won't call it a flight plan :) ), using the same method as in AIObjects sample. All works well. Now, I'd like to clear the drive plan, and stop the vehicle where it was along the drive plan when I cleared the waypoints. So, to add waypoints, I use:

Code:
vector<SIMCONNECT_DATA_WAYPOINT> Path;
...
SimConnect_SetDataOnSimObject(hSimConnect, DEFINITION_WAYPOINT, ObjectID, 0, (DWORD)(Path.size()), (DWORD)sizeof(Path[0]), Path.data());

(which works no problem)

and to clear the drive path, I use:

Code:
SimConnect_SetDataOnSimObject(hSimConnect, DEFINITION_WAYPOINT, ObjectID, 0, 0, 0, NULL);

... and this DOES NOT work. The vehicle keeps moving along the old convoy route. I would have expected (and I read somewhere on this forum) that the above line would clear the waypoint flight (drive) plan.

Does anyone know how to clear the waypoint plan? I was at least expecting the vehicle keep moving in the straight line after the waypoints are cleared, but no, it still follows them as if they were not cleared.

Any idea on how to do this?
 
Last edited:
Yes! Presumably you’re trying to edit an already spawned SimObject? Just delete it and spawn a new one in its place with the new waypoints.

I have that module that sets up an AI as wingman so I can look at that cpp when I get home and see if there’s anything relevant.
 
Yes! Presumably you’re trying to edit an already spawned SimObject? Just delete it and spawn a new one in its place with the new waypoints.

I have that module that sets up an AI as wingman so I can look at that cpp when I get home and see if there’s anything relevant.

Thanks, Rick! Indeed, sending all zero data does nothing... and spawning a new object, well, that would be the last resort.

After a few :banghead: sessions, I managed to figure out how to stop the vehicle without re-spawning it. Basically, insert a new single waypoint close to it, with speed and rpm set at zero (along with both flags for those params). The vehicle will try to reach that point at zero speed and rpm, which will effectively stop it. :)
 
👍 Nice, that is what I was looking for in the wingman code.
 
Back
Top