@minecraft
    正在准备搜索索引...

    类 Vector3Builder

    Vector3 wrapper class which can be used as a Vector3 for APIs on @minecraft/server which require a Vector, but also contain additional helper methods. This is an alternative to using the core Vector 3 utility methods directly, for those who prefer a more object-oriented approach. This version of the class is mutable and changes state inline.

    For an immutable version of the build, use ImmutableVector3Builder.

    用于 @minecraft/server 中需要用到三维向量的 API 的 Vector3 包装类,同时也包含额外的帮助方法。 这是对直接使用核心 Vector 3 实用方法的一种替代,适用于偏好面向对象方法的人。 此类的该版本是可变的,并且在内联中会更改状态。

    若要使用构建的不可变版本,请使用 ImmutableVector3Builder。

    实现

    索引

    构造函数

    属性

    x: number

    X component of this vector.

    y: number

    Y component of this vector.

    z: number

    Z component of this vector.

    方法

    • add

      Adds the vector v to this, returning itself.

      将向量 v 加到当前向量上,返回自身。

      参数

      返回 this

    • Assigns the values of the passed in vector to this vector. Returns itself.

      将传入向量的值赋给此向量。返回自身。

      参数

      返回 this

    • clamp

      Clamps the components of a vector to limits to produce a new vector

      将向量的各个分量钳制在一定范围内,生成新的向量。

      参数

      返回 this

    • cross

      Computes the cross product of this and the passed in vector, returning itself.

      计算此向量与传入向量的叉积,返回自身。

      参数

      返回 this

    • dot

      Computes the dot product of this and the passed in vector.

      计算此向量与传入向量的点积。

      参数

      返回 number

    • floor

      Floor the components of a vector to produce a new vector

      对向量的各个分量向下取整,生成新的向量。

      返回 this

    • lerp

      Constructs a new vector using linear interpolation on each component from two vectors.

      使用在两个向量的每个分量上的线性插值构造新的向量。

      参数

      返回 this

    • magnitude

      The magnitude of the vector

      返回向量的模长。

      返回 number

    • normalize

      Normalizes this vector, returning itself.

      归一化此向量,返回自身。

      返回 this

    • rotateX

      Rotates the vector around the x axis counterclockwise (left hand rule)

      参数

      • a: number

        Angle in radians

      返回 this

    • rotateY

      Rotates the vector around the y axis counterclockwise (left hand rule)

      参数

      • a: number

        Angle in radians

      返回 this

    • rotateZ

      Rotates the vector around the z axis counterclockwise (left hand rule)

      参数

      • a: number

        Angle in radians

      返回 this

    • scale

      Scales this by the passed in value, returning itself.

      使用传入的值数乘此向量,返回自身。

      参数

      • val: number

      返回 this

    • slerp

      Constructs a new vector using spherical linear interpolation on each component from two vectors.

      使用在两个向量的每个分量上的球面线性插值构造新的向量。

      参数

      返回 this

    • subtract

      Subtracts the vector v from this, returning itself.

      从此向量减去向量 v ,返回自身。

      参数

      返回 this

    • toString

      Create a string representation of a vector

      以指定的格式返回向量的字符串表示。

      参数

      • 可选options: { decimals?: number; delimiter?: string }

      返回 string