homereset

This commit is contained in:
ericrius1 2016-03-23 15:09:14 -07:00
parent 1809c2971e
commit 42196ea5c4
5 changed files with 1236 additions and 480 deletions

View file

@ -1,477 +1,479 @@
// print("EBL LOADED THE PISTOL SCRIPT");
// pistol.js
// examples
//
// Created by Eric Levin on 11/12/2015
// Copyright 2013 High Fidelity, Inc.
//
// This is an example script that turns the hydra controllers and mouse into a entity gun.
// It reads the controller, watches for trigger pulls, and adds a force to any entity it hits
// Distributed under the Apache License, Version 2.0. // //
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // // pistol.js
// // // examples
// //
// // Created by Eric Levin on 11/12/2015
// // Copyright 2013 High Fidelity, Inc.
// //
// // This is an example script that turns the hydra controllers and mouse into a entity gun.
// // It reads the controller, watches for trigger pulls, and adds a force to any entity it hits
// // Distributed under the Apache License, Version 2.0.
// // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
Script.include("../../../libraries/utils.js"); // Script.include("../../../libraries/utils.js");
Script.include("../../../libraries/constants.js"); // Script.include("../../../libraries/constants.js");
var GUN_FORCE =20; // var GUN_FORCE =20;
Messages.sendMessage('Hifi-Hand-Disabler', "both"); // Messages.sendMessage('Hifi-Hand-Disabler', "both");
var gameName = "Kill All The Rats!" // var gameName = "Kill All The Rats!"
// var HOST = "localhost:5000" // // var HOST = "localhost:5000"
var HOST = "desolate-bastion-1742.herokuapp.com"; // var HOST = "desolate-bastion-1742.herokuapp.com";
var socketClient = new WebSocket("ws://" + HOST); // var socketClient = new WebSocket("ws://" + HOST);
var username = GlobalServices.username; // var username = GlobalServices.username;
var currentScore = 0; // var currentScore = 0;
function score() { // function score() {
currentScore++; // currentScore++;
socketClient.send(JSON.stringify({ // socketClient.send(JSON.stringify({
username: username, // username: username,
score: currentScore, // score: currentScore,
gameName: gameName // gameName: gameName
})) // }))
} // }
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; // HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
var fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw"); // var fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
var LASER_LENGTH = 100; // var LASER_LENGTH = 100;
var LASER_WIDTH = 2; // var LASER_WIDTH = 2;
var POSE_CONTROLS = [Controller.Standard.LeftHand, Controller.Standard.RightHand]; // var POSE_CONTROLS = [Controller.Standard.LeftHand, Controller.Standard.RightHand];
var TRIGGER_CONTROLS = [Controller.Standard.LT, Controller.Standard.RT]; // var TRIGGER_CONTROLS = [Controller.Standard.LT, Controller.Standard.RT];
var MIN_THROWER_DELAY = 1000; // var MIN_THROWER_DELAY = 1000;
var MAX_THROWER_DELAY = 1000; // var MAX_THROWER_DELAY = 1000;
var RELOAD_INTERVAL = 5; // var RELOAD_INTERVAL = 5;
var GUN_MODEL = HIFI_PUBLIC_BUCKET + "cozza13/gun/m1911-handgun+1.fbx?v=4"; // var GUN_MODEL = HIFI_PUBLIC_BUCKET + "cozza13/gun/m1911-handgun+1.fbx?v=4";
var BULLET_VELOCITY = 10.0; // var BULLET_VELOCITY = 10.0;
var GUN_OFFSETS = [{ // var GUN_OFFSETS = [{
x: 0.04, // x: 0.04,
y: 0.26, // y: 0.26,
z: 0.04 // z: 0.04
}, { // }, {
x: 0.04, // x: 0.04,
y: 0.26, // y: 0.26,
z: 0.04 // z: 0.04
}]; // }];
var GUN_ORIENTATIONS = [Quat.fromPitchYawRollDegrees(0, 90, 90), Quat.fromPitchYawRollDegrees(0, -90, 270)]; // var GUN_ORIENTATIONS = [Quat.fromPitchYawRollDegrees(0, 90, 90), Quat.fromPitchYawRollDegrees(0, -90, 270)];
//x -> y // //x -> y
//y -> z // //y -> z
// z -> x // // z -> x
var BARREL_OFFSETS = [ { // var BARREL_OFFSETS = [ {
x: -0.12, // x: -0.12,
y: 0.12, // y: 0.12,
z: 0.04 // z: 0.04
}, { // }, {
x: 0.12, // x: 0.12,
y: 0.12, // y: 0.12,
z: 0.04 // z: 0.04
} ]; // } ];
var pointers = []; // var pointers = [];
pointers.push(Overlays.addOverlay("line3d", { // pointers.push(Overlays.addOverlay("line3d", {
start: ZERO_VECTOR, // start: ZERO_VECTOR,
end: ZERO_VECTOR, // end: ZERO_VECTOR,
color: COLORS.RED, // color: COLORS.RED,
alpha: 1, // alpha: 1,
visible: true, // visible: true,
lineWidth: LASER_WIDTH // lineWidth: LASER_WIDTH
})); // }));
pointers.push(Overlays.addOverlay("line3d", { // pointers.push(Overlays.addOverlay("line3d", {
start: ZERO_VECTOR, // start: ZERO_VECTOR,
end: ZERO_VECTOR, // end: ZERO_VECTOR,
color: COLORS.RED, // color: COLORS.RED,
alpha: 1, // alpha: 1,
visible: true, // visible: true,
lineWidth: LASER_WIDTH // lineWidth: LASER_WIDTH
})); // }));
var mapping = Controller.newMapping(); // var mapping = Controller.newMapping();
var validPoses = [false, false]; // var validPoses = [false, false];
var barrelVectors = [0, 0]; // var barrelVectors = [0, 0];
var barrelTips = [0, 0]; // var barrelTips = [0, 0];
// If enabled, anything can be shot, otherwise, an entity needs to have "isShootable" set in its userData // // If enabled, anything can be shot, otherwise, an entity needs to have "isShootable" set in its userData
var shootAnything = true; // var shootAnything = true;
function update(deltaTime) { // function update(deltaTime) {
// FIXME we should also expose MyAvatar.handPoses[2], MyAvatar.tipPoses[2] // // FIXME we should also expose MyAvatar.handPoses[2], MyAvatar.tipPoses[2]
var tipPoses = [MyAvatar.leftHandTipPose, MyAvatar.rightHandTipPose]; // var tipPoses = [MyAvatar.leftHandTipPose, MyAvatar.rightHandTipPose];
for (var side = 0; side < 2; side++) { // for (var side = 0; side < 2; side++) {
// First check if the controller is valid // // First check if the controller is valid
var controllerPose = Controller.getPoseValue(POSE_CONTROLS[side]); // var controllerPose = Controller.getPoseValue(POSE_CONTROLS[side]);
validPoses[side] = controllerPose.valid; // validPoses[side] = controllerPose.valid;
// Need to adjust the laser // // Need to adjust the laser
var tipPose = tipPoses[side]; // var tipPose = tipPoses[side];
var handRotation = tipPoses[side].rotation; // var handRotation = tipPoses[side].rotation;
var barrelOffset = Vec3.multiplyQbyV(handRotation, BARREL_OFFSETS[side]); // var barrelOffset = Vec3.multiplyQbyV(handRotation, BARREL_OFFSETS[side]);
barrelTips[side] = Vec3.sum(tipPose.translation, barrelOffset); // barrelTips[side] = Vec3.sum(tipPose.translation, barrelOffset);
barrelVectors[side] = Vec3.multiplyQbyV(handRotation, { // barrelVectors[side] = Vec3.multiplyQbyV(handRotation, {
x: 0, // x: 0,
y: 1, // y: 1,
z: 0 // z: 0
}); // });
var laserTip = Vec3.sum(Vec3.multiply(LASER_LENGTH, barrelVectors[side]), barrelTips[side]); // var laserTip = Vec3.sum(Vec3.multiply(LASER_LENGTH, barrelVectors[side]), barrelTips[side]);
// Update Lasers // // Update Lasers
Overlays.editOverlay(pointers[side], { // Overlays.editOverlay(pointers[side], {
start: barrelTips[side], // start: barrelTips[side],
end: laserTip, // end: laserTip,
alpha: 1, // alpha: 1,
}); // });
} // }
} // }
function displayPointer(side) { // function displayPointer(side) {
Overlays.editOverlay(pointers[side], { // Overlays.editOverlay(pointers[side], {
visible: true // visible: true
}); // });
} // }
function hidePointer(side) { // function hidePointer(side) {
Overlays.editOverlay(pointers[side], { // Overlays.editOverlay(pointers[side], {
visible: false // visible: false
}); // });
} // }
function fire(side, value) { // function fire(side, value) {
if (value == 0) { // if (value == 0) {
return; // return;
} // }
Audio.playSound(fireSound, { // Audio.playSound(fireSound, {
position: barrelTips[side], // position: barrelTips[side],
volume: 0.5 // volume: 0.5
}); // });
var shotDirection = Vec3.normalize(barrelVectors[side]); // var shotDirection = Vec3.normalize(barrelVectors[side]);
var pickRay = { // var pickRay = {
origin: barrelTips[side], // origin: barrelTips[side],
direction: shotDirection // direction: shotDirection
}; // };
createMuzzleFlash(barrelTips[side]); // createMuzzleFlash(barrelTips[side]);
var intersection = Entities.findRayIntersectionBlocking(pickRay, true); // var intersection = Entities.findRayIntersectionBlocking(pickRay, true);
if (intersection.intersects) { // if (intersection.intersects) {
Script.setTimeout(function() { // Script.setTimeout(function() {
createEntityHitEffect(intersection.intersection); // createEntityHitEffect(intersection.intersection);
if (shootAnything && intersection.properties.dynamic === 1) { // if (shootAnything && intersection.properties.dynamic === 1) {
// Any dynamic entity can be shot // // Any dynamic entity can be shot
Entities.editEntity(intersection.entityID, { // Entities.editEntity(intersection.entityID, {
velocity: Vec3.multiply(shotDirection, GUN_FORCE) // velocity: Vec3.multiply(shotDirection, GUN_FORCE)
}); // });
} // }
if (intersection.properties.name === "rat") { // if (intersection.properties.name === "rat") {
score(); // score();
createBloodSplatter(intersection.intersection); // createBloodSplatter(intersection.intersection);
Entities.deleteEntity(intersection.entityID); // Entities.deleteEntity(intersection.entityID);
} // }
//Attempt to call entity method's shot method // //Attempt to call entity method's shot method
var forceDirection = JSON.stringify({ // var forceDirection = JSON.stringify({
forceDirection: shotDirection // forceDirection: shotDirection
}); // });
Entities.callEntityMethod(intersection.entityID, 'onShot', [forceDirection]); // Entities.callEntityMethod(intersection.entityID, 'onShot', [forceDirection]);
}, 0); // }, 0);
} // }
} // }
function scriptEnding() { // function scriptEnding() {
Messages.sendMessage('Hifi-Hand-Disabler', 'none'); // Messages.sendMessage('Hifi-Hand-Disabler', 'none');
mapping.disable(); // mapping.disable();
for (var i = 0; i < pointers.length; ++i) { // for (var i = 0; i < pointers.length; ++i) {
Overlays.deleteOverlay(pointers[i]); // Overlays.deleteOverlay(pointers[i]);
} // }
MyAvatar.detachOne(GUN_MODEL); // MyAvatar.detachOne(GUN_MODEL);
MyAvatar.detachOne(GUN_MODEL); // MyAvatar.detachOne(GUN_MODEL);
clearPose(); // clearPose();
} // }
MyAvatar.attach(GUN_MODEL, "LeftHand", GUN_OFFSETS[0], GUN_ORIENTATIONS[0], 0.40); // MyAvatar.attach(GUN_MODEL, "LeftHand", GUN_OFFSETS[0], GUN_ORIENTATIONS[0], 0.40);
MyAvatar.attach(GUN_MODEL, "RightHand", GUN_OFFSETS[1], GUN_ORIENTATIONS[1], 0.40); // MyAvatar.attach(GUN_MODEL, "RightHand", GUN_OFFSETS[1], GUN_ORIENTATIONS[1], 0.40);
function showPointer(side) { // function showPointer(side) {
Overlays.editOverlay(pointers[side], { // Overlays.editOverlay(pointers[side], {
visible: true // visible: true
}); // });
} // }
mapping.from(Controller.Standard.LT).hysteresis(0.0, 0.5).to(function(value) { // mapping.from(Controller.Standard.LT).hysteresis(0.0, 0.5).to(function(value) {
fire(0, value); // fire(0, value);
}); // });
mapping.from(Controller.Standard.RT).hysteresis(0.0, 0.5).to(function(value) { // mapping.from(Controller.Standard.RT).hysteresis(0.0, 0.5).to(function(value) {
fire(1, value); // fire(1, value);
}); // });
mapping.enable(); // mapping.enable();
Script.scriptEnding.connect(scriptEnding); // Script.scriptEnding.connect(scriptEnding);
Script.update.connect(update); // Script.update.connect(update);
function createEntityHitEffect(position) { // function createEntityHitEffect(position) {
var flash = Entities.addEntity({ // var flash = Entities.addEntity({
type: "ParticleEffect", // type: "ParticleEffect",
position: position, // position: position,
lifetime: 4, // lifetime: 4,
"name": "Flash Emitter", // "name": "Flash Emitter",
"color": { // "color": {
red: 228, // red: 228,
green: 128, // green: 128,
blue: 12 // blue: 12
}, // },
"maxParticles": 1000, // "maxParticles": 1000,
"lifespan": 0.15, // "lifespan": 0.15,
"emitRate": 1000, // "emitRate": 1000,
"emitSpeed": 1, // "emitSpeed": 1,
"speedSpread": 0, // "speedSpread": 0,
"emitOrientation": { // "emitOrientation": {
"x": -0.4, // "x": -0.4,
"y": 1, // "y": 1,
"z": -0.2, // "z": -0.2,
"w": 0.7071068286895752 // "w": 0.7071068286895752
}, // },
"emitDimensions": { // "emitDimensions": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"polarStart": 0, // "polarStart": 0,
"polarFinish": Math.PI, // "polarFinish": Math.PI,
"azimuthStart": -3.1415927410125732, // "azimuthStart": -3.1415927410125732,
"azimuthFinish": 2, // "azimuthFinish": 2,
"emitAcceleration": { // "emitAcceleration": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"accelerationSpread": { // "accelerationSpread": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"particleRadius": 0.03, // "particleRadius": 0.03,
"radiusSpread": 0.02, // "radiusSpread": 0.02,
"radiusStart": 0.02, // "radiusStart": 0.02,
"radiusFinish": 0.03, // "radiusFinish": 0.03,
"colorSpread": { // "colorSpread": {
red: 100, // red: 100,
green: 100, // green: 100,
blue: 20 // blue: 20
}, // },
"alpha": 1, // "alpha": 1,
"alphaSpread": 0, // "alphaSpread": 0,
"alphaStart": 0, // "alphaStart": 0,
"alphaFinish": 0, // "alphaFinish": 0,
"additiveBlending": true, // "additiveBlending": true,
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png" // "textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
}); // });
Script.setTimeout(function() { // Script.setTimeout(function() {
Entities.editEntity(flash, { // Entities.editEntity(flash, {
isEmitting: false // isEmitting: false
}); // });
}, 100); // }, 100);
} // }
function createBloodSplatter(position) { // function createBloodSplatter(position) {
var splatter = Entities.addEntity({ // var splatter = Entities.addEntity({
type: "ParticleEffect", // type: "ParticleEffect",
position: position, // position: position,
lifetime: 4, // lifetime: 4,
"name": "Blood Splatter", // "name": "Blood Splatter",
"color": { // "color": {
red: 230, // red: 230,
green: 2, // green: 2,
blue: 30 // blue: 30
}, // },
"maxParticles": 1000, // "maxParticles": 1000,
"lifespan": 0.3, // "lifespan": 0.3,
"emitRate": 1000, // "emitRate": 1000,
"emitSpeed": 0.5, // "emitSpeed": 0.5,
"speedSpread": 0, // "speedSpread": 0,
"emitOrientation": { // "emitOrientation": {
"x": -0.4, // "x": -0.4,
"y": 1, // "y": 1,
"z": -0.2, // "z": -0.2,
"w": 0.7071068286895752 // "w": 0.7071068286895752
}, // },
"emitDimensions": { // "emitDimensions": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"polarStart": 0, // "polarStart": 0,
"polarFinish": Math.PI, // "polarFinish": Math.PI,
"azimuthStart": -3.1415927410125732, // "azimuthStart": -3.1415927410125732,
"azimuthFinish": 2, // "azimuthFinish": 2,
"emitAcceleration": { // "emitAcceleration": {
"x": 0, // "x": 0,
"y": -5, // "y": -5,
"z": 0 // "z": 0
}, // },
"accelerationSpread": { // "accelerationSpread": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"particleRadius": 0.05, // "particleRadius": 0.05,
"radiusSpread": 0.03, // "radiusSpread": 0.03,
"radiusStart": 0.05, // "radiusStart": 0.05,
"radiusFinish": 0.05, // "radiusFinish": 0.05,
"colorSpread": { // "colorSpread": {
red: 40, // red: 40,
green: 0, // green: 0,
blue: 30 // blue: 30
}, // },
"alpha": 1, // "alpha": 1,
"alphaSpread": 0, // "alphaSpread": 0,
"alphaStart": 0, // "alphaStart": 0,
"alphaFinish": 0, // "alphaFinish": 0,
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png" // "textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
}); // });
Script.setTimeout(function() { // Script.setTimeout(function() {
Entities.editEntity(splatter, { // Entities.editEntity(splatter, {
isEmitting: false // isEmitting: false
}); // });
}, 100) // }, 100)
} // }
function createMuzzleFlash(position) { // function createMuzzleFlash(position) {
var smoke = Entities.addEntity({ // var smoke = Entities.addEntity({
type: "ParticleEffect", // type: "ParticleEffect",
position: position, // position: position,
lifetime: 1, // lifetime: 1,
"name": "Smoke Hit Emitter", // "name": "Smoke Hit Emitter",
"maxParticles": 1000, // "maxParticles": 1000,
"lifespan": 4, // "lifespan": 4,
"emitRate": 20, // "emitRate": 20,
emitSpeed: 0, // emitSpeed: 0,
"speedSpread": 0, // "speedSpread": 0,
"emitDimensions": { // "emitDimensions": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"polarStart": 0, // "polarStart": 0,
"polarFinish": 0, // "polarFinish": 0,
"azimuthStart": -3.1415927410125732, // "azimuthStart": -3.1415927410125732,
"azimuthFinish": 3.14, // "azimuthFinish": 3.14,
"emitAcceleration": { // "emitAcceleration": {
"x": 0, // "x": 0,
"y": 0.5, // "y": 0.5,
"z": 0 // "z": 0
}, // },
"accelerationSpread": { // "accelerationSpread": {
"x": .2, // "x": .2,
"y": 0, // "y": 0,
"z": .2 // "z": .2
}, // },
"radiusSpread": .04, // "radiusSpread": .04,
"particleRadius": 0.07, // "particleRadius": 0.07,
"radiusStart": 0.07, // "radiusStart": 0.07,
"radiusFinish": 0.07, // "radiusFinish": 0.07,
"alpha": 0.7, // "alpha": 0.7,
"alphaSpread": 0, // "alphaSpread": 0,
"alphaStart": 0, // "alphaStart": 0,
"alphaFinish": 0, // "alphaFinish": 0,
"additiveBlending": 0, // "additiveBlending": 0,
"textures": "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png" // "textures": "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png"
}); // });
Script.setTimeout(function() { // Script.setTimeout(function() {
Entities.editEntity(smoke, { // Entities.editEntity(smoke, {
isEmitting: false // isEmitting: false
}); // });
}, 100); // }, 100);
var flash = Entities.addEntity({ // var flash = Entities.addEntity({
type: "ParticleEffect", // type: "ParticleEffect",
position: position, // position: position,
lifetime: 4, // lifetime: 4,
"name": "Muzzle Flash", // "name": "Muzzle Flash",
"color": { // "color": {
red: 228, // red: 228,
green: 128, // green: 128,
blue: 12 // blue: 12
}, // },
"maxParticles": 1000, // "maxParticles": 1000,
"lifespan": 0.1, // "lifespan": 0.1,
"emitRate": 1000, // "emitRate": 1000,
"emitSpeed": 0.5, // "emitSpeed": 0.5,
"speedSpread": 0, // "speedSpread": 0,
"emitOrientation": { // "emitOrientation": {
"x": -0.4, // "x": -0.4,
"y": 1, // "y": 1,
"z": -0.2, // "z": -0.2,
"w": 0.7071068286895752 // "w": 0.7071068286895752
}, // },
"emitDimensions": { // "emitDimensions": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"polarStart": 0, // "polarStart": 0,
"polarFinish": Math.PI, // "polarFinish": Math.PI,
"azimuthStart": -3.1415927410125732, // "azimuthStart": -3.1415927410125732,
"azimuthFinish": 2, // "azimuthFinish": 2,
"emitAcceleration": { // "emitAcceleration": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"accelerationSpread": { // "accelerationSpread": {
"x": 0, // "x": 0,
"y": 0, // "y": 0,
"z": 0 // "z": 0
}, // },
"particleRadius": 0.05, // "particleRadius": 0.05,
"radiusSpread": 0.01, // "radiusSpread": 0.01,
"radiusStart": 0.05, // "radiusStart": 0.05,
"radiusFinish": 0.05, // "radiusFinish": 0.05,
"colorSpread": { // "colorSpread": {
red: 100, // red: 100,
green: 100, // green: 100,
blue: 20 // blue: 20
}, // },
"alpha": 1, // "alpha": 1,
"alphaSpread": 0, // "alphaSpread": 0,
"alphaStart": 0, // "alphaStart": 0,
"alphaFinish": 0, // "alphaFinish": 0,
"additiveBlending": true, // "additiveBlending": true,
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png" // "textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
}); // });
Script.setTimeout(function() { // Script.setTimeout(function() {
Entities.editEntity(flash, { // Entities.editEntity(flash, {
isEmitting: false // isEmitting: false
}); // });
}, 100) // }, 100)
} // }

View file

@ -85,11 +85,11 @@
var myDate = new Date(); var myDate = new Date();
var seconds = myDate.getSeconds(); var seconds = myDate.getSeconds();
secondRollDegrees = -seconds * DEGREES_FOR_SECOND; secondRollDegrees = -seconds * DEGREES_FOR_SECOND;
var localClockHandRotation = Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees); // var localClockHandRotation = Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees);
var worldClockHandRotation = Quat.multiply(clockRotation, localClockHandRotation); // var worldClockHandRotation = Quat.multiply(clockRotation, localClockHandRotation);
Entities.editEntity(_this.secondHand, { // Entities.editEntity(_this.secondHand, {
rotation: worldClockHandRotation // rotation: worldClockHandRotation
}); // });
}, },

View file

@ -0,0 +1,725 @@
{
"Entities": [
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{5371218c-e05b-49da-ac70-81f1f76c55ea}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.69732666015625,
"y": 0.1600341796875,
"z": 0.28265380859375
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": 0.6540253758430481,
"y": 0.11673291027545929,
"z": 0.23935253918170929
},
"rotation": {
"w": 0.996917724609375,
"x": -0.0001678466796875,
"y": 0.078294038772583008,
"z": -0.0003204345703125
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ccc1198a-a501-48b8-959a-68297258aea7}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.47344970703125,
"y": 0.06005859375,
"z": 0.30706787109375
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": 0.4301484227180481,
"y": 0.01675732433795929,
"z": 0.2637665867805481
},
"rotation": {
"w": 0.70644688606262207,
"x": 0.70638585090637207,
"y": -0.030960559844970703,
"z": 0.031174182891845703
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{3aaf5dd5-16d8-4852-880d-8256de68de19}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.2613525390625,
"y": 0.01007080078125,
"z": 0.359466552734375
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.12442189455032349,
"y": -0.12685984373092651,
"z": 0.22253590822219849
},
"rotation": {
"w": -4.57763671875e-05,
"x": 0.35637450218200684,
"y": -4.57763671875e-05,
"z": 0.93432521820068359
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.029999999329447746,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{0474a29f-c45b-4d42-ae95-0c0bd1e6c501}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_yellow.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.30487060546875,
"y": 0.01007080078125,
"z": 0.188262939453125
},
"queryAACube": {
"scale": 0.25670996308326721,
"x": 0.17651562392711639,
"y": -0.11828418076038361,
"z": 0.059907957911491394
},
"rotation": {
"w": 0.99496448040008545,
"x": 1.52587890625e-05,
"y": 0.10020601749420166,
"z": 0.0002288818359375
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{53e06851-8346-45ac-bdb5-0a74c99b5bd5}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.40277099609375,
"y": 0.035064697265625,
"z": 0.254364013671875
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.25915694236755371,
"y": -0.10854937136173248,
"z": 0.11074994504451752
},
"rotation": {
"w": 0.70650792121887207,
"x": -0.031143665313720703,
"y": -0.031143665313720703,
"z": 0.70632481575012207
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.029999999329447746,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{38bcb70d-e384-4b60-878a-e34d4830f045}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_yellow.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.54962158203125,
"y": 0.010040283203125,
"z": 0.294647216796875
},
"queryAACube": {
"scale": 0.25670996308326721,
"x": 0.42126661539077759,
"y": -0.11831469833850861,
"z": 0.16629223525524139
},
"rotation": {
"w": 0.999969482421875,
"x": -7.62939453125e-05,
"y": -0.0037384629249572754,
"z": 0.0001068115234375
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{fa8f8bbc-5bd0-4121-985d-75ce2f68eba1}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.52001953125,
"y": 0.01007080078125,
"z": 0
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.38308888673782349,
"y": -0.12685984373092651,
"z": -0.13693064451217651
},
"rotation": {
"w": 0.9861142635345459,
"x": -7.62939453125e-05,
"y": -0.16603344678878784,
"z": -7.62939453125e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.029999999329447746,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{d4b8582b-b707-453c-89c6-65e358da5cd7}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_yellow.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.66876220703125,
"y": 0,
"z": 0.012939453125
},
"queryAACube": {
"scale": 0.25670996308326721,
"x": 0.54040724039077759,
"y": -0.12835498154163361,
"z": -0.11541552841663361
},
"rotation": {
"w": 0.70589756965637207,
"x": 0.036270737648010254,
"y": -0.036331713199615479,
"z": -0.70647746324539185
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{3b5b53fb-7ee5-44eb-9b81-8de8a525c433}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.83819580078125,
"y": 0.135040283203125,
"z": 0.261627197265625
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.70126515626907349,
"y": -0.0018903613090515137,
"z": 0.12469655275344849
},
"rotation": {
"w": 0.69332420825958252,
"x": 0.13832306861877441,
"y": -0.13841456174850464,
"z": -0.69353783130645752
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{0d1f27e9-7e74-4263-9428-8c8f7aac94a6}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.61773681640625,
"y": 0.0350341796875,
"z": 0.265533447265625
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.47412276268005371,
"y": -0.10857988893985748,
"z": 0.12191937863826752
},
"rotation": {
"w": 0.9998779296875,
"x": -4.57763671875e-05,
"y": -0.014206171035766602,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{79ea518f-aac3-45ff-b22d-6d295b3c9e87}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.7188720703125,
"y": 0.08502197265625,
"z": 0.26397705078125
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.57525801658630371,
"y": -0.058592095971107483,
"z": 0.12036298215389252
},
"rotation": {
"w": 0.99993896484375,
"x": -4.57763671875e-05,
"y": -0.0099946856498718262,
"z": -0.0001068115234375
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ff470ff9-c889-4893-a25f-80895bff0e9a}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_blue.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.74981689453125,
"y": 0.010040283203125,
"z": 0.258575439453125
},
"queryAACube": {
"scale": 0.25980761647224426,
"x": 0.61991310119628906,
"y": -0.11986352503299713,
"z": 0.12867163121700287
},
"rotation": {
"w": 0.99993896484375,
"x": -4.57763671875e-05,
"y": -0.010666072368621826,
"z": -0.0003814697265625
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{b5319f85-603d-436b-8bbe-fc9f798ca738}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.8824462890625,
"y": 0.0350341796875,
"z": 0.281097412109375
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.73883223533630371,
"y": -0.10857988893985748,
"z": 0.13748334348201752
},
"rotation": {
"w": 0.999847412109375,
"x": -4.57763671875e-05,
"y": -0.016922235488891602,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{944a4616-8dac-4d6a-a92b-49fa98514416}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_blue.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.963623046875,
"y": 0.010009765625,
"z": 0.25885009765625
},
"queryAACube": {
"scale": 0.25980761647224426,
"x": 0.83371925354003906,
"y": -0.11989404261112213,
"z": 0.12894628942012787
},
"rotation": {
"w": 0.999847412109375,
"x": -4.57763671875e-05,
"y": -0.017379999160766602,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ea6a1038-7047-4a1e-bdbd-076d6e41508c}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_blue.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.49188232421875,
"y": 0.010040283203125,
"z": 0.27752685546875
},
"queryAACube": {
"scale": 0.25980761647224426,
"x": 0.36197853088378906,
"y": -0.11986352503299713,
"z": 0.14762304723262787
},
"rotation": {
"w": 0.99798583984375,
"x": -4.57763671875e-05,
"y": -0.063248634338378906,
"z": 4.57763671875e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ff65f5dd-2d53-4127-86da-05156a42946d}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0,
"y": 0.010101318359375,
"z": 0.353302001953125
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": -0.04330126941204071,
"y": -0.03319995105266571,
"z": 0.3100007176399231
},
"rotation": {
"w": 0.55049967765808105,
"x": 0.44353401660919189,
"y": -0.44359505176544189,
"z": -0.55083543062210083
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{3a9acd14-f754-4c70-b294-9f622c000785}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.88006591796875,
"y": 0.010040283203125,
"z": 0.05718994140625
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.74313527345657349,
"y": -0.12689036130905151,
"z": -0.079740703105926514
},
"rotation": {
"w": 0.86965739727020264,
"x": -4.57763671875e-05,
"y": -0.4936751127243042,
"z": -4.57763671875e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{bb014301-247b-44d0-8b09-b830fea4439e}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.80487060546875,
"y": 0.010040283203125,
"z": 0.19500732421875
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": 0.7615693211555481,
"y": -0.03326098620891571,
"z": 0.15170605480670929
},
"rotation": {
"w": 0.70440220832824707,
"x": 0.060776710510253906,
"y": -0.060868263244628906,
"z": -0.70455479621887207
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}
],
"Version": 57
}

