HUD: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 14: Line 14:
   <font color="Blue">class MFD
   <font color="Blue">class MFD
   {
   {
     <font color="Sea grey">class MFD1 {...};
     <font color="DarkGrey">class MFD1 {...};
     class MFD2 {...};
     class MFD2 {...};
     ...
     ...
     </font><font color="Blue">
     </font><font color="Blue">
   };</font>
   };</font>
<font color="Seagrey">Optional.</font>
<font color="DarkGrey">Optional.</font>


<font color="Black">with class MFD1 of the following structure:</font>
<font color="Black">with class MFD1 of the following structure:</font>
   <font color="Blue">class MFD1
   <font color="Blue">class MFD1
   {
   {
     topLeft = "HUD LH"; //Those 3 points define the displayarea. These points need
     topLeft = "HUD LH"; //Those 3 points define the displayarea. These  
     topRight = "HUD PH"; //to be present in model of vehicle.
     topRight = "HUD PH"; //points need to be present in model of vehicle.
     bottomLeft = "HUD LD";
     bottomLeft = "HUD LD";
    
    
     borderLeft = 0.05; //Offsets used to finetune the actual displayarea. The values
     borderLeft = 0.05; //Offsets used to finetune the actual displayarea.
     borderRight = 0.05; //can vary from 0 - 1.
     borderRight = 0.05; //The values can vary from 0 - 1.
     borderTop = 0.02;
     borderTop = 0.02;
     borderBottom = 0.1;
     borderBottom = 0.1;
  
  
     color[]={0,1,0,0.1}; //obsolete, done over color values in class Draw, but at the moment still required.
     color[]={0,1,0,0.1}; //Obsolete, done over color values in class Draw,
                        //but at the moment still required.
     class Bones //List of all bones
     class Bones //List of all bones
     {
     {
Line 44: Line 46:
   };</font>
   };</font>


<font color="Black">
===Class Bones:===
===Class Bones:===
<font color="Black">
 
All bones that are used for positioning and animating of drawings.
All bones that are used for positioning and animating of drawings.


Line 63: Line 67:
       type = linear;
       type = linear;
       source = fuel;
       source = fuel;
       min = 0; //min value this bone can display
       min = 0;             //Min value this bone can display
       max = 1; //max value this bone can display
       max = 1;             //Max value this bone can display
       minPos[] = {0.5,0.2};
       minPos[] = {0.5,0.2};
       maxPos[] = {0.5,0.5};
       maxPos[] = {0.5,0.5};
Line 82: Line 86:
       type = vector;
       type = vector;
       source = velocity;
       source = velocity;
       pos0[] = {0.5,Pos0Center}; // position of 0-degree dive line
       pos0[] = {0.5,Pos0Center};         //Position of 0-degree dive line
       pos10[] = {0.5+0.9,Pos0Center+0.7}; // position of 10 degree bank and 10-degree dive (used to adjust scale)
       pos10[] = {0.5+0.9,Pos0Center+0.7}; //Position of 10 degree bank and
    };
    };                                    //10-deg dive (to adjust scale)
     class ILS
     class ILS
     {
     {
       type = ils;
       type = ils;
       pos0[] = {0.5,0.4}; // position when centered
       pos0[] = {0.5,0.4}; //Position when centered
       pos3[] = {0.7,0.6}; // position when 3-degree off in both directions
       pos3[] = {0.7,0.6}; //Position when 3-degree off in both directions
     };
     };
     class Horizont
     class Horizont
     {
     {
       type = horizon;
       type = horizon;
       pos0[] = {0.5,0.27}; // position of 0-degree dive line
       pos0[] = {0.5,0.27}; //Position of 0-degree dive line
       pos10[] = {0.5+0.9,3.4}; // position of 10 degree bank and 10-degree dive (used to adjust scale)
       pos10[] = {0.5+0.9,3.4}; //Position of 10 degree bank and 10-degree
       angle = 0; // horizon angle to which this line corresponds to
                                //dive (used to adjust scale)
     };
       angle = 0;                 //Horizon angle to which this line
     };                           //corresponds to
   };</font>
   };</font>
<font color="Black">
===Class Draw:===
===Class Draw:===
<font color="Black">The class Draw is a "group", which consist of other groups or classes.


Every group can have its own alpha, color[], clipTL[], clipBR[] and condition values, which will be the valid for all classes/groups inside.
The class Draw is a "group", which consist of other groups or classes.


Every group can have its own alpha, color[], clipTL[], clipBR[] and condition values, which will be valid for all classes/groups inside.


Format for a point(for points[],pos[],right[] and down[] entries):</font>
 
