unity获取物件组件常用方法总结(unity中文API之Vector4)

Vector4 四维向量

unity获取物件组件常用方法总结(unity中文API之Vector4)(1)

Vector4

struct in UnityEngine

Description 描述

Representation of four-dimensional vectors.

表示四维的向量。

This structure is used in some places to represent four component vectors (e.g. mesh tangents, parameters for shaders). In the majority of other cases a Vector3 is used.

这种结构在一些地方表示四个组件的向量(例如:网格切线,着色器参数等)。大多数情况下使用Vector3。

Static Variables 静态变量

one Shorthand for writing Vector4(1,1,1,1).

Vector4(1,1,1,1)的缩写。 zero Shorthand for writing Vector4(0,0,0,0).

Vector4(0,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, w components using [0], [1], [2], [3] respectively.

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

向量的W组件。 x X component of the vector.

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

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

向量的Z组件。

Constructors 构造器

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

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

Public Functions 公共函数

Set Set x, y, z and w components of an existing Vector4.

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

返回此向量格式化的字符串。

Static Functions 静态函数

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.

在两个向量之间插值。 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 towards target.

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

使该向量的长度为一。 Project Projects a vector onto another vector.

一个向量投影到另一个向量。 Scale Multiplies two vectors component-wise.

两个向量组件对应相乘。

operators 运算符

operator - Subtracts one vector from another.

两向量相减。 operator != Returns true if vectors different.

如果两向量不相等返回true。 operator * Multiplies a vector by a number.

向量与数字相乘。 operator / Divides a vector by a number.

a向量除以数字 operator Adds two vectors.

两向量相加。 operator == Returns true if the vectors are equal.

如果向量相等,返回真。 Vector2 Converts a Vector4 to a Vector2.

四维向量转换为二维向量。 Vector3 Converts a Vector4 to a Vector3.

四维向量转换为三维向量。 Vector3 To Vector4 Converts a Vector3 to a Vector4.

三维向量转换为四维向量。 Vector2 To Vector4 Converts a Vector2 to a Vector4.

二维向量转换为四维向量。

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页