Height of terrain returned invalid

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Dear P3D folks,



What is the correct way to obtain the height of terrain via SimConnect? I am currently using



Code:
hr = SimConnect_AddToDataDefinition( simConnectHandle,
DEFINITION_3,
"GROUND ALTITUDE",
"feet",
SIMCONNECT_DATATYPE_FLOAT64 );



combined with a timed approach. This can't be it, as after repositioning, I am running into issues: I get a Sim Stop and a Sim Start event - but the height returned is invalid.



What is the correct method to get back correct height of terrain values after repositioning over large distances?



Regards,



DevSim
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Post by Beau Hollis »

Is the screen blacking out and reloading the terrain upon reposition? It should be, as moving large distances puts you out where there could be no terrain or a very low LOD terrain with invalid heights.

Thanks,

Beau
Beau Hollis
Prepar3D Software Architect
DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Hi Beau,



Yes, it is reloading and flickering heavy, building up the scenery on a level by level.



Regards,

DevSim



User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Post by Beau Hollis »

Interesting. I was thinking it would bring up the loading bar and black out the screen. (which is what happens when you use the map to move the aircraft more than a certain threshold away from it's current location). I thought setting the aircraft location via simconnect had the same effect.



You might also try using SimConnect_RequestDataOnSimObject call with PLANE_ALT_AG to get ownship height above terrain. I came across some info from a user in an old ticket when searching to see if this was a known bug. Note that if you have set SIM_DISABLED, the height above terrain will not be valid outside the starting area.



Beau
Beau Hollis
Prepar3D Software Architect
DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Post by DevSim »

Thanks Beau,



I must say I run with the externalsim registered method and in full freeze mode.



I can and will try PLANE_ALT_GT but feel strongly, that the height will be invalid too. A quick workaround is to sit and wait some more time after a reposition - but loading time is non deterministic and it fore sure isn't valid after I receive the new sim start event (which I have tested).



Regards,

DevSim
Locked