magic numbers

This commit is contained in:
James Pollack 2015-09-30 11:31:33 -07:00
parent 8bdf428f41
commit 0865f94106

View file

@ -15,14 +15,21 @@
var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav'; var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav';
function PingPongGun() { function PingPongGun() {
return; return;
} }
//if the trigger value goes below this value, reload the gun. //if the trigger value goes below this value, reload the gun.
var RELOAD_THRESHOLD = 0.95; var RELOAD_THRESHOLD = 0.95;
var GUN_TIP_FWD_OFFSET = -0.056; var GUN_TIP_FWD_OFFSET = -0.08;
var GUN_TIP_UP_OFFSET = 0.001; var GUN_TIP_UP_OFFSET = 0.020;
var GUN_FORCE = 5;
var BALL_GRAVITY = {
x: 0,
y: -1,
z: 0
};
PingPongGun.prototype = { PingPongGun.prototype = {
hand: null, hand: null,
@ -79,7 +86,7 @@
shootBall: function(gunProperties) { shootBall: function(gunProperties) {
var forwardVec = Quat.getFront(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 90, 0))); var forwardVec = Quat.getFront(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 90, 0)));
forwardVec = Vec3.normalize(forwardVec); forwardVec = Vec3.normalize(forwardVec);
forwardVec = Vec3.multiply(forwardVec, 2); forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
var properties = { var properties = {
type: 'Sphere', type: 'Sphere',
color: { color: {
@ -93,11 +100,7 @@
z: 0.02 z: 0.02
}, },
linearDamping: 0.2, linearDamping: 0.2,
gravity: { gravity: BALL_GRAVITY,
x: 0,
y: -0.05,
z: 0
},
collisionsWillMove: true, collisionsWillMove: true,
collisionSoundURL: SHOOTING_SOUND_URL, collisionSoundURL: SHOOTING_SOUND_URL,
rotation: gunProperties.rotation, rotation: gunProperties.rotation,