Skip to content

格式

typescript
Vector3.Get(index)

所属类: Vector3

描述

获取当前 Vector3 的 x、y 和 z 分量。

参数

参数名类型描述
indexnumber向量索引

返回值

类型描述
number向量的分量

代码示例

typescript
let a = new Vector3(1,2,3);
 //获取向量的X分量
Debug.Log("a x is:",a.Get(0));
  //获取向量的Y分量
Debug.Log("a y is:",a.Get(1));
//获取向量的Z分量
Debug.Log("a z is:",a.Get(2));