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

[FS2020]Detect if the terrain is fully loaded with SimConnect

Messages
11
Country
belgium
Hello,

I'm currently teleporting the player plane from any location to a specific one with a c# winform.
I bring the plane under the terrain to the new coordinate and I have to wait for the terrain to load then I can click in a form to make a new call to set the plane at ground level.
It works but it's not cool to have to click when I judge the terrain is loaded. I have 2 goals for this:
1 - Make a call to know when the terrain is fully loaded
2- (not mandatory but it would be awesome if possible) Show some kind of loading screen to hide the plane being under the terrain and the terrain slowly loading.
Thanks for your help!
 
Messages
2,077
Country
us-ohio
Uh.... since the sim doesn't provide any visual feedback regarding when the terrain has been loaded... I'd assume there's nothing you're going to find that supports letting you know when that has happened. Even the little blue line along the bottom of the screen doesn't indicate when the terrain has loaded in completely.
 
Messages
11
Country
belgium
Hello WarpD,
When the blue bar is complete, and the plane spawns in the world at least the ground exist, even if everything is not loaded and beautiful, the plane won't fall in the emptyness. That's all I want to know, "When does the ground exist and is ready to support the plane?" You think there could be a variable that would give me that bool?
Thanks!
 
Messages
11
Country
belgium
lol :D
Alright then, I guess I'll keep clicking on that button ;)
Thanks for your input! It will save me a lot of time knowing I 'm dreaming ;)
 
Messages
7,450
Country
us-illinois
Hello:

While it is possible SimConnect may access all the same FS variables and functions as FSUIPC, I believe if you study "FSUIPC offset" documentation, you will find that all versions of FS including MSFS-2020 have a variable for 'Ground' Altitude (aka 'terrain' surface elevation in Meters AMSL).

Although prior versions of FSUIPC for FSX initially had to communicate with FS via SimConnect, IIRC, now FSUIPC may communicate directly with FS without SimConnect.



One can tell FS to position the aircraft "On Ground" (0 Meters AGL), and although the aircraft 3D model datum at Cartesian coordinates 0,0,0 may initially spawn there, the contact points will define whether / how the gear align with a local terrain surface, and thereby move the aircraft datum and contiguous 3D model up to its intended position AGL.


03662Aircraft on ground flag (0=airborne, 1=on ground). Not updated in Slew mode.



03662Aircraft on ground flag (0=airborne, 1=on ground). Not updated in Slew mode.


So, if you simply want to spawn an aircraft "On Ground" at specified Geographic coordinates, AFAIK, a FSUIPC client will allow one to do that.


DISCLAIMER: I would not 'claim' to be a programmer with any extensive knowledge of FSUIPC or other coding tricks / traps at this time; but I believe by querying FSUIPC, one might also be able to determine when Terrain is fully resolved, before sending another command in one's custom script or application, thus this may merit more inquiry.


A question such as this might also be asked at Pete and John Dowson's FSUIPC support forum for a much more informed and/or authoritative answer: :teacher:



I hope this reply helps with your endeavors. :)

GaryGB
 
Last edited:
Messages
11
Country
belgium
Hey Thank you Gary,

The only thing is that I already have access to a variable "Ground altitude" with simconnect
GROUND ALTITUDEMetersNResponded
I tried to use it already but it doesn't update really. I load the plane on an airport, then I teleport it in the middle in nowhere at 0 ft/meters MSL.
Then when I look at my debug call every now and then, it never changes to -250 (if i m 250 ft under the new terrain). So it's like it doesn't refresh unless I teleport it back up when the terrain is (visually) loaded.
Do you have any reason to believe that it would be different using FSUIPC?
Thanks for looking into my issue anyway!
 
Messages
2,077
Country
us-ohio
FSUIPC can only get the data the sim provides. If it can determine when the terrain has finished loading and thus then knows the ground elevation at a given lat/lon... that would be something new.
 
Messages
7,450
Country
us-illinois
Hey Thank you Gary,

The only thing is that I already have access to a variable "Ground altitude" with simconnect
GROUND ALTITUDEMetersNResponded
I tried to use it already but it doesn't update really. I load the plane on an airport, then I teleport it in the middle in nowhere at 0 ft/meters MSL.
Then when I look at my debug call every now and then, it never changes to -250 (if i m 250 ft under the new terrain). So it's like it doesn't refresh unless I teleport it back up when the terrain is (visually) loaded.
Do you have any reason to believe that it would be different using FSUIPC?
Thanks for looking into my issue anyway!

Do you actually need / want for the aircraft to initially spawn -250 Meters underground rather than AGL ?

Why not just use the "On Ground" feature set already available, and after teleporting, allow a FS run time scene to resolve before proceeding with another action in ones code ? :scratchch

GaryGB
 
Last edited:
Messages
11
Country
belgium
I don't really want it no, but the On ground features doesn't work since there is no ground loaded at that location, so the plane juste fall from the sky.
What do you mean by allow a FS run time scene to resolve? how could I trigger/receive that? I'm really new to sim connect.
Thanks again
 
Messages
7,450
Country
us-illinois
Hi again:

The FSUIPC version 7.x "write" function is intact for MSFS-2020, so when coded properly, one can send the aircraft from one location to another, and assign it to spawn "On Ground", probably with a sequence of 2 commands.

AFAIK, this likely works with SimConnect also.

You can test this for yourself in SBuilderX:



First run FSUIPC version 7.x as Administrator, then run SBuilderX as Administrator, then from a existing start location either on ground or in flight:

SBuilderX Menu > View > Show Aircraft

Next:

SBuilderX Menu > View > Go To Position ... (enter Geographic coordinates of a destination ex: at least 50 Miles away)

Next:

SBuilderX Menu > View > Fly Aircraft To (click OK to accept that previously assigned Position)

Observe the resulting successful aircraft teleport to the assigned location. :wizard:

BTW: Again, I am not a programmer, but IIRC, if one goofs coding a FSUIPC location 'write' command, one ends up at 0 - Lat / 0 - Lon in the Atlantic Ocean. :alert:


PS: You may wish to purchase and study this useful utility by a FS Developer forum participant here: :idea:


GaryGB
 
Last edited:
Messages
11
Country
belgium
Thank you Gary,
But I really don't wan't to use one more API/external software.
I actually found a more elegant solution, a dynamically generated save with the good position is loaded when the user entered the world. This doesn't require any input from the user and the "teleportation" loads everything correctly in the first place.
Thanks for your input, the doc and soft provided!
 
Messages
7,450
Country
us-illinois
While my info presented above was primarily intended to illustrate that there continues to be ways to perform Read / Write functions in MSFS-2020, and to encourage- rather than to discourage- your further inquiry into how those functions are already working with all recent versions of FS.

FSUIPC as a tool widely in use, was presented as a means to demonstrate that communication I/O with MSFS is alive and well via SBuilderX ...as just one of many FS utilities.

Certainly SimConnect is another way to perform Read / Write functions with MSFS-2020, although, I believe you may find it is under-documented and complex to use.

By either method, I believe you will find that where there is no specific variable / offset such as you seek, there is a way to 'calculate' a desired result via existing variables.;)

I am glad, however, that you have discerned a way to achieve a result you are satisfied with ...via your preferred method.


Good luck with your project. :)

GaryGB
 
Top