• 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.

Using Slew Mode

Messages
34
Country
canada
Hello,

So I've been playing around with sending updates to a NonATCAircraft that I've created from a SimConnect client.

Between updates, the plane wobbles a bit, and drifts here and there. I had an idea to give it a way point a bit ahead of where it's going based on the heading, pitch, bank and speed, so I started looking around the forums here to see if anyone had asked anything similar.

Now, I think I found some stuff about that, but I also came across people talking about using slew mode and sending updates regularly.

This may sound like something I would want to use, but after looking through the SDK documentation, all I've seen about slew mode is a few events for setting or increasing/decreasing some variables.. I'm really quite unsure how to use any of them.

Are there any code examples of someone using slew mode, or can anyone give me some tips on what I'd need to do to be able to control an external (ie: not the plane I'm currently flying.. not external to FSX) plane that's in slew mode?

Thanks,
David
 
Hi David,

Some time ago, I made a small "toy" application that replicated the user aircraft at fixed offsets, so as to simulate a formation flight. Nothing serious, it was just some experiments with simconnect. I encountered the same problem as you : when updating regularly the position of AI aircraft, they were wobbling and shaking, and sometimes just teleported 10 meters away. Unfortunately I haven't solved this problem yet.

Using slew mode can be an opportunity. The programming is slightly different because slew is only used with events, not variables. You first have to register every slew events :
- the on/off switch SLEW_ON and SLEW_OFF
- the 3 axis AXIS_SLEW_AHEAD_SET, AXIS_SLEW_SIDEWAYS_SET and AXIS_SLEW_ALT_SET
- the 3 rotation axis AXIS_SLEW_HEADING_SET, *PITCH* *BANK*
ie
SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_ID_SLEW_ON, "SLEW_ON")
etc

Then instead of updating variables, you "fire" each event, with TransmitClientEvent()
and setting dwData parameter equal the value of the speed of in the given axis. Note that you're controlling speed and not position. If you have some physics engine controlling the AI object, speed is the derivative of the position (but generally movement is calculated from acceleration formulaes and then integrating two times to get velocity and position)

However there's still someting I'm missing about the value you give as event data. The relation between the slew value in one axis and the speed in the same axis is not documented, and I don't know if we can establish a reliable conversion. For small values, it's linear, although you'd have to calculate the proportionnal factor experimentally.

Another problem could come from performance. Instead of setting all position variables in one packet, you send 6 events, which are probably handled separately by FS.
And more troubles : aircrafts in slew are not producing sound. Animations are frozen (eg props)

Good luck !:)
 
Thanks LC,

That doesn't sound so great, though... sending all those events separately will really add up if there are several other planes/vehicles to worry about, and that they won't be animated isn't that appealing either.

My other thought would be to use all the current information and calculate a waypoint lat/lon and give that to the plane... that way FS can handle the details while I'm waiting for a new update to come in, and hopefully keep the plane steady on that course.

If the date makes it deviate a little, then there will be a jump in position, but hopefully it won't be too severe if the updates happen frequently enough.. right? :P

David
 
Back
Top