UDN
Search public documentation:

CoreUnrealScriptObjectsJP
English Translation

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UnrealScript の主要オブジェクト

最終更新: Michiel Hendriks (v3223 用に更新)。前回更新: Michael Breen (DemiurgeStudios)。
オリジナル作成者: Michael Breen (DemiurgeStrudios) 2004 年 2 月 13 日。

関連文書

UnrealScript 言語リファレンス

StringsInUnrealScript

以下は、すべての UnrealScript オブジェクトの基礎となる基本クラス、関数、および構造体です。

基本オブジェクト

オブジェクトの基本クラスは Object で、コード中の UObject に対応します。

//=============================================================================
// Object: The base class all objects.
// This is a built-in Unreal class and it shouldn't be modified.
//=============================================================================
class Object
   native
   noexport;

UObject の変数

オブジェクトの内部的な変数です。通常、これらの変数を操作する必要はありません。ただし、オブジェクト フラグについては以下で説明します。

//=============================================================================
// UObject variables.

// Internal variables.
var native private const pointer ObjectInternal[6];
var native const object Outer;
var native const int ObjectFlags;
var(Object) native const editconst noexport name Name;
var native const editconst class Class;

オブジェクト フラグ

内部的なフラグです。通常、このフラグを操作する必要はありません。これらのフラグはオブジェクトごとに設定することができ、それによっていくつかのプロパティを設定することができます。

これらのフラグは、オブジェクトの生成時に使用します。フラグは加算してください。以下の例は、新しい MaterialClass オブジェクトを返します。

例:

return New(Outer, Name, RF_Public+RF_Standalone) MaterialClass;

下で列挙されているオブジェクトフラグが UnrealEngine のフラグのサブセットであることに注意してください。RF_Standalone は、ここでは定義されていません。利便性のために MaterialFactory.uc で定義されています。

const RF_Standalone = 0x00080000;

RF_Standalone フラグを指定すると、オブジェクトが参照されていない場合でも破棄せず、編集できるようにします。

//=============================================================================
// Unreal base structures.

// Object flags.
const RF_Transactional  = 0x00000001; // Supports editor undo/redo.
const RF_Public         = 0x00000004; // Can be referenced by external package files.
const RF_Transient      = 0x00004000; // Can't be saved or loaded.
const RF_Standalone     = 0x00080000; // Keep object around for editing even if unreferenced.
const RF_NotForClient   = 0x00100000; // Don't load for game client.
const RF_NotForServer   = 0x00200000; // Don't load for game server.
const RF_NotForEdit     = 0x00400000; // Don't load for editor.

構造体

GUID

4 つの整数で表されるグローバル一意識別子。通常、GUID は 16 進数の文字列として表されます。これは内部的な構造体です。通常、この構造体を操作する必要はありません。

// A globally unique identifier.
struct Guid
{
   var int A, B, C, D;
};

UnrealScript の回転の単位

UnrealScript では、回転を表すのに度数やラジアンは使用しません。回転は Unreal 単位 (URU) で表されます。URU の値の範囲は 0 ~ 65536 (2^16) です。

  • 45� : 8192 URUs
  • 90� : 16384 URUs
  • 180� : 32768 URUs
  • 270� : 49152 URUs
  • 360� : 65536 URUs

度数を URU に変換するには、8192/45 を乗じてください。
URU を度数に変換するには、45/8192 を乗じてください。

Vector (ベクトル)

方向ベクトルとして使用する場合、ベクトルは原点を始点とし、X、Y、および Z で表される点を終点とします。ベクトルは UnrealScript で頻繁に使用されます。これは、すべてのアクタが 3 次元的な位置を持っており、アクタが何かに接近しているかどうかなどを常に調べる必要があるためです。

警告: UnrealScript では、回転を表すのに度数やラジアンは使用しません。回転の単位の範囲は、0 ~ 360 ではなく、0 ~ 65536 です。詳細については、UnrealScript の回転の単位を参照してください。

参照: ベクトル演算子ベクトル関数

例:

simulated final function bool TouchingActor(Actor A)
{
   local vector Dir;

   Dir = Location - A.Location;

   if ( abs(Dir.Z) > CollisionHeight + A.CollisionHeight )
      return false;

   Dir.Z = 0;
   return ( VSize(Dir) <= CollisionRadius + A.CollisionRadius );
}

ここでは、次のことがわかります。

  • アクタの位置 (Location) と A.Location はいずれもベクトルです。
  • 3D 空間における点を表すベクトルを減算し、相対的な方向ベクトル Dir を得ることができます。Dir は、アクタ A を始点とし、現在のアクタを終点とするベクトルです。
  • ベクトルの要素には、標準的な方法で個別にアクセスできます (例: Dir.Z = 0)。

