TCAS aircraft

Hi,

Does anyone have code to read the location of other aircraft within the sim? The SDK covers creating AI aircraft, but I’d like to read AI aircraft data, and any other player aircraft within the vicinity of the user’s aircraft. Unless I’m missing something, I can’t find this in the SDK documentation.

I’m only after lon, lat, speed & alt.

Thanks!
Andrew

You can:

  1. get locations of all nearby aircraft in given radius with RequestDataOnSimObjectType
  2. subscribe to specific aircraft ID location data with RequestDataOnSimObject, you will get it every frame/second/minute on choice

However, these methods does not work with other players aircraft (only if it was fixed lately and I am not aware).

1 Like

@ThrilledBloom32

As a complement to @thealx’s answer, there is a call from the Coherent engine used in the HTML instruments, which is the event GET_AIR_TRAFFIC in the Coherent listener. You can check out the CommBusSample from the SDK for futher information about it. Also, if you plan on rendering the traffic into a WASM gauge instead of a HTML one, it’s worth reviewing that example, because you need to make a bridge of that data.

You can also use the SimConnect calls @thealx gave you before ( SimConnect_RequestDataOnSimObjectType and SimConnect_RequestDataOnSimObject ), but as previously said, this doesn’t work with aircraft from other MSFS players, if you need to render that as well.

Regards,
Carlos Gonzalez
NextGen Simulations

Thank you!! Got it working.

1 Like