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

Object

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 03:49, 11 January 2010 by Wormbo (Talk | contribs) (mentioned common enums and structs, added links to the operators section)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Object
Direct subclasses:
Commandlet, Actor
This class in other games:
RTNP, U1, UT, UE2Runtime, UT2003, U2, U2XMP, UT2004, UDK, UT3

The top-most class of the UnrealScript class hierarchy in all Unreal Engine games. All other classes, even interfaces in games that support them, directly or indirectly extend the Object class.

Note the distinction between the Object class itself and an object as an instance of a class in general. Another distinction often made is between "actors" as instances of Actor subclasses and "non-actor objects" as instances of classes that do not extend Actor. Actors are created either by a mapper placing them in the level or at runtime with the Actor.Spawn() function. Non-actor objects on the other hand can be created in various ways in the editor, such as creating or importing resources or creating new object values in an actor properties window. At runtime, new instances for non-actor classes can be created with the new operator.

Properties[edit]

The Object class defines only few basic properties, all of which are defined when the object is created and cannot be changed later at runtime. (const) In the editor renaming or moving resources is possible only via a special editor feature, not by directly editing the object properties. (editconst)

Property group 'Object'[edit]

Name[edit]

Type: name

The name of this object.

Internal variables[edit]

Class[edit]

Type: Class

The class of this object.

Outer[edit]

Type: Object

The outer object containing this object. For resources like Textures this is usually the package or group, for Actors this is usually the map package of the level currently being played.

Enums[edit]

The enums defined in the Object class differ greatly between the various engine generations. Some examples include ESheerAxis(RTNP, U1, UT, U2, U2XMP, UE2Runtime, UT2003, UT2004), EAxis(U2, UE2Runtime, UT2004, UDK, UT3), EDrawPivot(UT2003, UT2004) and ETickingGroup(UDK, UT3).

Structs[edit]

Some commonly used types that seem to be built-in types, such as vector or rotator, are actually structs defined in the Object class so they are available everywhere. Some commonly available structs are described below.

Color[edit]

Main article: Color

An RGB color with alpha (opacity) value.

byte
Blue color component.
byte
Green color component.
byte
Red color component.
byte
Alpha value.

Coords[edit]

A coordinate system. Usually the X, Y and Z axes are perpendicular to each other so that in the coordinate system X faces forward, Y faces right and Z faces up.

Vector Origin 
The origin of this coordinate system in global coordinates.
Vector XAxis 
The coordinate system's X axis.
Vector YAxis 
The coordinate system's Y axis.
Vector ZAxis 
The coordinate system's Z axis.

Plane[edit]

Extends: Vector

Describes a plane using X/Y/Z as normal vector and W as distance from origin or a sphere using X/Y/Z as center location and W as radius.

Note that components are rounded for replication, so Plane values actually describing a plane may need their X/Y/Z values multiplied by a larger value prior to replication, similar to vectors.

float

Quat[edit]

Main article: Quaternion

A quaternion value. (Not in Unreal Engine 1.)

Quat values are assumed to represent unit quaternions (Sqrt(X*X + Y*Y + Z*Z + W*W) == 1.0) for replication, so the W value is not replicated, but reconstructed from X, Y and Z.

float
The i component of the quaternion.
float
The j component of the quaternion.
float
The k component of the quaternion.
float
The real component of the quaternion.

Rotator[edit]

Main article: Rotator

A 3D rotation value. Components are applied in the order Yaw, Pitch, Roll.

For replication, component values are compressed by bitwise AND (component & 0xFF00), so you can only really replicate an orientation, not a rotation rate. For more precision or to retain the sign or values above 0xFF00 you could, for example, map the components to the X, Y and Z values of a vector and replicate that instead.

int Pitch 
The pitch component. (think nodding for "yes")
int Yaw 
The yaw component. (think shaking the head for "no")
int Roll 
The roll component. (think tilting your head left and right for "not sure")

Vector[edit]

Main article: Vector

A 3D vector value. Vector components are rounded for replication.

float
The vector's X component.
float
The vector's Y component.
float
The vector's Z component.

Operators[edit]

Main article: Operators

The Object class defines most of the operators you can use in UnrealScript code. Only a few special operators, such as the assignment operator =, the conditional operator ? : or the (in)equality comparison operators == and != for structs in general are implicitly available because they cannot be expressed in a standard operator declaration. All others actually have a declaration in UnrealScript, usually in the Object class so they are globally available.

Functions[edit]

The object class also defines many functions so they are globally available.