Merge pull request #7793 from imgntn/toyboxProduction

Move Toybox Domain to Production s3
This commit is contained in:
Clément Brisset 2016-04-29 13:27:09 -07:00
commit ddde4e2dc4
31 changed files with 664 additions and 200 deletions

View file

@ -10,7 +10,7 @@
var soundMap = [{
name: 'river water',
url: "http://hifi-public.s3.amazonaws.com/ryan/Water_Lap_River_Edge_Gentle.L.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Water_Lap_River_Edge_Gentle.L.wav",
audioOptions: {
position: {
x: 580,
@ -22,7 +22,7 @@ var soundMap = [{
}
}, {
name: 'windmill',
url: "http://hifi-public.s3.amazonaws.com/ryan/WINDMILL_Mono.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/WINDMILL_Mono.wav",
audioOptions: {
position: {
x: 530,
@ -34,7 +34,7 @@ var soundMap = [{
}
}, {
name: 'insects',
url: "http://hifi-public.s3.amazonaws.com/ryan/insects3.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/insects3.wav",
audioOptions: {
position: {
x: 560,
@ -46,7 +46,7 @@ var soundMap = [{
}
}, {
name: 'fireplace',
url: "http://hifi-public.s3.amazonaws.com/ryan/demo/0619_Fireplace__Tree_B.L.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/0619_Fireplace__Tree_B.L.wav",
audioOptions: {
position: {
x: 551.61,
@ -58,7 +58,7 @@ var soundMap = [{
}
}, {
name: 'cat purring',
url: "http://hifi-public.s3.amazonaws.com/ryan/Cat_Purring_Deep_Low_Snor.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Cat_Purring_Deep_Low_Snor.wav",
audioOptions: {
position: {
x: 551.48,
@ -70,7 +70,7 @@ var soundMap = [{
}
}, {
name: 'dogs barking',
url: "http://hifi-public.s3.amazonaws.com/ryan/dogs_barking_1.L.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/dogs_barking_1.L.wav",
audioOptions: {
position: {
x: 523,
@ -83,7 +83,7 @@ var soundMap = [{
playAtInterval: 60 * 1000
}, {
name: 'arcade game',
url: "http://hifi-public.s3.amazonaws.com/ryan/ARCADE_GAMES_VID.L.L.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/ARCADE_GAMES_VID.L.L.wav",
audioOptions: {
position: {
x: 543.77,

View file

@ -6,12 +6,10 @@
//
// This is a script that creates a persistent basketball hoop with a working collision hull. Feel free to move it.
//
// Distributed under the Apache License, Version 2.0.
// 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 */
var hoopURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop.fbx";
var hoopCollisionHullURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop_collision_hull.obj";
var hoopURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop.fbx";
var hoopCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop_collision_hull.obj";
var hoopStartPosition =
Vec3.sum(MyAvatar.position,

View file

@ -8,15 +8,13 @@
//
// 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");
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
Script.include("libraries/utils.js");
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
var rackCollisionHullURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
var NUMBER_OF_BALLS = 4;
var DIAMETER = 0.30;
var RESET_DISTANCE = 1;

View file

@ -9,10 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var collisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
var basketball = null;

View file

@ -6,7 +6,6 @@
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
(function() {
@ -42,8 +41,8 @@ var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
createBasketballs: function() {
var NUMBER_OF_BALLS = 4;
var DIAMETER = 0.30;
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var basketballCollisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
var position = {
x: 542.86,

View file

@ -11,12 +11,12 @@
(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';
var STRING_PULL_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Bow_draw.1.L.wav';
var ARROW_HIT_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Arrow_impact1.L.wav'
var NOTCH_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/notch.wav';
var SHOOT_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/String_release2.L.wav';
var STRING_PULL_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Bow_draw.1.L.wav';
var ARROW_HIT_SOUND_URL = 'https://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Arrow_impact1.L.wav'
var ARROW_DIMENSIONS = {
x: 0.02,
@ -32,9 +32,9 @@
z: 0
};
var ARROW_MODEL_URL = "http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_textured.fbx";
var ARROW_MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_textured.fbx";
var ARROW_COLLISION_HULL_URL =
"http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_collision_hull.obj";
"http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_collision_hull.obj";
var ARROW_DIMENSIONS = {
x: 0.02,

View file

@ -10,13 +10,13 @@
// 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');
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
var BOW_DIMENSIONS = {
x: 0.04,
y: 1.3,

View file

@ -10,10 +10,10 @@
// 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';
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
var WAND_SCRIPT_URL = Script.resolvePath("wand.js");

View file

@ -14,9 +14,9 @@
(function() {
Script.include("../../libraries/utils.js");
Script.include("libraries/utils.js");
var BUBBLE_MODEL = "http://hifi-content.s3.amazonaws.com/james/bubblewand/bubble.fbx";
var BUBBLE_MODEL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/bubble.fbx";
var BUBBLE_INITIAL_DIMENSIONS = {
x: 0.01,

View file

@ -16,7 +16,7 @@
var _this;
Cat = function() {
_this = this;
this.meowSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Animals/cat_meow.wav");
this.meowSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/cat_meow.wav");
};
Cat.prototype = {

View file

@ -11,7 +11,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 createDoll() {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
var scriptURL = Script.resolvePath("doll.js");

View file

@ -13,12 +13,12 @@
/*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() {
_this = this;
this.screamSounds = [SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/KenDoll_1%2303.wav")];
this.screamSounds = [SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/KenDoll_1%2303.wav")];
};
Doll.prototype = {
@ -31,7 +31,7 @@
Entities.editEntity(this.entityID, {
animation: {
url: "https://hifi-public.s3.amazonaws.com/models/Bboys/zombie_scream.fbx",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/zombie_scream.fbx",
running: true
}
});

View file

@ -37,7 +37,7 @@
var yVelocity = 0.0;
var yAcceleration = -G;
var airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Air Swipe 05.wav");
var airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Air%20Swipe%2005.wav");
var injector = null;
this.position = function() {
@ -51,7 +51,7 @@
type: "Model",
modelURL: MyAvatar.skeletonModelURL,
animation: {
url: "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims_160127/fly.fbx",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/fly.fbx",
running: true,
fps: 30,
firstFrame: 1.0,
@ -76,7 +76,7 @@
animation: {running: false}
});
airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/8bit Jump 03.wav");
airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/8bit%20Jump%2003.wav");
injector = null;
}
@ -132,7 +132,7 @@
var id = entityManager.add({
type: "Model",
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/coin.fbx",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/coin.fbx",
angularVelocity: { x: 0, y: 20, z: 0 },
position: to3DPosition(this.position()),
dimensions:dimensions
@ -172,14 +172,14 @@
var idUp = entityManager.add({
type: "Model",
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx",
rotation: Quat.fromPitchYawRollDegrees(180, 0, 0),
position: to3DPosition({ x: xPosition, y: upYPosition }),
dimensions: { x: width, y: upHeight, z: width }
});
var idDown = entityManager.add({
type: "Model",
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx",
position: to3DPosition({ x: xPosition, y: height / 2.0 }),
dimensions: { x: width, y: height, z: width }
});
@ -217,7 +217,7 @@
var pipes = new Array();
var coins = new Array();
var coinsSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Coin.wav");
var coinsSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Coin.wav");
var injector = null;
this.update = function(deltaTime, gameTime, startedPlaying) {
@ -325,7 +325,7 @@
var numberDimensions = { x: 0.0660, y: 0.1050, z: 0.0048 };
function numberUrl(number) {
return "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/" + number + ".fbx"
return "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/" + number + ".fbx"
}
function digitPosition(digit) {
return Vec3.multiplyQbyV(space.orientation, { x: 0.3778 + digit * (numberDimensions.x + 0.01), y: 0.0, z: 0.0 });
@ -341,7 +341,7 @@
var bestId = entityManager.add({
type: "Model",
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/best.fbx",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/best.fbx",
position: topLeft,
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
dimensions: { x: 0.2781, y: 0.0063, z: 0.1037 }
@ -359,7 +359,7 @@
var scoreId = entityManager.add({
type: "Model",
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/score.fbx",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/score.fbx",
position: bottomLeft,
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
dimensions: { x: 0.3678, y: 0.0063, z: 0.1037 }
@ -453,7 +453,7 @@
var pipes = null;
var score = null;
var gameOverSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Game Over.wav");
var gameOverSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Game%20Over.wav");
var injector = null;
var directions = ["UP", "DOWN", "LEFT", "RIGHT"];
@ -466,7 +466,7 @@
current = 0;
}
if (current === sequence.length) {
avatar.changeModel("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/mario.fbx");
avatar.changeModel("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/mario.fbx");
current = 0;
}
}

View file

@ -10,7 +10,7 @@
},
"dynamic": 1,
"id": "{ee5b25e6-aca2-4dc7-9462-51537d89c126}",
"modelURL": "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/cube.fbx",
"modelURL": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/cube.fbx",
"queryAACube": {
"scale": 0.5974045991897583,
"x": -5.1575918197631836,
@ -23,7 +23,7 @@
"y": -0.13279926776885986,
"z": 0.34688329696655273
},
"script": "https://raw.githubusercontent.com/Atlante45/hifi/feat/hackaton/examples/toybox/flappyAvatars/flappyAvatars.js",
"script": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/flappyAvatars.js",
"scriptTimestamp": 1457031937425,
"shapeType": "box",
"type": "Model",

View file

@ -12,11 +12,11 @@
// 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');
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
x: 0,

View file

@ -17,10 +17,10 @@
/*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';
var ON_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_on.wav';
var OFF_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_off.wav';
//we are creating lights that we don't want to get stranded so lets make sure that we can get rid of them
var startTime = Date.now();

View file

@ -0,0 +1,163 @@
// raveStickEntityScript.js
//
// Script Type: Entity
// Created by Eric Levin on 12/16/15.
// Copyright 2015 High Fidelity, Inc.
//
// This entity script create light trails on a given object as it moves.
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
var _this;
var LIFETIME = 6000;
var DRAWING_DEPTH = 0.8;
var LINE_DIMENSIONS = 100;
var MAX_POINTS_PER_LINE = 50;
var MIN_POINT_DISTANCE = 0.02;
var STROKE_WIDTH = 0.05
var ugLSD = 35;
var RaveStick = function() {
_this = this;
this.colorPalette = [{
red: 0,
green: 200,
blue: 40
}, {
red: 200,
green: 10,
blue: 40
}];
var texture = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/trails.png";
this.trail = Entities.addEntity({
type: "PolyLine",
dimensions: {
x: LINE_DIMENSIONS,
y: LINE_DIMENSIONS,
z: LINE_DIMENSIONS
},
color: {
red: 255,
green: 255,
blue: 255
},
textures: texture,
lifetime: LIFETIME
});
this.points = [];
this.normals = [];
this.strokeWidths = [];
};
RaveStick.prototype = {
isGrabbed: false,
startNearGrab: function() {
this.trailBasePosition = Entities.getEntityProperties(this.entityID, "position").position;
Entities.editEntity(this.trail, {
position: this.trailBasePosition
});
this.points = [];
this.normals = [];
this.strokeWidths = [];
this.setupEraseInterval();
},
continueNearGrab: function() {
var props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
var forwardVec = Quat.getFront(Quat.multiply(props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0)));
forwardVec = Vec3.normalize(forwardVec);
var forwardQuat = orientationOf(forwardVec);
var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.04));
var localPoint = Vec3.subtract(position, this.trailBasePosition);
if (this.points.length >= 1 && Vec3.distance(localPoint, this.points[this.points.length - 1]) < MIN_POINT_DISTANCE) {
//Need a minimum distance to avoid binormal NANs
return;
}
if (this.points.length === MAX_POINTS_PER_LINE) {
this.points.shift();
this.normals.shift();
this.strokeWidths.shift();
}
this.points.push(localPoint);
var normal = Quat.getUp(props.rotation);
this.normals.push(normal);
this.strokeWidths.push(STROKE_WIDTH);
Entities.editEntity(this.trail, {
linePoints: this.points,
normals: this.normals,
strokeWidths: this.strokeWidths
});
},
setupEraseInterval: function() {
this.trailEraseInterval = Script.setInterval(function() {
if (_this.points.length > 0) {
_this.points.shift();
_this.normals.shift();
_this.strokeWidths.shift();
Entities.editEntity(_this.trail, {
linePoints: _this.points,
strokeWidths: _this.strokeWidths,
normals: _this.normals
});
}
}, ugLSD);
},
releaseGrab: function() {
if (!this.trailEraseInterval) {
return;
}
Script.setTimeout(function() {
Script.clearInterval(_this.trailEraseInterval);
_this.trailEraseInterval = null;
}, 3000);
},
preload: function(entityID) {
this.entityID = entityID;
},
unload: function() {
Entities.deleteEntity(this.beam);
Entities.deleteEntity(this.trail);
if (this.trailEraseInterval) {
Script.clearInterval(this.trailEraseInterval);
}
}
};
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);
}
function computeNormal(p1, p2) {
return Vec3.normalize(Vec3.subtract(p2, p1));
}
return new RaveStick();
});

View file

@ -12,19 +12,22 @@
(function() {
var utilitiesScript = Script.resolvePath("libraries/utils.js");
Script.include(utilitiesScript);
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');
@ -60,7 +63,6 @@
MasterReset = function() {
var resetKey = "resetMe";
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
var shouldDeleteOnEndScript = false;
@ -168,7 +170,7 @@
}
function createRaveStick(position) {
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx";
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
var stick = Entities.addEntity({
type: "Model",
@ -258,7 +260,7 @@
alphaSpread: 0.1,
alphaStart: 0.1,
alphaFinish: 0.1,
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png",
emitterShouldTrail: false,
userData: JSON.stringify({
resetMe: {
@ -270,7 +272,7 @@
}
function createGun(position) {
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
var pistol = Entities.addEntity({
type: 'Model',
@ -279,7 +281,7 @@
position: position,
restitution: 0,
damping: 0.5,
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
dimensions: {
x: 0.05,
y: 0.23,
@ -343,8 +345,8 @@
var SCRIPT_URL = Script.resolvePath('bow.js');
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
var BOW_DIMENSIONS = {
x: 0.04,
@ -496,7 +498,7 @@
type: "ParticleEffect",
name: "fire",
animationSettings: animationSettings,
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png",
position: {
x: 551.45,
y: 494.82,
@ -559,10 +561,10 @@
var DIAMETER = 0.30;
var RESET_DISTANCE = 1;
var MINIMUM_MOVE_LENGTH = 0.05;
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
@ -638,7 +640,7 @@
z: 0
},
dynamic: true,
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav',
collisionless: false,
modelURL: basketballURL,
userData: JSON.stringify({
@ -733,8 +735,8 @@
function createTargets() {
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
var MINIMUM_MOVE_LENGTH = 0.05;
var RESET_DISTANCE = 0.5;
@ -813,8 +815,8 @@
function createCat(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx";
var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx";
var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx";
var animationSettings = JSON.stringify({
running: true
});
@ -850,7 +852,7 @@
}
function createFlashlight(position) {
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
var flashlight = Entities.addEntity({
type: "Model",
@ -864,7 +866,7 @@
z: 0.08
},
dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav",
gravity: {
x: 0,
y: -3.5,
@ -915,7 +917,7 @@
}
function createLights() {
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx";
var rotation = {
@ -1163,8 +1165,8 @@
function createDice() {
var diceProps = {
type: "Model",
modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx",
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav",
name: "dice",
position: {
x: 541.61,
@ -1211,7 +1213,7 @@
}
function createGates() {
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx';
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
var gate = Entities.addEntity({
@ -1252,9 +1254,9 @@
function createPingPongBallGun() {
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx';
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
var position = {
x: 548.6,
y: 495.4,
@ -1320,8 +1322,8 @@
}
function createWand(position) {
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';
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
var wand = Entities.addEntity({
name: 'Bubble Wand',
@ -1381,7 +1383,7 @@
function createBasketBall(position) {
var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var entity = Entities.addEntity({
type: "Model",
@ -1407,7 +1409,7 @@
y: -0.01,
z: 0
},
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav",
userData: JSON.stringify({
resetMe: {
resetMe: true
@ -1421,7 +1423,7 @@
}
function createDoll(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
var naturalDimensions = {
x: 1.63,
@ -1462,7 +1464,7 @@
function createSprayCan(position) {
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx";
var entity = Entities.addEntity({
type: "Model",
@ -1476,7 +1478,7 @@
z: 0.07
},
dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav",
shapeType: 'box',
restitution: 0,
gravity: {
@ -1502,7 +1504,7 @@
}
function createPottedPlant(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx";
var entity = Entities.addEntity({
type: "Model",
@ -1540,8 +1542,8 @@
function createCombinedArmChair(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx";
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx";
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj";
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
@ -1583,8 +1585,8 @@
}
function createBlocks(position) {
var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/";
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/";
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav";
var NUM_BLOCKS_PER_COLOR = 4;
var i, j;

View file

@ -6,8 +6,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/*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, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
Script.include('libraries/utils.js');
var masterResetScript = Script.resolvePath("masterReset.js");
var hiddenEntityScriptURL = Script.resolvePath("hiddenEntityReset.js");

View file

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

View file

@ -17,11 +17,11 @@
(function() {
var _this;
var utilitiesScript = Script.resolvePath("../../libraries/utils.js");
var utilitiesScript = Script.resolvePath("libraries/utils.js");
Script.include(utilitiesScript);
LightSwitch = function() {
_this = this;
this.switchSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/lamp_switch_2.wav");
this.switchSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lamp_switch_2.wav");
};
LightSwitch.prototype = {

View file

@ -6,25 +6,21 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/*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, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
//per script
/*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/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');
@ -32,7 +28,6 @@ var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
MasterReset = function() {
var resetKey = "resetMe";
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
var shouldDeleteOnEndScript = false;
@ -148,7 +143,7 @@ MasterReset = function() {
}
function createRaveStick(position) {
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx";
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
var stick = Entities.addEntity({
type: "Model",
@ -243,7 +238,7 @@ MasterReset = function() {
alphaSpread: 0.1,
alphaStart: 0.1,
alphaFinish: 0.1,
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png",
emitterShouldTrail: false,
userData: JSON.stringify({
resetMe: {
@ -254,7 +249,8 @@ MasterReset = function() {
}
function createGun(position) {
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
var pistol = Entities.addEntity({
type: 'Model',
@ -281,7 +277,7 @@ MasterReset = function() {
restitution: 0,
dynamic: true,
damping: 0.5,
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
userData: JSON.stringify({
"wearable": {
"joints": {
@ -327,9 +323,8 @@ MasterReset = function() {
var SCRIPT_URL = Script.resolvePath('bow.js');
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
var BOW_DIMENSIONS = {
x: 0.04,
y: 1.3,
@ -480,7 +475,7 @@ MasterReset = function() {
type: "ParticleEffect",
name: "fire",
animationSettings: animationSettings,
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png",
position: {
x: 551.45,
y: 494.82,
@ -544,10 +539,10 @@ MasterReset = function() {
var DIAMETER = 0.30;
var RESET_DISTANCE = 1;
var MINIMUM_MOVE_LENGTH = 0.05;
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
@ -624,7 +619,7 @@ MasterReset = function() {
z: 0
},
dynamic: true,
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav',
collisionless: false,
modelURL: basketballURL,
userData: JSON.stringify({
@ -721,8 +716,8 @@ MasterReset = function() {
function createTargets() {
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
var MINIMUM_MOVE_LENGTH = 0.05;
var RESET_DISTANCE = 0.5;
@ -801,8 +796,8 @@ MasterReset = function() {
function createCat(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx";
var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx";
var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx";
var animationSettings = JSON.stringify({
running: true
});
@ -838,7 +833,7 @@ MasterReset = function() {
}
function createFlashlight(position) {
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
var flashlight = Entities.addEntity({
type: "Model",
@ -852,7 +847,7 @@ MasterReset = function() {
z: 0.08
},
dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav",
gravity: {
x: 0,
y: -3.5,
@ -903,8 +898,7 @@ MasterReset = function() {
}
function createLights() {
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx";
var rotation = {
w: 0.63280689716339111,
@ -1151,8 +1145,8 @@ MasterReset = function() {
function createDice() {
var diceProps = {
type: "Model",
modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx",
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav",
name: "dice",
position: {
x: 541.61,
@ -1199,8 +1193,7 @@ MasterReset = function() {
}
function createGates() {
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx';
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
var gate = Entities.addEntity({
name: 'Front Door Fence',
@ -1239,10 +1232,9 @@ MasterReset = function() {
}
function createPingPongBallGun() {
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx';
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
var position = {
x: 548.6,
y: 495.4,
@ -1308,8 +1300,8 @@ MasterReset = function() {
}
function createWand(position) {
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';
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
var wand = Entities.addEntity({
name: 'Bubble Wand',
@ -1369,7 +1361,7 @@ MasterReset = function() {
function createBasketBall(position) {
var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
var entity = Entities.addEntity({
type: "Model",
@ -1395,7 +1387,7 @@ MasterReset = function() {
y: -0.01,
z: 0
},
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav",
userData: JSON.stringify({
resetMe: {
resetMe: true
@ -1409,7 +1401,7 @@ MasterReset = function() {
}
function createDoll(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
var naturalDimensions = {
x: 1.63,
@ -1450,7 +1442,8 @@ MasterReset = function() {
function createSprayCan(position) {
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx";
var entity = Entities.addEntity({
type: "Model",
@ -1464,7 +1457,7 @@ MasterReset = function() {
z: 0.07
},
dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav",
shapeType: 'box',
gravity: {
x: 0,
@ -1490,7 +1483,7 @@ MasterReset = function() {
}
function createPottedPlant(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx";
var entity = Entities.addEntity({
type: "Model",
@ -1528,8 +1521,8 @@ MasterReset = function() {
function createCombinedArmChair(position) {
var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx";
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx";
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj";
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
@ -1571,8 +1564,8 @@ MasterReset = function() {
}
function createBlocks(position) {
var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/";
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/";
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav";
var NUM_BLOCKS_PER_COLOR = 4;
var i, j;

View file

@ -19,7 +19,7 @@
var PLAYLIST_URL = "https://spreadsheets.google.com/feeds/cells/1x-ceGPGHldkHadARABFWfujLPTOWzXJPhrf2bTwg2cQ/od6/public/basic?alt=json";
var SONG_VOLUME = 0.1;
var HEADPHONES_ATTACHMENT = {
modelURL: "https://s3.amazonaws.com/hifi-public/brad/musicplayer/headphones2-v2.fbx",
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/musicPlayer/headphones2-v2.fbx",
jointName: "Head",
translation: {"x": 0, "y": 0.19, "z": 0.06},
rotation: {"x":0,"y":0.7071067690849304,"z":0.7071067690849304,"w":0},

View file

@ -13,9 +13,9 @@ Script.include("../../libraries/utils.js");
var scriptURL = Script.resolvePath('pingPongGun.js');
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx'
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
x: 0,
y: 0.5,

View file

@ -11,11 +11,11 @@
//
/*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';
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
var MINIMUM_MOVE_LENGTH = 0.05;
var RESET_DISTANCE = 0.5;

View file

@ -11,10 +11,10 @@
/*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';
var SHOOTING_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/pong_sound.wav';
var PING_PONG_BALL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/ping_pong_ball.fbx';
function PingPongGun() {
return;

View file

@ -20,7 +20,7 @@
hasBecomeActive: false,
preload: function(entityID) {
this.entityID = entityID;
var SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/Clay_Pigeon_02.L.wav";
var SOUND_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Clay_Pigeon_02.L.wav";
this.hitSound = SoundCache.getSound(SOUND_URL);
},
collisionWithEntity: function(me, otherEntity) {

View file

@ -1,6 +1,6 @@
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation())));
var scriptURL = Script.resolvePath('pistol.js');
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
var pistol = Entities.addEntity({
@ -27,7 +27,7 @@ var pistol = Entities.addEntity({
},
restitution: 0,
damping:0.5,
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true

View file

@ -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;
@ -28,8 +27,8 @@
this.forceMultiplier = 1;
this.laserLength = 100;
this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
this.ricochetSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/Ricochet.L.wav");
this.fireSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/GUN-SHOT2.raw");
this.ricochetSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/Ricochet.L.wav");
this.playRichochetSoundChance = 0.1;
this.fireVolume = 0.2;
this.bulletForce = 10;
@ -217,7 +216,7 @@
"alphaStart": 0,
"alphaFinish": 0,
"additiveBlending": true,
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
"textures": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/star.png"
});
Script.setTimeout(function() {
@ -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,

View file

@ -13,9 +13,9 @@
// 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");
this.spraySound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/spray_paint.wav");
var TIP_OFFSET_Z = 0.02;
var TIP_OFFSET_Y = 0.08;
@ -63,7 +63,7 @@
name: "streamEffect",
isEmitting: true,
position: position,
textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png",
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/smokeparticle.png",
emitSpeed: 3,
speedSpread: 0.02,
emitAcceleration: ZERO_VEC,

View file

@ -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() {
@ -44,8 +44,8 @@
createTargets: function() {
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
var MINIMUM_MOVE_LENGTH = 0.05;
var RESET_DISTANCE = 0.5;