unity api中文手册_unity 中文API之Vector3

2022-10-24 14:36:26

Vector3 三维向量


Description 描述

Representation of 3D vectors and points.


This structure is used throughout Unity to pass 3D positions and directions around. It also contains functions for doing common vector operations.


Besides the functions listed below, other classes can be used to manipulate vectors and points as well. For example the Quaternion and the Matrix4x4 classes are useful for rotating or transforming vectors and points.


Static Variables 静态变量

back Shorthand for writing Vector3(0, 0, -1).

写Vector3(0, 0, -1)的简码。 down Shorthand for writing Vector3(0, -1, 0).

写Vector3(0, -1, 0)的简码。 forward Shorthand for writing Vector3(0, 0, 1).

写Vector3(0, 0, 1)的简码,也就是向z轴。 left Shorthand for writing Vector3(-1, 0, 0).

写Vector3(-1, 0, 0)的简码。 one Shorthand for writing Vector3(1, 1, 1).

写Vector3(1, 1, 1)的简码。 right Shorthand for writing Vector3(1, 0, 0).

写Vector3(1, 0, 0)的简码,也就是向x轴。 up Shorthand for writing Vector3(0, 1, 0).

写Vector3(0, 1, 0)的简码,也就是向y轴 zero Shorthand for writing Vector3(0, 0, 0).

写Vector3(0, 0, 0)的简码。

Variables 变量

magnitude Returns the length of this vector (Read Only).

返回向量的长度(只读)。 normalized Returns this vector with a magnitude of 1 (Read Only).

返回长度为1的该向量(只读)。 sqrMagnitude Returns the squared length of this vector (Read Only).

返回这个向量的长度的平方(只读)。 this[int] Access the x, y, z components using [0], [1], [2] respectively.

使用[0], [1], [2]分别访问组件x, y, z组件。简单来说就是用索引号代替x, y, z组件。 x X component of the vector.

向量的X组件。 y Y component of the vector.

向量的Y组件。 z Z component of the vector.


Constructors 构造器

Vector3 Creates a new vector with given x, y, z components.

创建一个新的具有给定x, y, z组件的向量。

Functions 函数

Set Set x, y and z components of an existing Vector3.

设置现有的Vector3的x、y、z组件 ToString Returns a nicely formatted string for this vector.


Static Functions 静态函数

Angle Returns the angle in degrees between from and to.

由from和to两者返回一个角度。 ClampMagnitude Returns a copy of vector with its magnitude clamped to maxLength.

返回向量的长度,最大不超过maxLength所指示的长度。 Cross Cross Product of two vectors.

两个向量的交叉乘积。返回lhs x rhs。 Distance Returns the distance between a and b.

返回a和b之间的距离。 Dot Dot Product of two vectors.

两个向量的点乘积。 Lerp Linearly interpolates between two vectors.

两个向量之间的线性插值。 LerpUnclamped Linearly interpolates between two vectors.

两个向量之间的线性插值。改插值t在小于0或大于1时的返回值不会被限制。 Max Returns a vector that is made from the largest components of two vectors.

返回一个由两个向量的最大组件组成的向量。 Min Returns a vector that is made from the smallest components of two vectors.

返回一个由两个向量的最小组件组成的向量。 MoveTowards Moves a point current in a straight line towards a target point.

当前的地点移向目标。 Normalize Makes this vector have a magnitude of 1.

使向量的长度为1。 OrthoNormalize Makes vectors normalized and orthogonal to each other.

使向量规范化并且彼此相互垂直。 Project Projects a vector onto another vector.

投影一个向量到另一个向量。 ProjectOnPlane Projects a vector onto a plane defined by a normal orthogonal to the plane.

投影向量到一个平面上由垂直到该平面的法线定义。 Reflect Reflects a vector off the plane defined by a normal.

沿着法线反射向量。 RotateTowards Rotates a vector current towards target.

当前的向量转向目标。 Scale Multiplies two vectors component-wise.

两个矢量组件对应相乘。 Slerp Spherically interpolates between two vectors.

在两个向量之间球形插值。 SlerpUnclamped Spherically interpolates between two vectors.

在两个向量之间球形插值。改插值t在小于0或大于1时的返回值不会被限制。 SmoothDamp Gradually changes a vector towards a desired goal over time.


  • 作者:weixin_39524574
  • 原文链接:https://blog.csdn.net/weixin_39524574/article/details/111119858
    更新时间:2022-10-24 14:36:26