Cleanup print statements in pitching.js

This commit is contained in:
Ryan Huffman 2015-11-06 10:04:19 -08:00
parent 7da611d44b
commit d5336db039

View file

@ -68,6 +68,7 @@ var AUDIO = {
var PITCH_THUNK_SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav";
var pitchSound = SoundCache.getSound(PITCH_THUNK_SOUND_URL, false);
updateBillboard("");
var PITCHING_MACHINE_URL = "atp:87d4879530b698741ecc45f6f31789aac11f7865a2c3bec5fe9b061a182c80d4.fbx";
var PITCHING_MACHINE_OUTPUT_OFFSET_PCT = {
@ -147,22 +148,17 @@ PitchingMachine.prototype = {
print("Pitching ball");
var pitchDirection = { x: 0, y: 0, z: 1 };
var machineProperties = Entities.getEntityProperties(this.pitchingMachineID, ["dimensions", "position", "rotation"]);
//print("PROPS");
//print("props ", JSON.stringify(machineProperties));
var pitchFromPositionBase = machineProperties.position;
var pitchFromOffset = vec3Mult(machineProperties.dimensions, PITCHING_MACHINE_OUTPUT_OFFSET_PCT);
pitchFromOffset = Vec3.multiplyQbyV(machineProperties.rotation, pitchFromOffset);
var pitchFromPosition = Vec3.sum(pitchFromPositionBase, pitchFromOffset);
var pitchDirection = Quat.getFront(machineProperties.rotation);
var ballScale = machineProperties.dimensions.x / PITCHING_MACHINE_PROPERTIES.dimensions.x;
print("Creating baseball");
var speed = randomFloat(BASEBALL_MIN_SPEED, BASEBALL_MAX_SPEED);
var velocity = Vec3.multiply(speed, pitchDirection);
this.baseball = new Baseball(pitchFromPosition, velocity, ballScale);
Vec3.print("vel", velocity);
Vec3.print("pos", pitchFromPosition);
if (!this.injector) {
this.injector = Audio.playSound(pitchSound, {
@ -193,7 +189,6 @@ PitchingMachine.prototype = {
if (this.baseball) {
this.baseball.update(dt);
if (this.baseball.finished()) {
print("BALL IS FINISHED");
this.baseball = null;
var self = this;
Script.setTimeout(function() { self.pitchBall() }, 3000);
@ -316,7 +311,6 @@ function ObjectTrail(entityID, startPosition) {
this.line = null;
var lineInterval = null;
print("Creating Trail!");
var lastPosition = startPosition;
trail = new InfiniteLine(startPosition, trailColor, trailLifetime);
trailInterval = Script.setInterval(function() {
@ -356,7 +350,6 @@ function cleanupTrail() {
function setupTrail(entityID, position) {
cleanupTrail();
print("Creating Trail!");
var lastPosition = position;
trail = new InfiniteLine(position, { red: 128, green: 255, blue: 89 }, 20);
trailInterval = Script.setInterval(function() {
@ -488,7 +481,6 @@ Baseball.prototype = {
});
var name = Entities.getEntityProperties(entityB, ["name"]).name;
print("Hit: " + name);
if (name == "Bat") {
if (this.state == BASEBALL_STATE.PITCHING) {
print("HIT");
@ -533,9 +525,10 @@ Baseball.prototype = {
volume: 1.0
});
}, 500);
if (foul) {
print("FOUL, yaw: ", yaw);
updateBillboard("FOUL");
print("FOUL ", yaw)
this.state = BASEBALL_STATE.FOUL;
playRandomSound(AUDIO.foul, {
position: myPosition,
@ -547,14 +540,13 @@ Baseball.prototype = {
}
}
} else if (name == "stadium") {
//iprint("PARTICLES");
//entityCollisionWithGround(entityB, this.entityID, collision);
this.landed = true;
} else if (name == "backstop") {
if (this.state == BASEBALL_STATE.PITCHING) {
print("STRIKE");
this.state = BASEBALL_STATE.STRIKE;
updateBillboard("STRIKE");
print("STRIKE");
playRandomSound(AUDIO.strike, {
position: myPosition,
volume: 2.0
@ -570,7 +562,6 @@ function update(dt) {
if (baseball) {
baseball.update(dt);
if (baseball.finished()) {
print("BALL IS FINSIEHD");
baseball = null;
Script.setTimeout(pitchBall, 3000);
}