HUD: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===Introduction:===
{{TOC|side}}
The idea: 2D elements animated by bones, used for displays inside vehicles.


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


== Main Structure ==


===Main Structure:===
Add class MFD to class CfgVehicles/YourVehicle.


Add class MFD to class cfgVehicles.Yourvehicle.
Subclasses of MFD you can name as you want.
 
<syntaxhighlight lang="cpp">
class MFD
{
class MFD1 { /* ... */ }; // optional subclasses
class MFD2 { /* ... */ };
// ...
};
</syntaxhighlight>
 
with class MFD1 of the following structure:
<syntaxhighlight lang="cpp">
class MFD1
{
topLeft = "HUD LH"; // Those 3 points define the displayarea and need to be present in model of vehicle.
topRight = "HUD PH";
bottomLeft = "HUD LD";
 
borderLeft = 0.05; // Offsets used to finetune the actual displayarea.
borderRight = 0.05; // The values can be in range from 0 - 1.
borderTop = 0.02;
borderBottom = 0.1;
 
enableParallax = 1; // Parallax simulation. Enables holographic projection effect,
// but only takes eye position from freelook/G-forces into effect (not XYZ offsets (ex. Ctrl + NUM4)).


Subclasses of MFD you can name as you want.
color[] = { 0, 1, 0, 0.1 }; // Obsolete, done over color values in class Draw, but at the moment still required.


  <font color="Blue">class MFD
class Bones // List of all bones
  {
{
    <font color="DarkGrey">class MFD1 {...};
// ...
    class MFD2 {...};
};
    ...
    </font><font color="Blue">
  };</font>
<font color="DarkGrey">Optional.</font>


<font color="Black">with class MFD1 of the following structure:</font>
class Draw // List of all drawingmethods
  <font color="Blue">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";
</syntaxhighlight>
 
    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
    {
      ...
    };
  };</font>




<font color="Black">
== Class Bones ==
===Class Bones:===


All bones that are used for positioning and animating of drawings.
All bones that are used for positioning and animating of drawings.
Line 52: Line 55:
Defined positions are relative to position the bone is binded to (by default {0,0} of display area).
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:</font>
Codesamples for each possible bone, with all needed values:
 
<syntaxhighlight lang="cpp">
class Bones
{
class Fixed
{
type = fixed;
pos[] = { 0.05, 0.9 };
};


  <font color="Blue">class Bones
class Linear
  {
{
    class Fixed
type = linear;
    {
source = fuel;
      type = fixed;
min = 0; // Min value this bone can display
      pos[] = {0.05,0.9};
max = 1; // Max value this bone can display
    };
minPos[] = { 0.5, 0.2 };
    class Linear
maxPos[] = { 0.5, 0.5 };
    {
};
      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
  };</font>


class Rotational
{
type = rotational;
source = targetDist;
center[] = { 0, 0 };
min = 100;
max = 3000;
minAngle = -120;
maxAngle = +120;
};


<font color="Black">
class Vector
===Class Draw:===
{
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-degree 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
};
};
</syntaxhighlight>
 
 
=== Class Draw ===


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




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


<font color="Blue">{[bone1,] position1, blending weight1[, [bone2,] position2, blending weight2]...}</font>
{ [bone1,] position1, blending weight1[, [bone2,] position2, blending weight2]... }


<font color="Black">entries with [] are optional.  
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.
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
<syntaxhighlight lang="cpp">
  {
class Draw
    alpha = 0.8;
{
    color[] = {0.2,1,0.1};
alpha = 0.8;
    clipTL[] = {0.0,0.05};   //Defines the space in which the bone is drawn  
color[] = { 0.2, 1, 0.1 };
    clipBR[] = {1.0,0.90};   //TL = Top Left, BR = Bottom Right
clipTL[] = { 0.0, 0.05 }; // Defines the space in which the bone is drawn
    condition = "on";
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};
    };
  };</font>


In order for a hud element to disappear and reappear according to its condition, it must be defined as a subclass.
class Line
{
type = line;
points[] = { { Bone1, 1 }, { Bone2, 1 } };
};


  <font color="Blue">    class Draw
