aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2016-10-17 20:36:38 +0100
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-17 22:03:49 +0200
commit0d740c5d829bceda8500fc505f4a65b967a1c151 (patch)
tree61b4dffb3c718379fe6391e5ea450fce4c0ff289 /builtin
parenta291cd61320c2d041d64ed2d56d073d70066efd1 (diff)
downloadminetest-0d740c5d829bceda8500fc505f4a65b967a1c151.tar.gz
minetest-0d740c5d829bceda8500fc505f4a65b967a1c151.tar.bz2
minetest-0d740c5d829bceda8500fc505f4a65b967a1c151.zip
Builtin: Add vector.floor helper function
Diffstat (limited to 'builtin')
-rw-r--r--builtin/common/vector.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua
index e9ed3aab3..90ba3cc8b 100644
--- a/builtin/common/vector.lua
+++ b/builtin/common/vector.lua
@@ -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
-