神岛 API 文档 - ArenaPro版
    Preparing search index...

    表示用于游戏开发的三维向量。该类提供了多种3D向量数学运算,包括加法、减法、乘法、除法、点积、叉积和向量插值。

    Represents a three-dimensional vector for game development. This class provides various 3D vector mathematical operations, including addition, subtraction, multiplication, division, dot product, cross product, and vector interpolation.

    Index

    Constructors

    • Parameters

      • x: number
      • y: number
      • z: number

      Returns GameVector3

      创建一个新的GameVector3实例。

      Creates a new GameVector3 instance.

      向量的x分量。

      The x component of the vector.

      向量的y分量。

      The y component of the vector.

      向量的z分量。

      The z component of the vector.

    Properties

    x: number

    向量的 x 分量。

    The x component of the vector.

    y: number

    向量的 y 分量。

    The y component of the vector.

    z: number

    向量的 z 分量。

    The z component of the vector.

    Methods

    • Parameters

      Returns number

      计算此向量与另一个向量之间的夹角。

      Calculates the angle between this vector and another vector.

      另一个向量。

      The other vector.

      夹角(弧度)。

      The angle in radians.

    • Parameters

      Returns number

      计算此向量与另一个向量之间的距离。

      Calculates the distance between this vector and another vector.

      另一个向量。

      The other vector.

      距离。

      The distance.

    • Parameters

      Returns GameVector3

      按分量将此向量与另一个向量相除并更新此向量。

      Divides this vector by another vector component-wise and updates this vector.

      要相除的向量。

      The vector to divide by.

      本向量,用于链式操作。

      This vector, for chaining.

    • Parameters

      Returns number

      计算此向量与另一个向量的点积。

      Calculates the dot product of this vector with another vector.

      另一个向量。

      The other vector.

      点积。

      The dot product.

    • Parameters

      Returns boolean

      检查此向量是否近似(误差值:0.000001)等于另一个向量。

      Checks if this vector is approximately equal to another vector (error value: 0.000001).

      另一个向量。

      The other vector.

      如果向量近似相等则返回true,否则返回false。

      Returns true if the vectors are approximately equal, otherwise false.

    • Parameters

      Returns boolean

      检查此向量是否完全等于另一个向量。

      Checks if this vector is exactly equal to another vector.

      另一个向量。

      The other vector.

      如果向量完全相等则返回true,否则返回false。

      Returns true if the vectors are exactly equal, otherwise false.

    • Parameters

      Returns GameVector3

      线性插值此向量朝向另一个向量。

      Linear interpolation of this vector towards another vector.

      目标向量。

      The target vector.

      插值因子。

      The interpolation factor.

      本向量,用于链式操作。

      This vector, for chaining.

    • Returns number

      计算此向量的模长。

      Calculates the magnitude of this vector.

      模长。

      The magnitude.

    • Parameters

      Returns GameVector3

      按分量将此向量与另一个向量相乘并更新此向量。

      Multiplies this vector with another vector component-wise and updates this vector.

      要相乘的向量。

      The vector to multiply by.

      本向量,用于链式操作。

      This vector, for chaining.

    • Parameters

      • x: number
      • y: number
      • z: number

      Returns GameVector3

      设置此向量的分量。

      Sets the components of this vector.

      新的x分量。

      The new x component.

      新的y分量。

      The new y component.

      新的z分量。

      The new z component.

      本向量,用于链式操作。

      This vector, for chaining.

    • Returns number

      计算此向量的模长平方。

      Calculates the squared magnitude of this vector.

      模长平方。

      The squared magnitude.

    • Returns string

      将此向量转换为字符串。

      Converts this vector to a string.

      此向量的字符串表示形式。

      The string representation of this vector.

    • Parameters

      Returns GameVector3

      计算并返回指向目标位置的向量。

      Calculates and returns a vector pointing towards the target position.

      目标位置的三维向量,表示目标点在游戏世界中的坐标。

      The 3D vector of the target position, representing the coordinates of the target point in the game world.

      返回一个从当前点指向目标点的三维向量。

      Returns a 3D vector pointing from the current point to the target point.

    • Parameters

      • mag: number
      • phi: number
      • theta: number

      Returns GameVector3

      从极坐标创建一个新的GameVector3对象。

      Creates a new GameVector3 object from polar coordinates.

      向量的模长。

      The magnitude of the vector.

      xy平面上的角度(方位角)。

      The angle in the xy-plane (azimuth).

      z轴上的角度(极角)。

      The angle from the z-axis (polar angle).

      新的GameVector3对象。

      A new GameVector3 object.