// A point or direction vector in 3d space.
struct Vector
{
   var() config float X, Y, Z;
};

Plane (平面)

平面には、X、Y、Z、および W の各要素があります。(Plane は Vector を拡張していることに注意してください。)
原点を始点とし、空間内の点 (X, Y, Z) を終点とするベクトルがあるとします。このベクトルに沿って、原点から W で表される距離だけ移動します。この構造体における平面は、距離 W においてベクトルに対して直角な平面として定義されます。(0,0,0) -> (X, Y, Z) によって定義されるベクトルは、正規化することをお勧めします。

また、この構造体は球としても使用できることに注意してください。コード例については、境界容積を参照してください。球として使用する場合、球は、空間内の点 (X, Y, Z) から距離 W にあるすべての点として定義されます。

// A plane definition in 3d space.
struct Plane extends Vector
{
   var() config float W;
};

Rotator (ローテータ)

オイラー角を使用するローテータは UnrealScript で頻繁に使用されています。回転はロール、ピッチ、およびヨーで表され、絶対・相対のどちらの回転にも使用されます。ローテータのさまざまな使い方については、ローテータの演算子と関数参照してください。ジンバルロックを防ぐ方法としては、ローテータをベクトルに適用する前にクォータニオンに変換する方法があります。この Java アプレットでは、回転をオイラー角ベクトルとクォータニオンの両方で表示します。

警告: UnrealScript では、回転を表すのに度数やラジアンは使用しません。回転の単位の範囲は、0 ~ 360 ではなく、0 ~ 65536 です。詳細については、UnrealScript の回転の単位を参照してください。

// An orthogonal rotation in 3d space.
struct Rotator
{
   var() config int Pitch, Yaw, Roll;
};

座標

Unreal では通常、(0,0,0) を原点とし、X 軸が前方へ (画面の奥へ) 伸び、Y 軸が右へ、Z 軸が上へ伸びる座標系を使っていますが、この座標系に飽きてしまったとしましょう。まったく違う座標系を使うこととします。この場合、新しい原点を Origin とすると、元の座標系を使って (Origin.X, Origin.Y, Origin.Z) という点として定義できます。こうすれば、3 つのベクトル (できれば直交する正規化されたもの) を得ることができ、原点から軸を伸ばすことが可能になります。これにより、ある座標系 (標準のものだけでなく) から別の座標系への変換を表すことができます。ここでいう標準とは、レベルで使用されているマップの原点という意味です。

// An arbitrary coordinate system in 3d space.
struct Coords
{
   var() config vector Origin, XAxis, YAxis, ZAxis;
};

クォータニオン

クォータニオンを使うと、ジンバルロックを回避しながら、回転を表したり適用したりすることができます。クォータニオンの概要については、Using Quaternions to Represent Rotationを参照してください。オイラー角のベクトル (ローテータ) をクォータニオンに変換したり、その逆の変換をしたり、オブジェクトにクォータニオン回転を適用する関数は多数用意されています。これらの関数については、クォータニオン関数を参照してください。この Java アプレットでは、回転をオイラー角ベクトル、マトリックス、およびクォータニオンのそれぞれで表示します。

軸と角度を使用する回転に比べてクォータニオンが優れているのは以下の点です。

  • ジンバルロックを回避します。
  • クォータニオン回転の作成は平易で、計算処理も容易です。
  • 回転の分割 (補間) の計算処理が容易です。

// Quaternion
struct Quat
{
   var() config float X, Y, Z, W;
};

Range (範囲)

範囲による指定が必要な変数は多数あります (例: CollisionSoundProbability)。ゲーム AI は、アクションやエフェクトに対し、状況に応じてその範囲内の値を使用する場合があります。範囲内の値をランダムに選択する場合もあれば、値が範囲内に収まるようにするだけの場合もあります。(Max >= Min) が真であるかどうかは未知です。

// Used to generate random values between Min and Max
struct Range
{
   var() config float Min;
   var() config float Max;
};

範囲ベクトル

一般に、範囲ベクトルを使うと、X、Y、および Z について Min と Max を持つあらゆる 3D 矩形を指定することができます。通常、範囲ベクトルは、雨が降っている領域や音楽が聞こえる領域など、マップ上の何かが起こっている領域や何かが起こっていない領域を定義するのに使用されます。また、パーティクルシステムでは、範囲内からランダムに選択された値を使って、各方向に移動するパーティクルの数と速度を決定します。境界ボックスも同様です。

例:

