diff --git a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js index 4295170045..cfb8092c10 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js +++ b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js @@ -9,7 +9,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html /*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("libraries/utils.js"); var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; diff --git a/unpublishedScripts/DomainContent/Toybox/bow/bow.js b/unpublishedScripts/DomainContent/Toybox/bow/bow.js index c947b59518..157f319dca 100644 --- a/unpublishedScripts/DomainContent/Toybox/bow/bow.js +++ b/unpublishedScripts/DomainContent/Toybox/bow/bow.js @@ -11,7 +11,7 @@ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var NOTCH_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/notch.wav'; var SHOOT_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/String_release2.L.wav'; diff --git a/unpublishedScripts/DomainContent/Toybox/bow/createBow.js b/unpublishedScripts/DomainContent/Toybox/bow/createBow.js index eb6d8bb81b..6722669307 100644 --- a/unpublishedScripts/DomainContent/Toybox/bow/createBow.js +++ b/unpublishedScripts/DomainContent/Toybox/bow/createBow.js @@ -10,7 +10,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var utilsPath = Script.resolvePath('../../libraries/utils.js'); +var utilsPath = Script.resolvePath('libraries/utils.js'); Script.include(utilsPath); var SCRIPT_URL = Script.resolvePath('bow.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js b/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js index d0b1372755..5d5ab3ac0e 100644 --- a/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js +++ b/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js @@ -10,7 +10,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("libraries/utils.js"); var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx'; var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj'; diff --git a/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js b/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js index 379e94333f..3f7ff6365e 100644 --- a/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js +++ b/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js @@ -14,7 +14,7 @@ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var BUBBLE_MODEL = "http://hifi-content.s3.amazonaws.com/james/bubblewand/bubble.fbx"; diff --git a/unpublishedScripts/DomainContent/Toybox/doll/doll.js b/unpublishedScripts/DomainContent/Toybox/doll/doll.js index 15c587ba4c..cc9ab194e6 100644 --- a/unpublishedScripts/DomainContent/Toybox/doll/doll.js +++ b/unpublishedScripts/DomainContent/Toybox/doll/doll.js @@ -13,7 +13,7 @@ /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var _this; // this is the "constructor" for the entity as a JS object we don't do much here var Doll = function() { diff --git a/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js b/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js index be91516e63..a6f3dca6fd 100644 --- a/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js +++ b/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("libraries/utils.js"); var scriptURL = Script.resolvePath('flashlight.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js b/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js index 02a2e07985..98545fc3ab 100644 --- a/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js +++ b/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js @@ -17,7 +17,7 @@ /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var ON_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav'; var OFF_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_off.wav'; diff --git a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js index 08c5b5857a..a1010b4dd7 100644 --- a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js +++ b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js @@ -14,17 +14,17 @@ var _this; - var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js"); - var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js"); - var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js"); - var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js'); - var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js'); - var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js"); - var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js"); - var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js"); - var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js'); - var bowScriptURL = Script.resolvePath('../examples/toybox/bow/bow.js'); - var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js"); + var gunScriptURL = Script.resolvePath("pistol/pistol.js"); + var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js"); + var catScriptURL = Script.resolvePath("cat/cat.js"); + var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js'); + var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js'); + var wandScriptURL = Script.resolvePath("bubblewand/wand.js"); + var dollScriptURL = Script.resolvePath("doll/doll.js"); + var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js"); + var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js'); + var bowScriptURL = Script.resolvePath('bow/bow.js'); + var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js"); var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js'); var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/libraries/utils.js b/unpublishedScripts/DomainContent/Toybox/libraries/utils.js new file mode 100644 index 0000000000..f39f4d7913 --- /dev/null +++ b/unpublishedScripts/DomainContent/Toybox/libraries/utils.js @@ -0,0 +1,313 @@ +// +// Created by Bradley Austin Davis on 2015/08/29 +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +vec3toStr = function(v, digits) { + if (!digits) { digits = 3; } + return "{ " + v.x.toFixed(digits) + ", " + v.y.toFixed(digits) + ", " + v.z.toFixed(digits)+ " }"; +} + +quatToStr = function(q, digits) { + if (!digits) { digits = 3; } + return "{ " + q.w.toFixed(digits) + ", " + q.x.toFixed(digits) + ", " + + q.y.toFixed(digits) + ", " + q.z.toFixed(digits)+ " }"; +} + +vec3equal = function(v0, v1) { + return (v0.x == v1.x) && (v0.y == v1.y) && (v0.z == v1.z); +} + +colorMix = function(colorA, colorB, mix) { + var result = {}; + for (var key in colorA) { + result[key] = (colorA[key] * (1 - mix)) + (colorB[key] * mix); + } + return result; +} +scaleLine = function (start, end, scale) { + var v = Vec3.subtract(end, start); + var length = Vec3.length(v); + v = Vec3.multiply(scale, v); + return Vec3.sum(start, v); +} + +findAction = function(name) { + return Controller.findAction(name); +} + +addLine = function(origin, vector, color) { + if (!color) { + color = COLORS.WHITE + } + return Entities.addEntity(mergeObjects(LINE_PROTOTYPE, { + position: origin, + linePoints: [ + ZERO_VECTOR, + vector, + ], + color: color + })); +} + +// FIXME fetch from a subkey of user data to support non-destructive modifications +setEntityUserData = function(id, data) { + var json = JSON.stringify(data) + Entities.editEntity(id, { userData: json }); +} + +// FIXME do non-destructive modification of the existing user data +getEntityUserData = function(id) { + var results = null; + var properties = Entities.getEntityProperties(id, "userData"); + if (properties.userData) { + try { + results = JSON.parse(properties.userData); + } catch(err) { + logDebug(err); + logDebug(properties.userData); + } + } + return results ? results : {}; +} + + +// Non-destructively modify the user data of an entity. +setEntityCustomData = function(customKey, id, data) { + var userData = getEntityUserData(id); + if (data == null) { + delete userData[customKey]; + } else { + userData[customKey] = data; + } + setEntityUserData(id, userData); +} + +getEntityCustomData = function(customKey, id, defaultValue) { + var userData = getEntityUserData(id); + if (undefined != userData[customKey]) { + return userData[customKey]; + } else { + return defaultValue; + } +} + +mergeObjects = function(proto, custom) { + var result = {}; + for (var attrname in proto) { + result[attrname] = proto[attrname]; + } + for (var attrname in custom) { + result[attrname] = custom[attrname]; + } + return result; +} + +LOG_WARN = 1; + +logWarn = function(str) { + if (LOG_WARN) { + print(str); + } +} + +LOG_ERROR = 1; + +logError = function(str) { + if (LOG_ERROR) { + print(str); + } +} + +LOG_INFO = 1; + +logInfo = function(str) { + if (LOG_INFO) { + print(str); + } +} + +LOG_DEBUG = 0; + +logDebug = function(str) { + if (LOG_DEBUG) { + print(str); + } +} + +LOG_TRACE = 0; + +logTrace = function(str) { + if (LOG_TRACE) { + print(str); + } +} + +// Computes the penetration between a point and a sphere (centered at the origin) +// if point is inside sphere: returns true and stores the result in 'penetration' +// (the vector that would move the point outside the sphere) +// otherwise returns false +findSphereHit = function(point, sphereRadius) { + var EPSILON = 0.000001; //smallish positive number - used as margin of error for some computations + var vectorLength = Vec3.length(point); + if (vectorLength < EPSILON) { + return true; + } + var distance = vectorLength - sphereRadius; + if (distance < 0.0) { + return true; + } + return false; +} + +findSpherePointHit = function(sphereCenter, sphereRadius, point) { + return findSphereHit(Vec3.subtract(point,sphereCenter), sphereRadius); +} + +findSphereSphereHit = function(firstCenter, firstRadius, secondCenter, secondRadius) { + return findSpherePointHit(firstCenter, firstRadius + secondRadius, secondCenter); +} + +// Given a vec3 v, return a vec3 that is the same vector relative to the avatars +// DEFAULT eye position, rotated into the avatars reference frame. +getEyeRelativePosition = function(v) { + return Vec3.sum(MyAvatar.getDefaultEyePosition(), Vec3.multiplyQbyV(MyAvatar.orientation, v)); +} + +getAvatarRelativeRotation = function(q) { + return Quat.multiply(MyAvatar.orientation, q); +} + +pointInExtents = function(point, minPoint, maxPoint) { + return (point.x >= minPoint.x && point.x <= maxPoint.x) && + (point.y >= minPoint.y && point.y <= maxPoint.y) && + (point.z >= minPoint.z && point.z <= maxPoint.z); +} + +/** + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h, s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param Number h The hue + * @param Number s The saturation + * @param Number l The lightness + * @return Array The RGB representation + */ +hslToRgb = function(hsl) { + var r, g, b; + if (hsl.s == 0) { + r = g = b = hsl.l; // achromatic + } else { + var hue2rgb = function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + + var q = hsl.l < 0.5 ? hsl.l * (1 + hsl.s) : hsl.l + hsl.s - hsl.l * hsl.s; + var p = 2 * hsl.l - q; + r = hue2rgb(p, q, hsl.h + 1 / 3); + g = hue2rgb(p, q, hsl.h); + b = hue2rgb(p, q, hsl.h - 1 / 3); + } + + return { + red: Math.round(r * 255), + green: Math.round(g * 255), + blue: Math.round(b * 255) + }; +} + +map = function(value, min1, max1, min2, max2) { + return min2 + (max2 - min2) * ((value - min1) / (max1 - min1)); +} + +orientationOf = function(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); +} + +randFloat = function(low, high) { + return low + Math.random() * (high - low); +} + + +randInt = function(low, high) { + return Math.floor(randFloat(low, high)); +} + + +randomColor = function() { + return { + red: randInt(0, 255), + green: randInt(0, 255), + blue: randInt(0, 255) + } +} + + +hexToRgb = function(hex) { + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result ? { + red: parseInt(result[1], 16), + green: parseInt(result[2], 16), + blue: parseInt(result[3], 16) + } : null; +} + +calculateHandSizeRatio = function() { + // Get the ratio of the current avatar's hand to Owen's hand + + var standardCenterHandPoint = 0.11288; + var jointNames = MyAvatar.getJointNames(); + //get distance from handJoint up to leftHandIndex3 as a proxy for center of hand + var wristToFingertipDistance = 0;; + for (var i = 0; i < jointNames.length; i++) { + var jointName = jointNames[i]; + print(jointName) + if (jointName.indexOf("LeftHandIndex") !== -1) { + // translations are relative to parent joint, so simply add them together + // joints face down the y-axis + var translation = MyAvatar.getDefaultJointTranslation(i).y; + wristToFingertipDistance += translation; + } + } + // Right now units are in cm, so convert to meters + wristToFingertipDistance /= 100; + + var centerHandPoint = wristToFingertipDistance/2; + + // Compare against standard hand (Owen) + var handSizeRatio = centerHandPoint/standardCenterHandPoint; + return handSizeRatio; +} + +clamp = function(val, min, max){ + return Math.max(min, Math.min(max, val)) + } + diff --git a/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js b/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js index 6051b7c0ae..6410e2d92c 100644 --- a/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js +++ b/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js @@ -17,7 +17,7 @@ (function() { var _this; - var utilitiesScript = Script.resolvePath("../../libraries/utils.js"); + var utilitiesScript = Script.resolvePath("libraries/utils.js"); Script.include(utilitiesScript); LightSwitch = function() { _this = this; diff --git a/unpublishedScripts/DomainContent/Toybox/masterReset.js b/unpublishedScripts/DomainContent/Toybox/masterReset.js index cbcee30b0b..4820aa6292 100644 --- a/unpublishedScripts/DomainContent/Toybox/masterReset.js +++ b/unpublishedScripts/DomainContent/Toybox/masterReset.js @@ -11,20 +11,20 @@ /*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */ -var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js"); +var utilitiesScript = Script.resolvePath("libraries/utils.js"); Script.include(utilitiesScript); -var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js"); -var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js"); -var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js"); -var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js'); -var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js'); -var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js"); -var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js"); -var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js"); -var bowScriptURL = Script.resolvePath("../examples/toybox/bow/bow.js"); -var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js"); -var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js'); +var gunScriptURL = Script.resolvePath("pistol/pistol.js"); +var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js"); +var catScriptURL = Script.resolvePath("cat/cat.js"); +var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js'); +var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js'); +var wandScriptURL = Script.resolvePath("bubblewand/wand.js"); +var dollScriptURL = Script.resolvePath("doll.js"); +var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js"); +var bowScriptURL = Script.resolvePath("toybox/bow/bow.js"); +var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js"); +var targetsScriptURL = Script.resolvePath('toybox/ping_pong_gun/wallTarget.js'); var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js'); var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js index fcd187a687..2685599824 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js @@ -11,7 +11,7 @@ // /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("utils.js"); var scriptURL = Script.resolvePath('wallTarget.js'); var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx'; diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js index 415913ea6d..24edbe8522 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js @@ -11,7 +11,7 @@ /*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ (function() { - Script.include("../../libraries/utils.js"); + Script.include("utils.js"); var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav'; var PING_PONG_BALL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_ball.fbx'; diff --git a/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js b/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js index 99b7503cba..272da68bec 100644 --- a/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js +++ b/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js @@ -11,8 +11,7 @@ (function() { - Script.include("../../libraries/utils.js"); - Script.include("../../libraries/constants.js"); + Script.include("libraries/utils.js"); var _this; var DISABLE_LASER_THRESHOLD = 0.2; @@ -343,8 +342,8 @@ preload: function(entityID) { this.entityID = entityID; this.laser = Overlays.addOverlay("line3d", { - start: ZERO_VECTOR, - end: ZERO_VECTOR, + start: { x: 0, y: 0, z: 0 }, + end: { x: 0, y: 0, z: 0 }, color: COLORS.RED, alpha: 1, visible: true, diff --git a/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js b/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js index 05715ff787..05d9b4efc5 100644 --- a/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js +++ b/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js @@ -13,7 +13,7 @@ // Script.include("../libraries/utils.js"); //Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); this.spraySound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/sprayPaintSound.wav"); diff --git a/unpublishedScripts/DomainContent/Toybox/targetsResetter.js b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js index ccec8173de..10ba968ac9 100644 --- a/unpublishedScripts/DomainContent/Toybox/targetsResetter.js +++ b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js @@ -8,7 +8,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html (function() { - var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js'); + var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js'); var _this; Resetter = function() {