View file

@ -11,6 +11,8 @@ var FRUIT_BOWL_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/ki
var LAB_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/labLamp.json' + "?" + Math.random(); var LAB_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/labLamp.json' + "?" + Math.random();
var LIVING_ROOM_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/livingRoomLamp.json' + "?" + Math.random(); var LIVING_ROOM_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/livingRoomLamp.json' + "?" + Math.random();
var TRASHCAN_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/trashcan.json' + "?" + Math.random(); var TRASHCAN_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/trashcan.json' + "?" + Math.random();
var BLOCKS_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/blocks.json' + "?" + Math.random();
FruitBowl = function(spawnLocation, spawnRotation) { FruitBowl = function(spawnLocation, spawnRotation) {
print('CREATE FRUIT BOWL') print('CREATE FRUIT BOWL')
@ -19,7 +21,6 @@ FruitBowl = function(spawnLocation, spawnRotation) {
function create() { function create() {
var success = Clipboard.importEntities(FRUIT_BOWL_URL); var success = Clipboard.importEntities(FRUIT_BOWL_URL);
if (success === true) { if (success === true) {
hasBow = true;
created = Clipboard.pasteEntities(spawnLocation) created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created); print('created ' + created);
} }
@ -47,7 +48,6 @@ LabLamp = function(spawnLocation, spawnRotation) {
function create() { function create() {
var success = Clipboard.importEntities(LAB_LAMP_URL); var success = Clipboard.importEntities(LAB_LAMP_URL);
if (success === true) { if (success === true) {
hasBow = true;
created = Clipboard.pasteEntities(spawnLocation) created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created); print('created ' + created);
} }
@ -248,5 +248,28 @@ Books = function(spawnLocation, spawnRotation) {
create(); create();
this.cleanup = cleanup;
}
Blocks = function(spawnLocation, spawnRotation) {
print('EBL CREATE BLOCKS')
var created = [];
function create() {
var success = Clipboard.importEntities(BLOCKS_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup; this.cleanup = cleanup;
} }

View file

@ -96,7 +96,7 @@
}, 2500); }, 2500);
Script.setTimeout(function() { Script.setTimeout(function() {
// _this.createKineticEntities(); _this.createKineticEntities();
_this.createDynamicEntities(); _this.createDynamicEntities();
}, 750) }, 750)
@ -117,6 +117,7 @@
}, },
createDynamicEntities: function() { createDynamicEntities: function() {
print("EBL CREATE DYNAMIC ENTITIES");
// var fishTank = new FishTank({ // var fishTank = new FishTank({
// x: 1098.9254, // x: 1098.9254,
@ -165,16 +166,15 @@
// }); // });
//v2.0 //v2.0
// var musicBox = new MusicBox(); // var musicBox = new MusicBox();
//var cuckooClock = new MyCuckooClock(center); // var cuckooClock = new MyCuckooClock({
var cuckooClock = new MyCuckooClock({ // x: 1105.267,
x: 1105.267, // y: 461.44,
y: 461.44, // z: -81.9495
z: -81.9495 // }, {
}, { // x: 0,
x: 0, // y: -57,
y: -57, // z: 0
z: 0 // });
});
// var doppelganger = new Doppelganger(); // var doppelganger = new Doppelganger();
}, },
@ -182,58 +182,64 @@
createKineticEntities: function() { createKineticEntities: function() {
var fruitBowl = new FruitBowl({ // var fruitBowl = new FruitBowl({
x: 1105.3185, // x: 1105.3185,
y: 460.3221, // y: 460.3221,
z: -81.2452 // z: -81.2452
}); // });
var livingRoomLamp = new LivingRoomLamp({ // var livingRoomLamp = new LivingRoomLamp({
x: 1104.6732, // x: 1104.6732,
y: 460.3326, // y: 460.3326,
z: -81.9710 // z: -81.9710
}); // });
var upperBookShelf = new UpperBookShelf({ // var upperBookShelf = new UpperBookShelf({
x: 1106.2649, // x: 1106.2649,
y: 461.5352, // y: 461.5352,
z: -80.3018 // z: -80.3018
}); // });
var lowerBookShelf = new LowerBookShelf({ // var lowerBookShelf = new LowerBookShelf({
x: 1106.2725, // x: 1106.2725,
y: 460.9600, // y: 460.9600,
z: -80.2837 // z: -80.2837
}); // });
var rightDeskDrawer = new RightDeskDrawer({ // var rightDeskDrawer = new RightDeskDrawer({
x: 1105.1735, // x: 1105.1735,
y: 460.0446, // y: 460.0446,
z: -81.3612 // z: -81.3612
}); // });
var leftDeskDrawer = new LeftDeskDrawer({ // var leftDeskDrawer = new LeftDeskDrawer({
x: 1104.6478, // x: 1104.6478,
y: 460.0463, // y: 460.0463,
z: -82.1095 // z: -82.1095
}); // });
var chair = new Chair({ // var chair = new Chair({
x: 1105.2716, // x: 1105.2716,
y: 459.7251, // y: 459.7251,
z: -79.8097 // z: -79.8097
}); // });
var trashcan = new Trashcan({ // var trashcan = new Trashcan({
x: 1103.9034, // x: 1103.9034,
y: 459.4355, // y: 459.4355,
z: -82.3619 // z: -82.3619
}); // });
var books = new Books({ // var books = new Books({
x: 1106.1553, // x: 1106.1553,
y: 461.1, // y: 461.1,
z: -80.4890 // z: -80.4890
// });
print("EBL CREATE KINETIC ENTITIES");
var blocks = new Blocks({
x: 1097.3383,
y: 460.3790,
z: -66.8895
}); });
}, },