ParticleEmitter.uc(168):var (Collision)      rangevector               DampingFactorRange;
ParticleEmitter.uc(175):var (Collision)      rangevector               SpawnedVelocityScaleRange;
ParticleEmitter.uc(181):var (Color)      rangevector               ColorMultiplierRange;
ParticleEmitter.uc(207):var (Location)      rangevector               StartLocationRange;
ParticleEmitter.uc(211):var (Location)      rangevector               StartLocationPolarRange;
ParticleEmitter.uc(218):var (MeshSpawning)   rangevector               VelocityScaleRange;
ParticleEmitter.uc(219):var (MeshSpawning)   rangevector               MeshScaleRange;
ParticleEmitter.uc(234):var (Revolution)      rangevector               RevolutionCenterOffsetRange;
ParticleEmitter.uc(235):var (Revolution)      rangevector               RevolutionsPerSecondRange;
ParticleEmitter.uc(244):var (Rotation)      rangevector               SpinsPerSecondRange;
ParticleEmitter.uc(245):var (Rotation)      rangevector               StartSpinRange;
ParticleEmitter.uc(247):var (Rotation)      rangevector               RotationDampingFactorRange;
ParticleEmitter.uc(254):var (Size)         rangevector               StartSizeRange;
ParticleEmitter.uc(297):var (Velocity)      rangevector               StartVelocityRange;
ParticleEmitter.uc(300):var (Velocity)      rangevector               VelocityLossRange;
ParticleEmitter.uc(302):var (Velocity)      rangevector               AddVelocityMultiplierRange;

// Vector of Ranges
struct RangeVector
{
   var() config range X;
   var() config range Y;
   var() config range Z;
};

拡大/縮小と変形

エディタで、固体オブジェクトを拡大/縮小したり、変形したりするのに使います。拡大/縮小では、オブジェクトのサイズを変更します。変形では、オブジェクトの「質量」を一定に保ちながら、一定の方向に (ある軸に沿って) 伸ばします。イメージとしては、正方形の一端を引っ張って、同じ面積の平行四辺形にするようなものです。

// A scale and sheering.
struct Scale
{
   var() config vector Scale;
   var() config float SheerRate;
   var() config enum ESheerAxis
   {
      SHEER_None,
      SHEER_XY,
      SHEER_XZ,
      SHEER_YX,
      SHEER_YZ,
      SHEER_ZX,
      SHEER_ZY,
   } SheerAxis;
};

Matinee のためのカメラの向き

Matinee で使います。カメラの向きと、その向きを実現する方法を指定します。

// Camera orientations for Matinee
enum ECamOrientation
{
   CAMORIENT_None,
   CAMORIENT_LookAtActor,
   CAMORIENT_FacePath,
   CAMORIENT_Interpolate,
   CAMORIENT_Dolly,
};

汎用軸の列挙型

SVehicle において、ボーンがピボットするときの軸 (支持ボーン軸) を決定するのに使用されます。また、エディタで、ビルダブラシを回転させて要求された軸に一致させるときに使用されます。

// Generic axis enum.
enum EAxis
{
   AXIS_X,
   AXIS_Y,
   AXIS_Z
};

RGB カラー

赤、緑、青、およびアルファ (不透明度) で指定する色です。

// A color, Red, Green, Blue and Alpha
struct Color
{
   var() config byte B, G, R, A;
};

境界ボックス

あるものの境界となる 3D ボックスです。たとえば、パーティクルシステムの境界として使用します。Particle Systems を参照してください。

境界ボックスは範囲ベクトルに似ています。

// A bounding box.
struct Box
{
   var vector Min, Max;
   var byte IsValid;
};

境界容積

直方体と球で構成されます。球は平面と同じデータ構造を使って実装されますが、(X, Y, Z) は空間内の点とみなされ、W は距離とみなされます。

// A bounding box sphere together.
struct BoundingVolume extends Box
{
   var plane Sphere;
};

マトリックス (4x4)

マトリックスは、グローバルな参照フレームからローカルな参照フレームへの変換に使用します (たとえば、RenderWorldToCamera には、グローバルなフレームであるレンダーワールドからローカルなフレームであるカメラワールドへの変換が含まれます)。このマトリックスの逆行列を使うと、カメラワールドからレンダーワールドへの変換を得ることができます。

// a 4x4 matrix
struct Matrix
{
   var() Plane XPlane;
   var() Plane YPlane;
   var() Plane ZPlane;
   var() Plane WPlane;
};

補間関数

補間関数の点

補間曲線上の点を表します。(InVal, OutVal) は、(x, y) と同様に順序対です。内部的に使用されます。

参照: 補間曲線関数

// A interpolated function point.
struct InterpCurvePoint
{
   var() float InVal;
   var() float OutVal;
};

補間関数の点

点の配列です。関数の補間に使用します。SVehicle.uc では、Pacejka の方程式を近似するのに使用されています。

struct InterpCurve
{
   var() array<InterpCurvePoint>   Points;
};

