From 977bbb4ec03a79d86d0e60c490ddf9042d7e9095 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Wed, 20 Dec 2023 09:42:49 +0300 Subject: [PATCH] Use Vec3.zero() --- cube.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cube.js b/cube.js index dbb3264..45a6cf5 100644 --- a/cube.js +++ b/cube.js @@ -8,7 +8,7 @@ class Vec3 { } static zero() { - return new Vec(0, 0, 0); + return new Vec3(0, 0, 0); } length() { @@ -90,7 +90,7 @@ class Quat { let friction = 3; let sensitivity = 0.01; -let velocity = new Vec3(0, 0, 0); +let velocity = Vec3.zero(); const orientation = { __cube: document.querySelector(".cube"), @@ -115,7 +115,7 @@ const orientation = { previous: null, }; - let impulseThisFrame = new Vec3(0, 0, 0); + let impulseThisFrame = Vec3.zero(); const handleUp = () => { mouse.down = false; @@ -130,7 +130,7 @@ const orientation = { mouse.down = true; - velocity = new Vec3(0, 0, 0); + velocity = Vec3.zero(); }; document.addEventListener("mousedown", handleDown); @@ -187,7 +187,7 @@ const orientation = { if (mouse.down) { velocity = impulseThisFrame.scale(1 / delta); - impulseThisFrame = new Vec3(0, 0, 0); + impulseThisFrame = Vec3.zero(); } else { const decay = Math.exp(-delta * friction);