vsTASKER 7 User Manual
×
Menu
Index

Horizon

 
An Horizon is a combination of rotating and sliding a texture, behind a squared window.
The Horizon is mainly used to represent an Attitude Indicator (AI) normally present into any PFD (primary flight display) for aircraft.
 
 
On the HMI grid, add an Horizon:
or
 
 
Give it a name, then open the property window.
 
Make the Way Horizontal.
 
Then select Strip Definition, then Visual Aspect and Textures to import the following one: horizon.png in /Data/HMI/Aerospace
Uncheck AutoSize.
 
Resize the texture using the hook
 
On the HMI panel, drag the Pitch-Min and Pitch-Max green hooks so that to visually align them with the -80 and 80 values of the horizon vertical scale.
On the code, the vertical (pitch) value will be given using setPitch() function.
 
Rotate the magenta hooks to set the maximum angles of the texture.
On the code, the bank (roll) value will be given using setRoll() function.
 
Then use the blue hooks to resize the peek window of the Horizon (everything outside will be scissor).
 
Open again the Property window, select Strip Definition and set the bound values for the pitch:
 
On the Horizon window, make sure the visual rotating angles (Min, Max) correspond to their matching Values.
 
Now, let's add some code:
 
In Initialization panel, RESET, put:
 entity = S:findEntity("ac");
Vt_Entity* entity; is already defined in Vt_Base and Vt_Sprite inherit from Vt_Base, so, needless to redefine it locally.
 
In the Runtime panel, put the following code:
 setPitch(convRadToDeg(entity->getDyn()->getPitch()));
 setRoll(convRadToDeg(entity->getDyn()->getRoll()));
 
Back in the Terrain scenario, add one entity, name it "ac", compile run.
Give the entity a WingDyn dynamic. Set initial speed and altitude.
Now, change the heading of the aircraft from the hook window and see the Horizon in action on the HMI window.