圧縮された位置情報

位置、回転、および速度です。Heisenberg も驚くでしょう。ポーンの位置は、ネットワークでレプリケートされる場合、CompressedPosition として格納されます。

struct CompressedPosition
{
   var vector Location;
   var rotator Rotation;
   var vector Velocity;
};

定数

MaxInt は最も大きい正の整数を表します。
Pi は Darren Aronofsky によるすばらしい映画です。

//=============================================================================
// Constants.

const MaxInt = 0x7fffffff;
const Pi     = 3.1415926535897932;

基本的なネイティブ演算子と関数

//=============================================================================
// Basic native operators and functions.

論理演算子

// Bool operators.

論理演算子は通常 if 文で使用され、実際の論理値 {true, false} ではなく、評価結果が論理値になる式に対して使用されます。たとえば、if (true == (false && (true ^^ false))) という式を実際に見ることはありません。実際に目にするのは、if (i>5 && name=="John") のような式です。この意味において、A と B は論理式のためのプレースホルダであると言えます。

以下の表では、A と B の所与の値に対する各論理式の結果を示します。

A

Not A は、A の逆の値を返します。

A !A
false(偽) true(真)
true(真) false(偽)

// !A     : Not A
native(129) static final preoperator  bool  !  ( bool A );

A = B

A == B は、二つの倫理値が同じ値であるかどうかを返します。

A B A == B
false false true
false true false
true false false
true true true

// A == B : A equals B
native(242) static final operator(24) bool  == ( bool A, bool B );

A = B

A と B が等しくない場合に真になります。

A B A = B
false false false
false true true
true false true
true true false

// A != B : A is not equal to B
native(243) static final operator(26) bool  != ( bool A, bool B );

A && B

A と B の両方が真である場合に真になります。

A B A && B
false false false
false true false
true false false
true true true

// A && B : Both A and B must be true.
native(130) static final operator(30) bool  && ( bool A, skip bool B );

A ^^ B

排他的論理和。A と B のどちらか一方だけが真である (両方ともではない) 場合に真になります。

A B A ^^ B
false false false
false true true
true false true
true true false

// A ^^ B : Either A or B must be true, but not both
native(131) static final operator(30) bool  ^^ ( bool A, bool B );

A || B

A と B のどちらか一方または両方が真である場合に真になります。

A B A | | B
false false false
false true true
true false true
true true true

// A || B : Either A or B must be true.
native(132) static final operator(32) bool  || ( bool A, skip bool B );

バイト演算子

A に B を乗じて、その結果を A に格納します。
例:

A = 5;
A *= 2;

A == 10

A *= B

// A *= B : Multiply A by B and set A as the result.
native(133) static final operator(34) byte *= ( out byte A, byte B );

A /= B

// A /= B : Divide A by B and set A as the result.
native(134) static final operator(34) byte /= ( out byte A, byte B );

A += B

// A += B : Add A to B and set A as the result.
native(135) static final operator(34) byte += ( out byte A, byte B );

A -= B

// A -= B : Subtract B from A and set A as the result.
native(136) static final operator(34) byte -= ( out byte A, byte B );

++A

// ++A    : Add one to A.  This is incremented *before* it is evaluated, so it will evaluate to A+1
native(137) static final preoperator  byte ++ ( out byte A );

A--

// --A    : Subtract one from A. This is decremented *before it is evaluated, so it will evaluate to A-1
native(138) static final preoperator  byte -- ( out byte A );

A++

// A++    : Add one to A.  This is incremented *after* it is evaluated, so it will evaluate to A
native(139) static final postoperator byte ++ ( out byte A );

A--

// A--    : Subtract one from A. This is decremented *after* it is evaluated, so it will evaluate to A
native(140) static final postoperator byte -- ( out byte A );

ビット演算

ビット演算の概要については、WikiPedia を参照してください。

// ~A : bit flip A (one's complement)
// ~11001010 = 00110101
native(141) static final preoperator  int  ~  ( int A );

// A << B : Shift A left by B bits, fill bits on right with zeros
// 11001010 << 2 = 00101000
native(148) static final operator(22) int  << ( int A, int B );

// A >> B : Shift A right by B bits, fill bits on left with zeros
// 11001010 >> 2 = 00110010
native(149) static final operator(22) int  >> ( int A, int B );

// A >>> B : Same as right shift, as far as I know.
// 11001010 >> 2 = 00110010
native(196) static final operator(22) int  >>>( int A, int B );

// A & B : bitwise AND of A and B
// 11001010 & 11110000 = 11000000
native(156) static final operator(28) int  &  ( int A, int B );

// A ^ B : bitwise exclusive-OR of A and B
// 11001010 & 11110000 = 00111010
native(157) static final operator(28) int  ^  ( int A, int B );

