主题
Vector3int16
三维整数向量,使用 16 位整数存储 X、Y、Z 分量。常用于表示网格坐标、区块索引或离散空间位置,确保数值为整数且范围受限于 16 位。
概览
三维整数向量,使用 16 位整数存储 X、Y、Z 分量。常用于表示网格坐标、区块索引或离散空间位置,确保数值为整数且范围受限于 16 位。
可通过
Vector3int16.New(x, y, z)构造
代码示例
构造 Vector3int16 并读写分量
lua
-- @runtime client
local vec = Vector3int16.New(10, 20, 30)
print(string.format('x=%d y=%d z=%d', vec.x, vec.y, vec.z))
vec.x = vec.x + 1
vec.y = vec.y + 2
vec.z = vec.z + 3
print(string.format('updated: x=%d y=%d z=%d', vec.x, vec.y, vec.z))属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
x | Int | - | Vector3int16 的 X 分量,整数类型。 |
y | Int | - | Vector3int16 的 Y 分量,整数类型。 |
z | Int | - | Vector3int16 的 Z 分量,整数类型。 |