Format for a point ''(for points[], pos[], right[] and down[] entries)'':</font>


<font color="Blue">{[bone1,] position1, blending weight1[, [bone2,] position2, blending weight2]...}</font>
<font color="Blue">{[bone1,] position1, blending weight1[, [bone2,] position2, blending weight2]...}</font>
Line 111: Line 121:
<font color="Black">entries with [] are optional.  
<font color="Black">entries with [] are optional.  


Points directly defined after each other are linked by a line, incase you don't want to link place an empty point {} between those points.
Points directly defined after each other are linked by a line, in case you don't want to link place an empty point {} between those points.


   <font color="Blue">class Draw
   <font color="Blue">class Draw
Line 117: Line 127:
     alpha = 0.8;
     alpha = 0.8;
     color[] = {0.2,1,0.1};
     color[] = {0.2,1,0.1};
     clipTL[] = {0.0,0.05}; //Defines the space in which the bone is drawn TL = Top Left BR = Bottom Right
     clipTL[] = {0.0,0.05};   //Defines the space in which the bone is drawn  
     clipBR[] = {1.0,0.90};
     clipBR[] = {1.0,0.90};   //TL = Top Left, BR = Bottom Right
     condition = "on";
     condition = "on";
  
  
Line 130: Line 140:
       type = text;
       type = text;
       align = left;
       align = left;
       scale = 1; // text size, obsolete (but still required)
       scale = 1; //Text size, obsolete (but still required)
       source = speed;
       source = speed;
       sourceScale = 3.6; // convert from m/s to km/h
       sourceScale = 3.6; //Convert from m/s to km/h
      //pos[],right[],down[] define the box (size) of the first letter.
       pos[]={SpdMove2,{-0.05,-0.03},1};   //pos[],right[],down[] define the
       pos[]={SpdMove2,{-0.05,-0.03},1};  
       right[]={SpdMove2,{0.01,-0.03},1}; //box (size) of the first letter.
       right[]={SpdMove2,{0.01,-0.03},1};
       down[]={SpdMove2,{-0.05,0.03},1};
       down[]={SpdMove2,{-0.05,0.03},1};
     };
     };
   };</font>
   };</font>


===Short Reference:===


<font color="Black">Available Sources:
==Short Reference:==
 
===Available Sources:===
 
====Vectors:====
 
*velocity: Velocity vector
*weapon: Current weapon aim vector
*target: Vector to current target
 


Vectors:
====Scalar:====
  *velocity: velocity vector
 
  *weapon: current weapon aim vector
*altitudeAGL: Above ground level altitude (m)  
  *target: vector to current target
*altitudeASL: Above sea level altitude (m)  
 
*speed: Speed (m/s)
Scalar:
*vspeed: Vertical speed (m/s)  
  *altitudeAGL: above ground level altitude (m)  
*targetDist: Distance to current target  
  *altitudeASL: above sea level altitude (m)  
*rpm: Current engine rpm (0..1)  
  *speed: speed (m/s) vspeed: vertical speed (m/s)  
*fuel: Fuel tank state (0..1)
  *targetDist: distance to current target  
 
  *rpm: current engine rpm (0..1)  
 
  *fuel: fuel tank state (0..1)
===Available Bone Types:===
 
*fixed: Non moving bone
*linear: Linear moving bone
*rotational: Rotating bone
*vector: Vector bone
*ils: Instrument landing system
*horizon: Artifical horizon
 
 
===Available Draw Types:===
 
*group: If no type is defined, type is assumed to be group
*line: Drawing a line
*text: Drawing text


Available Bone Types:
*fixed: non moving bone
*linear: linear moving bone
*rotational: rotating bone
*vector: vector bone
*ils: instrumented landing system
*horizon: artifical horizont


Available Draw Types:
===Available Conditions:===
*group: if no type is defined, type is assumed to be group
*line: drawing a line
====Aircraft:====
*text: drawing text


Available Conditions:
*on: Engine on  
Aircrafts:
*ils: Gear down  
  *on: engine on  
*mgun: Current weapon is a mgun  
  *ils: gear down  
*missile: Current weapon is a missile  
  *mgun: current weapon is a mgun  
  *missile: current weapon is a missile  
   
   
Landvehicles:
 
====Landvehicles:====

Revision as of 15:52, 30 April 2006


Introduction:

The idea: 2D elements animated by bones, used for displays inside vehicles.

Main Structure:

Add class MFD to class cfgVehicles.Yourvehicle.

Subclasses of MFD you can name as you want.

 class MFD
 {
   class MFD1 {...};
   class MFD2 {...};
   ...
   
 };

Optional.