// A | B : bitwise OR of A and B
// 11001010 & 11110000 = 11111010
native(158) static final operator(28) int  |  ( int A, int B );

整数演算子

// Integer operators.

// make negative
native(143) static final preoperator  int  -  ( int A );

// A * B : multiply A by B
native(144) static final operator(16) int  *  ( int A, int B );

// A / B : divide A by B
native(145) static final operator(16) int  /  ( int A, int B );

// A + B : add A to B
native(146) static final operator(20) int  +  ( int A, int B );

// A ? B : subtract B from A
native(147) static final operator(20) int  -  ( int A, int B );

// A < B : A less than B
native(150) static final operator(24) bool <  ( int A, int B );

// A > B : A greater than B
native(151) static final operator(24) bool >  ( int A, int B );

// A <= B : A less than or equal to B
native(152) static final operator(24) bool <= ( int A, int B );

// A >= B : A greater than or equal to B
native(153) static final operator(24) bool >= ( int A, int B );

// A == B : A is equal to B
native(154) static final operator(24) bool == ( int A, int B );

// A != B : A is not equal to B
native(155) static final operator(26) bool != ( int A, int B );

// A *= B : Multiply A by B and set A to the result
native(159) static final operator(34) int  *= ( out int A, float B );

// A /= B : Divide A by B and set A to the result
native(160) static final operator(34) int  /= ( out int A, float B );

// A += B : Add A to B and set A to the result
native(161) static final operator(34) int  += ( out int A, int B );

// A -= B : Subtract B from A and set A to the result
native(162) static final operator(34) int  -= ( out int A, int B );

// ++A : Add one to A.  This is incremented *before* it is evaluated, so it will evaluate to A+1
native(163) static final preoperator  int  ++ ( out int A );

// --A    : Subtract one from A. This is decremented *before it is evaluated, so it will evaluate to A-1
native(164) static final preoperator  int  -- ( out int A );

// A++    : Add one to A.  This is incremented *after* it is evaluated, so it will evaluate to A
native(165) static final postoperator int  ++ ( out int A );

// A--    : Subtract one from A. This is decremented *after* it is evaluated, so it will evaluate to A
native(166) static final postoperator int  -- ( out int A );

整数関数

// Integer functions.

// return a random number between 0 and (Max-1)
// Max should be a positive number, otherwise Rand consistently returns 0
native(167) static final Function     int  Rand  ( int Max );

// return A or B, whichever is smaller
native(249) static final function     int  Min   ( int A, int B );

// return A or B, whichever is larger
native(250) static final function     int  Max   ( int A, int B );

// Clamp V between A and B.  If V is between A and B, return V,
// if smaller, return the lower limit (either A or B)
// if larger, return the upper limit (either A or B)
native(251) static final function     int  Clamp ( int V, int A, int B );

浮動小数点数演算子

// Float operators.

// negate A.
native(169) static final preoperator  float -  ( float A );

// raise A to the power of B, or multiply A by itself, B times.
native(170) static final operator(12) float ** ( float A, float B );

// multiply A by B
native(171) static final operator(16) float *  ( float A, float B );

// divide A by B
native(172) static final operator(16) float /  ( float A, float B );

// return A modulo B, the remainder when you divide A by B
native(173) static final operator(18) float %  ( float A, float B );

// Add A and B
native(174) static final operator(20) float +  ( float A, float B );

// Subtract B from A
native(175) static final operator(20) float -  ( float A, float B );

// return whether A is less than B
native(176) static final operator(24) bool  <  ( float A, float B );

// return whether A is greater than B
native(177) static final operator(24) bool  >  ( float A, float B );

// return whether A is less than or equal to B
native(178) static final operator(24) bool  <= ( float A, float B );

// return whether A is greater than or equal to B
native(179) static final operator(24) bool  >= ( float A, float B );

// return whether A is equal to B
native(180) static final operator(24) bool  == ( float A, float B );

// return whether A is approximately (within 0.0001) equal to B
native(210) static final operator(24) bool  ~= ( float A, float B );


// return whether A is not equal B
native(181) static final operator(26) bool  != ( float A, float B );

// multiply A and B, set A to the result
native(182) static final operator(34) float *= ( out float A, float B );

// divide A by B, set A to the result
native(183) static final operator(34) float /= ( out float A, float B );

// Add A to B, set A to the result
native(184) static final operator(34) float += ( out float A, float B );

// Subtract B from A, set A to the result
native(185) static final operator(34) float -= ( out float A, float B );

浮動小数点数関数

// Float functions.
// Absolute value of A
native(186) static final function     float Abs   ( float A );

// sin(A) : Sine of A, expressed in radians.
native(187) static final function     float Sin   ( float A );

