Fixed bug in spray paint where sometimes would not spray

This commit is contained in:
ericrius1 2015-10-01 16:10:29 -07:00
parent 0fb51a6777
commit 407b6b8158

View file

@ -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);
}