plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

In the upcoming flighting, we've changed the behaviour of the content.xml file. If your addon uses this file, please read this article!

Please take a moment to read the platform’s guidelines before you get started!


question

PeakMercury3697 avatar image
PeakMercury3697 asked virtuali edited

Ground altitude for AISimulatedObjects are wrong in SimConnect

Hi,


I was trying to find height of terrain (ground altitude) for different locations by creating different objects by SimConnect_AICreateSimulatedObject() function and setting positions of each object and then requesting GROUND ALTITUDE data from them. I confirmed that objects were set to correct positions by looking at their visuals. However, the GROUND ALTITUDE data I retrieve is the same for all objects, same as the aircraft itself.


This method was applicable in FSX but it seems it's broken in MSFS2020. Do you know any other way to retrieve height of terrain for different locations?


Thanks in advance!

simconnectc++
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

virtuali avatar image
virtuali answered virtuali edited

You can't read the ground altitude of a Static Object, its physic doesn't support it and, for the same reason, you can't read or set the PLANE ALT ABOVE GROUND variable.

The object you create must be at least a GroundVehicle. No need to create an Aircraft, which has an even more complex physics than a GroundVehicle.

Note that, this is valid whether you need to just "probe" the ground altitude for any reason, or if you want to actually place an object on a certain altitude above ground, without having to deal with absolute elevations.

In fact, it would be nice if we could have the "SimpleObject" class which was available in FSX, that lies between a Viewer ( now called "StaticObject" so, it's totally static ), but with a very simple physic not requiring the possible overhead of a GroundVehicle so, it could have a minimal support for reading the ground altitude and could be set "above ground".

Also, it would be nice it we could have a dedicated function to probe the ground altitude at a specific location, without having to create an object.


4 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

I like this suggestion, and I'd even suggest it would be nice not to have a "simpleobject", but a SimObject SDK instead so that you could create you own simobject with the necessary APIs to get the low level data you'd need for whatever the reason you need a custom simobject from the first place, which can be widely different from one 3rd party vendor to the other, and for which a one size fits all Asobo designed "SimpleObject" might just be too "simple" "object" only useful for "simple" "needs".

1 Like 1 ·

Thank you! I checked it and yes, if I define my AIObject as ground vehicle, I am able to retrieve the ground altitude for each object. I wonder if I can create a ground vehicle without any visual (or make it transparent); so that they won't be seen in simulation. Do you have any idea?

0 Likes 0 ·
virtuali avatar image virtuali PeakMercury3697 ·

Just create a gltf with made of a single triangle flipped (normals pointing down), as long as it stays on ground, it will be invisible. No need to assign any material to it, just vertex colors.

1 Like 1 ·

My probe objects are supposed to fly with the aircraft, since they will represent skid locations. Therefore, it may not be applicable for my case. Thank you for the help anyways!

Edit: I was able to do that by not specifying any gltf file, in case someone wonders.

0 Likes 0 ·
runshotgun avatar image
runshotgun answered PeakMercury3697 commented

We have also observed this issue.

Not only that, moving the object after its creation will not refresh its altitude to the ground at the new location.

We have to create a non-flyable aircraft and inject it to make it work. A simple object will not work.

3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Thank you for the tip! Can you describe that process a little bit? Is it like creating multiple wasm modules and make them send data to the main module? Or, is it handled by a single module? I could not get what you mean by non-flyable aircraft.
0 Likes 0 ·
runshotgun avatar image runshotgun PeakMercury3697 ·

The structure for a non-flyable aircraft looks like this: \MSFS\Official\OneStore\asobo-aircraft-generic-airliner-twinengines\SimObjects\Airplanes\Asobo_Generic_Airliner_TwinEngines

The structure for a "StaticObject" looks like this: \MSFS\Official\OneStore\asobo-simobjects-landmarks\SimObjects\Landmarks\Windsock

While they are treated the same in WASM/SimConnect, they behave differently in terms of physics in the sim.

1 Like 1 ·
Thank you so much!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.