// Asin(A) : inverse sine of A expressed in radians.
native      static final function     float Asin  ( float A );

// cos(A) : cosine of A expressed in radians.
native(188) static final function     float Cos   ( float A );

// Acos(A) : inverse cosine of A expressed in radians.
native      static final function     float Acos  ( float A );

// tan(A) : tangent of A expressed in radians.
native(189) static final function     float Tan   ( float A );

// Atan(A) : inverse tangent of A/B expressed in radians.
native(190) static final function     float Atan  ( float A, float B );

// exp(A) : raise e to the A power
native(191) static final function     float Exp   ( float A );

// ln(A) : compute the natural log of A
native(192) static final function     float Loge  ( float A );

// sqrt(A): compute the square root of A
native(193) static final function     float Sqrt  ( float A );

// A*A, compute A multiplied by itself
native(194) static final function     float Square( float A );

// return a random number between 0 and 1
native(195) static final function     float FRand ();

// return either A or B, whichever is smaller
native(244) static final function     float FMin  ( float A, float B );

// return either A or B, whichever is larger
native(245) static final function     float FMax  ( float A, float B );

// Clamp V between A and B.  If V is between A and B, return V,
// if smaller, return the lower limit (either A or B)
// if larger, return the upper limit (either A or B)
native(246) static final function     float FClamp( float V, float A, float B );

// give a linear interpolation of Alpha between A and B
native(247) static final function     float Lerp  ( float Alpha, float A, float B );

// Returns an Alpha-smooth nonlinear interpolation between A and B.
native(248) static final function     float Smerp ( float Alpha, float A, float B );

ベクトル演算子

// Vector operators.

// negate the vector (multiply by -1)
native(211) static final preoperator  vector -     ( vector A );

// right-multiply a vector by a number
native(212) static final operator(16) vector *     ( vector A, float B );

// left-multiply a number by a vector
native(213) static final operator(16) vector *     ( float A, vector B );

// multiply two vectors
native(296) static final operator(16) vector *     ( vector A, vector B );

// divide a vector by a number
native(214) static final operator(16) vector /     ( vector A, float B );

// add two vectors
native(215) static final operator(20) vector +     ( vector A, vector B );

// subtract two vectors
native(216) static final operator(20) vector -     ( vector A, vector B );

// Forward vector transformation.  Rotate vector A forward by a rotator B (yaw, pitch, roll)
native(275) static final operator(22) vector <<    ( vector A, rotator B );

// Backward vector transformation.  Rotate vector A by backward a rotator B (yaw, pitch, roll)
native(276) static final operator(22) vector >>    ( vector A, rotator B );

// test for vector equality
native(217) static final operator(24) bool   ==    ( vector A, vector B );

// test for vector inequality
native(218) static final operator(26) bool   !=    ( vector A, vector B );

// compute dot product of two vectors
native(219) static final operator(16) float  Dot   ( vector A, vector B );

// compute cross product of two vectors
native(220) static final operator(16) vector Cross ( vector A, vector B );

// set A to result of right-multiply vector A by number B
native(221) static final operator(34) vector *=    ( out vector A, float B );

// set A to result of multiplying vectors A and B
native(297) static final operator(34) vector *=    ( out vector A, vector B );

// set A to result of dividing vector A by B
native(222) static final operator(34) vector /=    ( out vector A, float B );

// set A to result of adding vectors A and B
native(223) static final operator(34) vector +=    ( out vector A, vector B );

// set A to result of subtracting B from A
native(224) static final operator(34) vector -=    ( out vector A, vector B );

ベクトル関数

// Vector functions.

// Returns the euclidean size of the vector (the square root of the sum of the components squared).
native(225) static final function float  VSize  ( vector A );

// Returns a vector of size 1.0, facing in the direction of the specified vector.
native(226) static final function vector Normal ( vector A );

// Inverts a coordinate system specified by three axis vectors.
// Vectors X, Y, and Z specify an arbitrary coordinate system.  X, Y and Z are specified in terms of the "root" or "Euclidian"
// coordinate system.  Create a coordinate system that would map a point in the X,Y,Z system back into the "root" system.
native(227) static final function        Invert ( out vector X, out vector Y, out vector Z );

// Returns a uniformly distributed random vector.
native(252) static final function vector VRand  ( );

// Mirrors a vector about a specified normal vector.
native(300) static final function vector MirrorVectorByNormal( vector Vect, vector Normal );

ローテータの演算子と関数

ローテータとは、ヨー、ピッチ、およびロールを表すベクトルのことです。

// Rotator operators and functions.

// Tests for rotator equality
native(142) static final operator(24) bool ==     ( rotator A, rotator B );

// Tests for rotator inequality
native(203) static final operator(26) bool !=     ( rotator A, rotator B );

