From df39865c3de4f2356669cfec163858035e967256 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Sat, 1 Apr 2023 03:26:42 +0200 Subject: [PATCH] added round to Pos3 --- src/lib/Pos3.hx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/Pos3.hx b/src/lib/Pos3.hx index eb236f9..104d245 100644 --- a/src/lib/Pos3.hx +++ b/src/lib/Pos3.hx @@ -96,4 +96,12 @@ abstract Pos3(Vec3) from Vec3 to Vec3{ public function toString():String { return 'Pos3(${this.x}, ${this.y}, ${this.z})'; } + + public function round():Pos3 { + return new Pos3({ + x: Math.fround(this.x), + y: Math.fround(this.y), + z: Math.fround(this.z) + }); + } }