vsTASKER 7 User Manual
×
Menu
Index

Rotator

 
A Rotator is a textured bitmap that can rotate around a center, over a textured background that remains fixed.
It is typically used to represent dials (the needed being the rotating element)
 
 
On the HMI grid, add a Rotator:
or
 
 
Give it a name, then open the property window.
 
Set the minimum and maximum angles (using the property window or by rotating the blue and green point of the Rotator graphic)
Set then the corresponding values for these minimum (0) and maximum (200). All values in between will output an angle between minimum and maximum.
 
Let's give to the rotator the air_needle.tga located in /Data/Hmi/Airspace
Select Properties, then Textures and load the file.
 
Select Background, then Textures and load the file air_panel.tga, then recenter the background or the needle to put the rotating center of the needle on the air_panel hole.
Also set the maximum angle to 342 degrees for a value of 200 (mph)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Now, time to connect the rotator to an entity speed.
 
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:
float spd = entity->getDyn()->getSpeed();
set(convMsToKnot(spd));
 
Back in the Terrain scenario, add one entity, name it "ac", compile run.
During the runtime, set the entity speed to "140" knots (using the hook window) and see the needle indicating the current entity speed.
 
 
To move a Rotator, select it then use the Ctrl key while pressing down the mouse button and drag.
If the rotation center mark is on top of the center hook, the selection of the hook will not be possible.