// right-multiply a rotator by a number
native(287) static final operator(16) rotator *   ( rotator A, float    B );

// left-multiply a rotator by a number
native(288) static final operator(16) rotator *   ( float    A, rotator B );

// divide a rotator by a number
native(289) static final operator(16) rotator /   ( rotator A, float    B );

// set A to the result of mutiplying a rotator A by B
native(290) static final operator(34) rotator *=  ( out rotator A, float B  );

// set B to the result of dividing a rotator A by B
native(291) static final operator(34) rotator /=  ( out rotator A, float B  );

// Add rotators A and B
native(316) static final operator(20) rotator +   ( rotator A, rotator B );

// Subtract rotator B from A
native(317) static final operator(20) rotator -   ( rotator A, rotator B );

// Set A to the result of adding rotators A and B
native(318) static final operator(34) rotator +=  ( out rotator A, rotator B );

// Set A to the result of subtracting B from A
native(319) static final operator(34) rotator -=  ( out rotator A, rotator B );

// ??
native(229) static final function GetAxes         ( rotator A, out vector X, out vector Y, out vector Z );

// ??
native(230) static final function GetUnAxes       ( rotator A, out vector X, out vector Y, out vector Z );

// Get a random rotator
native(320) static final function rotator RotRand ( optional bool bRoll );

// Return the orthogonal rotation based on the input vectors
native      static final function rotator OrthoRotation( vector X, vector Y, vector Z );

// return a normalized rotation
native      static final function rotator Normalize( rotator Rot );

// returns true if B is clockwise from A, rotators wrap around at 32768.
// this function can be used to determine if B is clockwise from A or not.
native      static final operator(24) bool ClockwiseFrom( int A, int B );

文字列の演算子と関数

文字列の演算子と関数の詳細については、StringsInUnrealScript を参照してください。

// String operators.

// concat A and B, result would be "AB"
native(112) static final operator(40) string $  ( coerce string A, coerce string B );

// concat A , " " and B, the result would be "A B"
native(168) static final operator(40) string @  ( coerce string A, coerce string B );

// string comparision
native(115) static final operator(24) bool   <  ( string A, string B );
native(120) static final operator(24) bool   <= ( string A, string B );
native(121) static final operator(24) bool   >= ( string A, string B );

// strings are equal
native(122) static final operator(24) bool   == ( string A, string B );

// case insensitive string compare
native(123) static final operator(26) bool   != ( string A, string B );

// strings are not equal (case insensitive)
native(124) static final operator(24) bool   ~= ( string A, string B );

// concat and assign: A $=B results in A = "AB"
native(322) static final operator(44) string $= ( out    string A, coerce string B );
native(323) static final operator(44) string @= ( out    string A, coerce string B );

// remove the B from A and assign it to A
native(324) static final operator(45) string -= ( out    string A, coerce string B );

// String functions.
// string length
native(125) static final function int    Len    ( coerce string S );

// returns the position of T in S, -1 if not found
native(126) static final function int    InStr  ( coerce string S, coerce string t );
native(127) static final function string Mid    ( coerce string S, int i, optional int j );
native(128) static final function string Left   ( coerce string S, int i );
native(234) static final function string Right  ( coerce string S, int i );

// byte to char
native(236) static final function string Chr    ( int i );
native(237) static final function int    Asc    ( string S );

// change the case of a string
native(235) static final function string Caps   ( coerce string S );
native(238) static final function string Locs   ( coerce string S);

// device("key=value", "=", "key", "value")
native(239) static final function bool   Divide ( coerce string Src, string Divider, out string LeftPart, out string RightPart);
// splits a string on divider, returns the number of elements
native(240) static final function int    Split  ( coerce string Src, string Divider, out array<string> Parts );

// compare two strings, count is the nubber of characters to compare (if count = 0 this is the same as the == operator)
native(200)  static final function int    StrCmp ( coerce string S, coerce string T, optional int Count, optional bool bCaseSensitive );

// replace substrings
native(201)  static final function string Repl   ( coerce string Src, coerce string Match, coerce string With, optional bool bCaseSensitive );

// if condition is true return ResultIfTrue otherwise ResultIfFalse
native(202)  static final function string Eval   ( bool Condition, coerce string ResultIfTrue, coerce string ResultIfFalse );

オブジェクト演算子

// Object operators.

// Generic equality operator for objects.
native(114) static final operator(24) bool == ( Object A, Object B );

// Generic inequality operator for objects
native(119) static final operator(26) bool != ( Object A, Object B );

名前演算子

// Name operators.
// Returns whether the names are equal
native(254) static final operator(24) bool == ( name A, name B );

// Returns whether the names are different
native(255) static final operator(26) bool != ( name A, name B );