with class MFD1 of the following structure:

 class MFD1
 {
   topLeft = "HUD LH";	//Those 3 points define the displayarea. These 
   topRight = "HUD PH";	//points need to be present in model of vehicle.
   bottomLeft = "HUD LD";
 
   borderLeft = 0.05;	//Offsets used to finetune the actual displayarea.
   borderRight = 0.05;	//The values can vary from 0 - 1.
   borderTop = 0.02;
   borderBottom = 0.1;
 	 	
   color[]={0,1,0,0.1};	//Obsolete, done over color values in class Draw,
                        //but at the moment still required.

   class Bones		//List of all bones
   {
     ...
   };
   class Draw		//List of all drawingmethods
   {
     ...
   };
 };


Class Bones:

All bones that are used for positioning and animating of drawings.

Defined positions are relative to position the bone is binded to (by default {0,0} of display area).

Codesamples for each possible bone, with all needed values:

 class Bones
 {
   class Fixed
   {
     type = fixed;
     pos[] = {0.05,0.9};
   };
   class Linear
   {
     type = linear;
     source = fuel;
     min = 0;	            //Min value this bone can display
     max = 1;	            //Max value this bone can display
     minPos[] = {0.5,0.2};
     maxPos[] = {0.5,0.5};
   };
   class Rotational
   {
     type = rotational;
     source = targetDist;
     center[] = {0,0};
     min = 100;
     max = 3000;
     minAngle = -120;
     maxAngle = +120;
   };
   class Vector
   {
     type = vector;
     source = velocity;
     pos0[] = {0.5,Pos0Center};	         //Position of 0-degree dive line
     pos10[] = {0.5+0.9,Pos0Center+0.7}; //Position of 10 degree bank and
   };                                    //10-deg dive (to adjust scale)

   class ILS
   {
     type = ils;
     pos0[] = {0.5,0.4};  //Position when centered
     pos3[] = {0.7,0.6};  //Position when 3-degree off in both directions
   };
   class Horizont
   {
     type = horizon;
     pos0[] = {0.5,0.27};	//Position of 0-degree dive line
     pos10[] = {0.5+0.9,3.4};	//Position of 10 degree bank and 10-degree
                                //dive (used to adjust scale)
     angle = 0;	                //Horizon angle to which this line
   };                           //corresponds to
 };


Class Draw:

The class Draw is a "group", which consist of other groups or classes.

Every group can have its own alpha, color[], clipTL[], clipBR[] and condition values, which will be valid for all classes/groups inside.


Format for a point (for points[], pos[], right[] and down[] entries):

{[bone1,] position1, blending weight1[, [bone2,] position2, blending weight2]...}

entries with [] are optional.

Points directly defined after each other are linked by a line, in case you don't want to link place an empty point {} between those points.

 class Draw
 {
   alpha = 0.8;
   color[] = {0.2,1,0.1};
   clipTL[] = {0.0,0.05};   //Defines the space in which the bone is drawn 
   clipBR[] = {1.0,0.90};   //TL = Top Left, BR = Bottom Right
   condition = "on";
 	
   class Line
   {
     type = line;
     points[] = {{Bone1,1},{Bone2,1}};
   };
   class Text
   {
     type = text;
     align = left;
     scale = 1; 		//Text size, obsolete (but still required)
     source = speed;
     sourceScale = 3.6; 	//Convert from m/s to km/h
     pos[]={SpdMove2,{-0.05,-0.03},1};   //pos[],right[],down[] define the
     right[]={SpdMove2,{0.01,-0.03},1};  //box (size) of the first letter.
     down[]={SpdMove2,{-0.05,0.03},1};
   };	
 };


Short Reference:

Available Sources:

Vectors:

  • velocity: Velocity vector
  • weapon: Current weapon aim vector
  • target: Vector to current target


Scalar:

  • altitudeAGL: Above ground level altitude (m)
  • altitudeASL: Above sea level altitude (m)
  • speed: Speed (m/s)
  • vspeed: Vertical speed (m/s)
  • targetDist: Distance to current target
  • rpm: Current engine rpm (0..1)
  • fuel: Fuel tank state (0..1)


Available Bone Types:

  • fixed: Non moving bone
  • linear: Linear moving bone
  • rotational: Rotating bone
  • vector: Vector bone
  • ils: Instrument landing system
  • horizon: Artifical horizon


Available Draw Types:

  • group: If no type is defined, type is assumed to be group
  • line: Drawing a line
  • text: Drawing text


Available Conditions:

Aircraft:

  • on: Engine on
  • ils: Gear down
  • mgun: Current weapon is a mgun
  • missile: Current weapon is a missile


Landvehicles: