From 1b1efe53d9dc2aa3913135bd7acfad4b196d83d4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 30 Nov 2015 15:59:12 -0800 Subject: [PATCH] fix for two space indentation in createBatButton.js --- examples/baseball/createBatButton.js | 90 ++++++++++++++-------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/examples/baseball/createBatButton.js b/examples/baseball/createBatButton.js index f16f126f2c..75f3dee26e 100644 --- a/examples/baseball/createBatButton.js +++ b/examples/baseball/createBatButton.js @@ -20,58 +20,58 @@ this.dropBats(); }; this.startFarTrigger = function() { - this.dropBats(); + this.dropBats(); }; this.dropBats = function() { - // if the bat box is near us, grab it's position - var nearby = Entities.findEntities(this.position, 20); + // if the bat box is near us, grab it's position + var nearby = Entities.findEntities(this.position, 20); - nearby.forEach(function(id) { - var properties = Entities.getEntityProperties(id, ["name", "position"]); - if (properties.name && properties.name == "Bat Box") { - boxPosition = properties.position; - } - }); + nearby.forEach(function(id) { + var properties = Entities.getEntityProperties(id, ["name", "position"]); + if (properties.name && properties.name == "Bat Box") { + boxPosition = properties.position; + } + }); - var BAT_DROP_HEIGHT = 2.0; + var BAT_DROP_HEIGHT = 2.0; - var dropPosition; + var dropPosition; - if (!boxPosition) { - // we got no bat box position, drop in front of the avatar instead - } else { - // drop the bat above the bat box - dropPosition = Vec3.sum(boxPosition, { x: 0.0, y: BAT_DROP_HEIGHT, z: 0.0}); - } - - var BAT_MODEL = "atp:c47deaae09cca927f6bc9cca0e8bbe77fc618f8c3f2b49899406a63a59f885cb.fbx"; - var BAT_COLLISION_HULL = "atp:9eafceb7510c41d50661130090de7e0632aa4da236ebda84a0059a4be2130e0c.obj"; - var SCRIPT_URL = "http://rawgit.com/birarda/hifi/baseball/examples/baseball/bat.js" - - var batUserData = { - grabbableKey: { - spatialKey: { - relativePosition: { x: 0.9, y: 0, z: 0 }, - relativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 45), - perHandRelativePosition: { x: 0.0, y: -0.05, z: -0.04 }, - perHandRelativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 0) - } + if (!boxPosition) { + // we got no bat box position, drop in front of the avatar instead + } else { + // drop the bat above the bat box + dropPosition = Vec3.sum(boxPosition, { x: 0.0, y: BAT_DROP_HEIGHT, z: 0.0}); } - } - // add the fresh bat at the drop position - var bat = Entities.addEntity({ - name: 'Bat', - type: "Model", - modelURL: BAT_MODEL, - position: dropPosition, - compoundShapeURL: BAT_COLLISION_HULL, - collisionsWillMove: true, - velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add - gravity: { x: 0, y: -9.81, z: 0}, - rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0), - script: SCRIPT_URL, - userData: JSON.stringify(batUserData) - }); + var BAT_MODEL = "atp:c47deaae09cca927f6bc9cca0e8bbe77fc618f8c3f2b49899406a63a59f885cb.fbx"; + var BAT_COLLISION_HULL = "atp:9eafceb7510c41d50661130090de7e0632aa4da236ebda84a0059a4be2130e0c.obj"; + var SCRIPT_URL = "http://rawgit.com/birarda/hifi/baseball/examples/baseball/bat.js" + + var batUserData = { + grabbableKey: { + spatialKey: { + relativePosition: { x: 0.9, y: 0, z: 0 }, + relativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 45), + perHandRelativePosition: { x: 0.0, y: -0.05, z: -0.04 }, + perHandRelativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 0) + } + } + } + + // add the fresh bat at the drop position + var bat = Entities.addEntity({ + name: 'Bat', + type: "Model", + modelURL: BAT_MODEL, + position: dropPosition, + compoundShapeURL: BAT_COLLISION_HULL, + collisionsWillMove: true, + velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add + gravity: { x: 0, y: -9.81, z: 0}, + rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0), + script: SCRIPT_URL, + userData: JSON.stringify(batUserData) + }); }; });