補間曲線関数

補間曲線に対して使用します。

// InterpCurve operator

// returns the output value for the given input
native      static final function float InterpCurveEval( InterpCurve curve, float input );

// get the min and max output value
native      static final function InterpCurveGetOutputRange( InterpCurve curve, out float min, out float max );

// get the min and max input value that can be used
native      static final function InterpCurveGetInputDomain( InterpCurve curve, out float min, out float max );

クォータニオン関数

// Quaternion functions

// Returns the product of two quaternions.
native      static final function Quat QuatProduct( Quat A, Quat B );

// Inverts the quaternion
native      static final function Quat QuatInvert( Quat A );

// Applies quaternion A to vector B, return resulting vector
native      static final function vector QuatRotateVector( Quat A, vector B );

// Computes the quaternion that will rotate vector A to vector B
native      static final function Quat QuatFindBetween( Vector A, Vector B );

// Convert an axis and angle to a quaternion
native      static final function Quat QuatFromAxisAndAngle( Vector Axis, Float Angle );

// Convert a rotator to a quaternion
native      static final function Quat QuatFromRotator( rotator A );

// Convert a quaternion to a rotator
native      static final function rotator QuatToRotator( Quat A );

汎用関数

//=============================================================================
// General functions.

ログ

// Logging.
// Logs the string S, using debugf, prepended by the tag _Tag_
native(231) final static function Log( coerce string S, optional name Tag );

// Creates a warning in the log file. A warning message contains the Class name and line where the warning was issued.
native(232) final static function Warn( coerce string S );

// Looks up the localized version of a string (translated into the local language)
native static function string Localize( string SectionName, string KeyName, string PackageName );

状態への移行とラベル

// Goto state and label.
// Redirects code flow to the new state
native(113) final function GotoState( optional name NewState, optional name Label );

// returns whether the code is in a certain state.
native(281) final function bool IsInState( name TestState );

// return the name of the state UnrealScript is currently in.
native(284) final function name GetStateName();

オブジェクト

// Objects.

// Return whether _TestClass_ inherits from _ParentClass_
native(258) static final function bool ClassIsChildOf( class TestClass, class ParentClass );

// Return whether this object inherits from _ClassName_
// This function will bubble up the class tree (parent classes) of the this object add check if
// ClassName matches the (parent) classname. ClassName will never be instantiated.
native(303) final function bool IsA( name ClassName );

メッセージの調査

// Probe messages.

// Allow a type of message to be passed into UnrealScript, (e.g. Enable( 'Tick' );)
native(117) final function Enable( name ProbeFunc );

// Filter out type of message to be passed into UnrealScript, (e.g. Enable( 'Tick' );)
native(118) final function Disable( name ProbeFunc );

プロパティ

// Properties.

// Finds _PropName_ amoungst the packages, and returns it's value
native final function string GetPropertyText( string PropName );

// Find _PropName_ amoungst the packages, set it's value to _PropValue_
native final function SetPropertyText( string PropName, string PropValue );

// Returns the name of the enum value
// GetEnum(enum'EDetailMode', 1) will return 'DM_High'pumk
native static final function name GetEnum( object E, int i );

// Load an object: (e.g. HudClass = class<HUD>(DynamicLoadObject(HUDType, class'Class')); )
native static final function object DynamicLoadObject( string ObjectName, class ObjectClass, optional bool MayFail );

// Finds _ObjectName_ amoungst the packages.
native static final function object FindObject( string ObjectName, class ObjectClass );

設定

SaveConfiguration を参照してください。

// Configuration.
// Saves object configurations to .ini files.
native(536) final function SaveConfig();

// Saves object configurations to .ini files.
// StaticSaveConfig() on a class variable will write the objects _default_ values to the ini file.
native static final function StaticSaveConfig();

// Remove the configuration entries for this class (or only this property) from the ini file.
// If the resulting ini is empty it will be deleted.
native(537) final function ClearConfig( optional string PropName );
native static final function StaticClearConfig( optional string PropName );

// Reloads a previously saved configuration
native static final function ResetConfig( optional string PropName );

// return the names of PerObject configurations
native static final function array<string> GetPerObjectNames( string ININame, optional string ObjectClass,
    optional int MaxResults /*1024 if unspecified*/ );

範囲内の乱数

// Return a random number within the given range.
final function float RandRange( float Min, float Max )
{
    return Min + (Max - Min) * FRand();
}

エンジン通知関数

//=============================================================================
// Engine notification functions.

状態の開始

//
// Called immediately when entering a state, while within
// the GotoState call that caused the state change.
//
event BeginState();

状態の終了

//
// Called immediately before going out of the current state,
// while within the GotoState call that caused the state change.
//
event EndState();

defaultproperties
{
}