API Question ALT parameter in scenario file for landed vessels

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
104
Points
78
Hi all,

I think this question could be only for Martin, but if anyone can help of course is much appreciated.

I'm trying to crete and manage landed vessels and vehicles.

In the past in order to properly handle this I used a very bad trick, that worked, which consisted in basically parsing a false scenario file, and let orbiter compute properly landed situtation for the vessel, calling clbkloadstateex and defsetstateex.

Now I want to get out of this, and I'm building the proper rotation matrixes for the vessels, plug the values into the arot part of the Vesselstatus2, and everything runs smoothly.

Except for one point: distance from the ground, which in scenario file is represented by the "ALT" line

When I update the status of a landed vessel without specifying the alt status anyhow I get the vessel's center of mass at ground level.


But it seems that I can't set the alt parameter in a vesselstatus2, since landed vessels will get just the Arot vector, and then latitude, longitude and heading.

I tried to modify the rpos parameter but nothing happened, seems like it is ignored.

Then I tried to give to orbiter this:

Code:
char line[52];
sprintf(line, "ALT 10");
ParseScenarioLineEx(line, &vs2);
DefSetStateEx(&vs2);

and to my surprise it worked! So it seems there is something behind the ALT line that is considered within the defsetstate that I cannot access. Is that right? is this the only way to do it?

Thanks in advance

Fred

---------- Post added 2nd Jun 2017 at 19:22 ---------- Previous post was 1st Jun 2017 at 23:33 ----------

:hailprobe:
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Em, yes, I am using a dirty trick to incorporate Alt without having to implement a new version of the VESSELSTATUSx structure:

For landed vessels, Alt is encoded as vrot.x in the VESSELSTATUS2 structure (since vrot is not used for landed vessels).

VROT shouldn't be used in the scenario file for a landed vessel. If VROT is defined, its x value will be interpreted as altitude. If VROT and ALT are both used, the ALT value will overwrite the VROT.x value.

It's not documented, probably because I was ashamed to admit having resorted to such a crude hack :embarrassed:
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
104
Points
78
thank you very much for replying on this! now it's all clear! Sorry for pointing that out :cheers:
 
Top