class Text
      {
{
            class arrow
type = text;
            {
align = left;
                  Condition = "ils";
scale = 1; // Text size, obsolete (but still required)
                  type = "line";
source = speed;
                  class Circle
sourceScale = 3.6; // Convert from m/s to km/h
                  {
pos[] = { SpdMove2, { -0.05, -0.03 }, 1 }; // pos[], right[], down[] define the box (size) of the first letter.
                        points[] =
right[] = { SpdMove2, { 0.01, -0.03 }, 1 };
                        {
down[] = { SpdMove2, { -0.05, 0.03 }, 1 };
                              {{0.489, 0.822}, 1},
};
                              {{0.500, 0.813}, 1},
};
                              {{0.511, 0.822}, 1},
</syntaxhighlight>
                              {{0.489, 0.822}, 1},
                              {}
                        };
                  };
            };
      };</font>


This graphic will only show when the landing gear is down
In order for a hud element to disappear and reappear according to its condition, it must be defined as a subclass.
 
<font color="Blue">    class Draw
      {
            class arrow
            {
                  Condition = "ils";
                  type = "line";
                  points[] =
                  {
                        {{0.489, 0.822}, 1},
                        {{0.500, 0.813}, 1},
                        {{0.511, 0.822}, 1},
                        {{0.489, 0.822}, 1},
                        {}
                  };
            };
      };</font>
 
This graphic will always be displayed despite the ils condition.</font>


==Short Reference:==
<syntaxhighlight lang="cpp">
class Draw
{
class arrow
{
Condition = "ils";
type = "line";
class Circle
{
points[] =
{
{ { 0.489, 0.822 }, 1 },
{ { 0.500, 0.813 }, 1 },
{ { 0.511, 0.822 }, 1 },
{ { 0.489, 0.822 }, 1 },
{}
};
};
};
};
</syntaxhighlight>


===Available Sources:===
This graphic will only show when the landing gear is down:


====Vectors:====
<syntaxhighlight lang="cpp">
class Draw
{
class arrow
{
Condition = "ils";
type = "line";
points[] =
{
{ { 0.489, 0.822 }, 1 },
{ { 0.500, 0.813 }, 1 },
{ { 0.511, 0.822 }, 1 },
{ { 0.489, 0.822 }, 1 },
{}
};
};
};
</syntaxhighlight>


*velocity: Velocity vector
This graphic will always be displayed despite the ils condition.
*weapon: Current weapon aim vector
*target: Vector to current target




====Scalar:====
== Short Reference ==


*altitudeAGL: Above ground level altitude (m) Multiply source by 3.28084 to get (ft)
=== Available Sources ===
*altitudeASL: Above sea level altitude (m) Multiply source by 3.28084 to get (ft)
*speed: Speed (m/s) Multiply source by 2.2369356 to get MPH. Multiply by 3.6 to get KPH Multiply by 0.0288 to get (Mach*10) (Hud wont display decimals) Multiply by 1.94384 to get Knots.
*vspeed: Vertical speed (m/s)
*targetDist: Distance to current target
*rpm: Current engine rpm (0..1)
*fuel: Fuel tank state (0..1)
*HorizonDive: Dive angle, multiply source by 57.2958 to get degrees
*HorizonBank:
*Static: No source, always shows


===Available Bone Types:===
==== Vectors ====
* velocity: Velocity vector
* weapon: Current weapon aim vector
* target: Vector to current target


*fixed: Non moving bone
==== Scalar ====
*linear: Linear moving bone
* altitudeAGL: Above ground level altitude (m)
*rotational: Rotating bone
** Multiply source by 3.28084 to get (ft)
*vector: Vector bone
* altitudeASL: Above sea level altitude (m)
*ils: Instrument landing system
** Multiply source by 3.28084 to get (ft)
*horizon: Artifical horizon
* speed: Speed (m/s)
** Multiply by 3.6 to get KPH
** Multiply by 0.0288 to get (Mach * 10) (Hud wont display decimals)
** Multiply source by 2.2369356 to get MPH.
** Multiply by 1.94384 to get Knots.
* vSpeed: Vertical speed (m/s)
* targetDist: Distance to current target
* rpm: Current engine rpm (0..1)
* fuel: Fuel tank state (0..1)
* HorizonDive: Dive angle in radians
** Multiply source by 57.2958 to get degrees
* HorizonBank: -
* Static: No source, always shows


=== Available Bone Types ===


===Available Draw Types:===
* fixed: Non moving bone
* linear: Linear moving bone
* rotational: Rotating bone
* vector: Vector bone
* ils: Instrument landing system
* horizon: Artificial horizon


