mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Builtin: Add vector.floor helper function
This commit is contained in:
parent
a291cd6132
commit
0d740c5d82
2 changed files with 10 additions and 2 deletions
|
@ -31,6 +31,14 @@ function vector.normalize(v)
|
|||
end
|
||||
end
|
||||
|
||||
function vector.floor(v)
|
||||
return {
|
||||
x = math.floor(v.x),
|
||||
y = math.floor(v.y),
|
||||
z = math.floor(v.z)
|
||||
}
|
||||
end
|
||||
|
||||
function vector.round(v)
|
||||
return {
|
||||
x = math.floor(v.x + 0.5),
|
||||
|
@ -130,4 +138,3 @@ function vector.divide(a, b)
|
|||
z = a.z / b}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue