Skip to content

格式

typescript
Vector4.Get(index)

所属类: Vector4

描述

根据给定的索引值,返回当前向量对象中对应索引位置的分量值。

参数

参数名类型描述
indexnumber指定的索引位置,可取值为 [0, 3]。

返回值

类型描述
number当前向量对象在指定索引位置的分量值。

代码示例

typescript
let lhs = new Vector4(1, 2, 3, 4);
Debug.Log(lhs.Get(0)); // 1
Debug.Log(lhs.Get(1)); // 2
Debug.Log(lhs.Get(2)); // 3
Debug.Log(lhs.Get(3)); // 4