*group: If no type is defined, type is assumed to be group
=== Available Draw Types ===
*line: Drawing a line
*text: Drawing text


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


===Available Conditions:===
=== Available Conditions ===
====Aircraft:====


*on: Engine on  
==== Aircraft ====
*ils: Gear down  
* on: Engine on
*mgun: Current weapon is gun class
* ils: Gear down
*AAMissile: Current weapon is an air locking missile
* mgun: Current weapon is gun class
*ATMissile: Current weapon is a non-air locking missile
* AAMissile: Current weapon is an air locking missile
*Bomb: Current weapon is a bomb
* ATMissile: Current weapon is a non-air locking missile
*Rockets: Current weapon is an unguided missile or rocket
* Bomb: Current weapon is a bomb
* Rockets: Current weapon is an unguided missile or rocket
* stall: Aircraft is currently stalling
* lights: Lights are on?
* collisionLights: Collision lights are on?
* flaps: Flaps are down?


====Landvehicles:====
==== Landvehicles ====
{{Wiki|stub}}


*Blah


[[Category:ArmA: Addon Configuration]]
{{GameCategory|arma1|Addon Configuration}}

Latest revision as of 17:23, 4 March 2024

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 { /* ... */ }; // optional subclasses
	class MFD2 { /* ... */ };
	// ...
};

with class MFD1 of the following structure:

class MFD1
{
	topLeft = "HUD LH";		// Those 3 points define the displayarea and need to be present in model of vehicle.
	topRight = "HUD PH";
	bottomLeft = "HUD LD";

	borderLeft = 0.05;		// Offsets used to finetune the actual displayarea.
	borderRight = 0.05;		// The values can be in range from 0 - 1.
	borderTop = 0.02;
	borderBottom = 0.1;

	enableParallax = 1;		// Parallax simulation. Enables holographic projection effect,
	// but only takes eye position from freelook/G-forces into effect (not XYZ offsets (ex. Ctrl + NUM4)).

	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-degree 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 box (size) of the first letter.
		right[] = { SpdMove2, { 0.01, -0.03 }, 1 };
		down[] = { SpdMove2, { -0.05, 0.03 }, 1 };
	};
};

In order for a hud element to disappear and reappear according to its condition, it must be defined as a subclass.

class Draw
{
	class arrow
	{
		Condition = "ils";
		type = "line";
		class Circle
		{
			points[] =
			{
				{ { 0.489, 0.822 }, 1 },
				{ { 0.500, 0.813 }, 1 },
				{ { 0.511, 0.822 }, 1 },
				{ { 0.489, 0.822 }, 1 },
				{}
			};
		};
	};
};

This graphic will only show when the landing gear is down:

class Draw
{
	class arrow
	{
		Condition = "ils";
		type = "line";
		points[] =
		{
			{ { 0.489, 0.822 }, 1 },
			{ { 0.500, 0.813 }, 1 },
			{ { 0.511, 0.822 }, 1 },
			{ { 0.489, 0.822 }, 1 },
			{}
		};
	};
};

This graphic will always be displayed despite the ils condition.


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)
    • Multiply source by 3.28084 to get (ft)
  • altitudeASL: Above sea level altitude (m)
    • Multiply source by 3.28084 to get (ft)
  • speed: Speed (m/s)
    • Multiply by 3.6 to get KPH
    • Multiply by 0.0288 to get (Mach * 10) (Hud wont display decimals)
    • Multiply source by 2.2369356 to get MPH.
    • Multiply by 1.94384 to get Knots.
  • vSpeed: Vertical speed (m/s)
  • targetDist: Distance to current target
  • rpm: Current engine rpm (0..1)
  • fuel: Fuel tank state (0..1)
  • HorizonDive: Dive angle in radians
    • Multiply source by 57.2958 to get degrees
  • HorizonBank: -
  • Static: No source, always shows

Available Bone Types

  • fixed: Non moving bone
  • linear: Linear moving bone
  • rotational: Rotating bone
  • vector: Vector bone
  • ils: Instrument landing system
  • horizon: Artificial 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 gun class
  • AAMissile: Current weapon is an air locking missile
  • ATMissile: Current weapon is a non-air locking missile
  • Bomb: Current weapon is a bomb
  • Rockets: Current weapon is an unguided missile or rocket
  • stall: Aircraft is currently stalling
  • lights: Lights are on?
  • collisionLights: Collision lights are on?
  • flaps: Flaps are down?

Landvehicles