我的世界开发日志2——什么是Vector3

Vector 是向量,矢量的意思,向量既有大小,又有方向,Verctor3 就是三维向量,一个三维向量会有三个分量,分别是 x,y,z,在 Unity 中每一个游戏对象都至少会有一个组件叫 Transform,Transform 主要用来控制游戏对象的位置,旋转和缩放。 

Vector3向量既可以用来表示位置,也可以用来表示方向。在数学与物理中,既有大小又有方向的量叫做向量(亦称矢量),与标量相对。

Variables变量

  • x
    X component of the vector.
    向量的X组件。
  • y
    Y component of the vector.
    向量的Y组件。
  • z
    Z component of the vector.
    向量的Z组件。
  • Access the x, y, z components using [0], [1], [2] respectively.
    使用[0], [1], [2]分别访问组件x, y, z组件。简单来说就是用索引号代替x, y, z组件。
  • Returns this vector with a magnitude of 1 (Read Only).
    返回向量的长度为1(只读)。
  • Returns the length of this vector (Read Only).
    返回向量的长度(只读)。
  • Returns the squared length of this vector (Read Only).
    返回这个向量的长度的平方(只读)。

Constructors构造器

  • Creates a new vector with given x, y, z components.
    创建一个新的具有给定x, y, z组件的向量。

Functions函数

  • Multiplies every component of this vector by the same component of scale.
    由缩放的相同的组件对应乘以这个矢量的每个组件。
  • Makes this vector have a magnitude of 1.
    使向量的长度为1。
  • Returns a nicely formatted string for this vector.
    返回此向量格式化的字符串。

Class Variables类变量

Class Functions类函数

  • Linearly interpolates between two vectors.
    两个向量之间的线性插值。
  • Spherically interpolates between two vectors.
    球形插值在两个向量之间。
  • Makes vectors normalized and orthogonal to each other.
    使向量规范化并且彼此相互垂直。
  • Moves a point current towards target.
    当前的地点移向目标。
  • Rotates a vector current towards target.
    当前的向量转向目标。
  • Gradually changes a vector towards a desired goal over time.
    随着时间的推移,逐渐改变一个向量朝向预期的目标。
  • Multiplies two vectors component-wise.
    两个矢量组件对应相乘。
  • Cross Product of two vectors.
    两个向量的交叉乘积。返回lhs x rhs
  • Reflects the vector along the normal.
    沿着法线反射向量。
  • Dot
    Dot Product of two vectors.
    两个向量的点乘积。
  • Projects a vector onto another vector.
    投影一个向量到另一个向量。
  • Returns the angle in degrees between from and to.
    由from和to两者返回一个角度。
  • Returns the distance between a and b.
    返回a和b之间的距离。
  • Returns a copy of vector with its magnitude clamped to maxLength.
    返回向量的长度,最大不超过maxLength所指示的长度。
  • Min
    Returns a vector that is made from the smallest components of two vectors.
    返回一个由两个向量的最小组件组成的向量。
  • Max
    Returns a vector that is made from the largest components of two vectors.
    返回一个由两个向量的最大组件组成的向量。
  • Adds two vectors.
    两个向量相加。
  • Subtracts one vector from another.
    一个向量减另一个向量。
  • Multiplies a vector by a number.
    由一个数乘以一个向量。
  • Divides a vector by a number.
    由一个数除一个向量。也就是a/b。
  • Returns true if the vectors are equal.
    如果两个向量相等,返回真。
  • Returns true if vectors different.
    如果向量不同返回真。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值