From 407b6b8158b34dc1a729cb15e2f2bc90f78ae5f3 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 1 Oct 2015 16:10:29 -0700 Subject: [PATCH] Fixed bug in spray paint where sometimes would not spray --- examples/toys/sprayPaintCan.js | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/examples/toys/sprayPaintCan.js b/examples/toys/sprayPaintCan.js index 4716885ac3..0de95f5d93 100644 --- a/examples/toys/sprayPaintCan.js +++ b/examples/toys/sprayPaintCan.js @@ -101,6 +101,7 @@ this.disableStream = function() { Entities.deleteEntity(this.paintStream); this.paintStream = null; + this.spraying = false; this.sprayInjector.stop(); } @@ -145,35 +146,3 @@ }); } }); - - - -function randFloat(min, max) { - return Math.random() * (max - min) + min; -} - -function randInt(min, max) { - return Math.floor(Math.random() * (max - min)) + min; -} - -function orientationOf(vector) { - var Y_AXIS = { - x: 0, - y: 1, - z: 0 - }; - var X_AXIS = { - x: 1, - y: 0, - z: 0 - }; - - var theta = 0.0; - - var RAD_TO_DEG = 180.0 / Math.PI; - var direction, yaw, pitch; - direction = Vec3.normalize(vector); - yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS); - pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS); - return Quat.multiply(yaw, pitch); -} \ No newline at end of file