added round to Pos3

This commit is contained in:
Djeeberjr 2023-04-01 03:26:42 +02:00
parent 4a7b57c47f
commit df39865c3d

View File

@ -96,4 +96,12 @@ abstract Pos3(Vec3<Float>) from Vec3<Float> to Vec3<Float>{
public function toString():String { public function toString():String {
return 'Pos3(${this.x}, ${this.y}, ${this.z})'; 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)
});
}
} }