I don't need to test my programs. I have an error-correcting modem.

Legacy:Unreal Unit

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 15:43, 30 July 2011 by Urcheon (Talk | contribs) (Angle)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UU stands for Unreal Units. Any number that represents a distance in Unreal is given in these units. There's also RUU, Rotational Unreal Unit (or Unreal Rotation Unit, but it's easier to link RUU than URU ;) ). Often "UU" is used for both length and angle, and sometimes they are just called "units", or not given a name at all ("build a 256x256x64 box").

Length[edit]

The UnrealEd grid, dimensions of brushes, positions of actors and sizes of collision cylinders are all measured in these units. The Unreal World can have a maximum size of 65536 UU (=2^16) in Unreal/UT. UT2003 and U2 have worlds of 524288 UU (=2^19).

One UU doesn't actually mean anything, it's just something within the engine. An arbitrary scale is used for game programming because the scale may change from one game to another, one game may be an FPS, while another may be a space sim with several planets on an entire map. Each game picks a scale to work at: the size of players and objects, which means there is an effective conversion factor between UU and real physical units. In the Unreal series of games, this is generally held to be roughly:

  • 256 UU = 487.68 cm = 16 feet.
  • 1 meter = 52.5 UU
  • 1 foot = 16 UU
  • 1 cm = 0.525 UU
  • 1 UU = 0.75 inches

Sweavo: in ut2004, a 52.5 square space is just enough for a player to fit in. I would increase all these numbers by 20% if making semi-realistic maps.

Angle[edit]

Some UnrealScript functions use radians, just to be awkward, or because they're always used with radians, such as trigonometric functions.

Unreal Units Degrees Radians * π Steps per circle
1024 5.625 1/32 64 (default step size of the rotation grid)
2730 15 1/12 24 (not quite round, it's actually 2730.6666... )
8192 45 1/4 8
16384 90 1/2 4
24576 135 3/4 2.66...
32768 180 1 2
65536 360 2 1 - full circle

See also the rotation grid in UnrealEd Advanced Options->Editor->RotationGrid, set:

Angle conversion constants[edit]

const DegreeToMOA    = 60.0;           // 21600/360
const DegreeToRadian = 0.017453;       // pi/180
const DegreeToURot   = 182.044449;     // 65536/360
 
const MOAToDegree    = 0.016667;       // 360/21600
const MOAToRadian    = 0.000291;       // pi/10800
const MOAToURot      = 3.034074;       // 65536/21600
 
const RadianToDegree = 57.295776;      // 180/pi
const RadianToMOA    = 3437.746582;    // 10800/pi
const RadianToURot   = 10430.377930;   // 32768/pi
 
const URotToDegree   = 0.005493;       // 360/65536
const URotToMOA      = 0.329590;       // 21600/65536
const URotToRadian   = 0.000096;       // pi/32768

Conversion utilities[edit]

If you want to use a handy unit conversion, you can use a postoperator for this, like so:

const Meter=52.5;
 
// These can be somewhere fairly global...
static final postoperator float Meters( float Units )
{ return Units * Meter; }
 
static final postoperator float MPS( float Units )
{ return Units Meters; }
 
function SetSomething()
{
  SetCollisionSize( 5 Meters, 3 Meters );
  Velocity = Vector( Rotation ) * 5 MPS;
}

See Useful Maths Functions for angle conversion factors.

Two handy javascript unit converters:

Related Topics[edit]