mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:43:21 +02:00
Merge pull request #7757 from imgntn/cellProduction
Move cellscience to production s3 bucket
This commit is contained in:
commit
d599d008c3
15 changed files with 615 additions and 158 deletions
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
var spriteURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Sprites/nucleosomes_sprite.fbx";
|
var spriteURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Sprites/nucleosomes_sprite.fbx";
|
||||||
var spriteDimensions = {
|
var spriteDimensions = {
|
||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
z: -1
|
z: -1
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
// Copyright 2016 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
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var version = 12;
|
||||||
|
|
||||||
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
var button;
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
function NavButton() {
|
||||||
|
_this = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
NavButton.prototype = {
|
||||||
|
button: null,
|
||||||
|
buttonImageURL: baseURL + "GUI/GUI_Cells.png?" + version,
|
||||||
|
hasButton: false,
|
||||||
|
entryPoint: {
|
||||||
|
x: 13500,
|
||||||
|
y: 13500,
|
||||||
|
z: 13500
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
x: 13501,
|
||||||
|
y: 13501,
|
||||||
|
z: 13501
|
||||||
|
},
|
||||||
|
preload: function(entityId) {
|
||||||
|
print('CELL PRELOAD CeLLS 1 ')
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.addButton();
|
||||||
|
Controller.mousePressEvent.connect(this.onClick);
|
||||||
|
print('CELL PRELOAD CeLLS 2 ')
|
||||||
|
},
|
||||||
|
addButton: function() {
|
||||||
|
if (this.hasButton === false) {
|
||||||
|
print('CELL ADDBuTTON CeLLS 1 ')
|
||||||
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
var buttonWidth = 150;
|
||||||
|
var buttonHeight = 50;
|
||||||
|
var buttonPadding = 10;
|
||||||
|
var offset = 0;
|
||||||
|
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
|
||||||
|
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
|
||||||
|
button = Overlays.addOverlay("image", {
|
||||||
|
x: buttonPositionX,
|
||||||
|
y: buttonPositionY,
|
||||||
|
width: buttonWidth,
|
||||||
|
height: buttonHeight,
|
||||||
|
imageURL: this.buttonImageURL,
|
||||||
|
visible: true,
|
||||||
|
alpha: 1.0
|
||||||
|
});
|
||||||
|
this.hasButton = true;
|
||||||
|
print('CELL ADDBuTTON CeLLS 2 button id is : ' +button)
|
||||||
|
} else {
|
||||||
|
print('CELL ADDBUTTON CeLLS FAIL - hasButton is' + this.hasButton)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onClick: function(event) {
|
||||||
|
//call to an internal function to get our scope back;
|
||||||
|
_this.handleClick(event);
|
||||||
|
},
|
||||||
|
handleClick: function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||||
|
x: event.x,
|
||||||
|
y: event.y
|
||||||
|
});
|
||||||
|
|
||||||
|
if (clickedOverlay === button) {
|
||||||
|
this.lookAtTarget();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lookAtTarget: function() {
|
||||||
|
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
|
||||||
|
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
MyAvatar.goToLocation(this.target, true, yaw);
|
||||||
|
|
||||||
|
MyAvatar.headYaw = 0;
|
||||||
|
},
|
||||||
|
unload: function() {
|
||||||
|
this.hasButton = false;
|
||||||
|
Overlays.deleteOverlay(button);
|
||||||
|
Controller.mousePressEvent.disconnect(this.onClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new NavButton();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,115 @@
|
||||||
|
// Copyright 2016 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
|
||||||
|
//
|
||||||
|
// Copyright 2016 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
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var version = 12;
|
||||||
|
|
||||||
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
var button;
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
function NavButton() {
|
||||||
|
_this = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
NavButton.prototype = {
|
||||||
|
button: null,
|
||||||
|
buttonImageURL: baseURL + "GUI/GUI_Hexokinase.png?" + version,
|
||||||
|
hasButton: false,
|
||||||
|
entryPoint: {
|
||||||
|
x: 3000,
|
||||||
|
y: 3000,
|
||||||
|
z: 13500
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
x: 2755,
|
||||||
|
y: 3121,
|
||||||
|
z: 13501
|
||||||
|
},
|
||||||
|
preload: function(entityId) {
|
||||||
|
print('CELL PRELOAD HEXOKINASE 1')
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.addButton();
|
||||||
|
Controller.mousePressEvent.connect(this.onClick);
|
||||||
|
print('CELL PRELOAD HEXOKINASE 2')
|
||||||
|
},
|
||||||
|
addButton: function() {
|
||||||
|
if (this.hasButton === false) {
|
||||||
|
print('CELL ADDBUTTON HEXOKINASE 1')
|
||||||
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
var buttonWidth = 150;
|
||||||
|
var buttonHeight = 50;
|
||||||
|
var buttonPadding = 10;
|
||||||
|
var offset = 3;
|
||||||
|
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
|
||||||
|
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
|
||||||
|
button = Overlays.addOverlay("image", {
|
||||||
|
x: buttonPositionX,
|
||||||
|
y: buttonPositionY,
|
||||||
|
width: buttonWidth,
|
||||||
|
height: buttonHeight,
|
||||||
|
imageURL: this.buttonImageURL,
|
||||||
|
visible: true,
|
||||||
|
alpha: 1.0
|
||||||
|
});
|
||||||
|
this.hasButton = true;
|
||||||
|
print('CELL ADDBUTTON HEXOKINASE 2 button id is : ' +button)
|
||||||
|
} else {
|
||||||
|
print('CELL ADDBUTTON HEXOKINASE FAIL hasButton is' + this.hasButton)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onClick: function(event) {
|
||||||
|
//call to an internal function to get our scope back;
|
||||||
|
_this.handleClick(event);
|
||||||
|
},
|
||||||
|
handleClick: function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||||
|
x: event.x,
|
||||||
|
y: event.y
|
||||||
|
});
|
||||||
|
|
||||||
|
if (clickedOverlay === button) {
|
||||||
|
this.lookAtTarget();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lookAtTarget: function() {
|
||||||
|
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
|
||||||
|
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
MyAvatar.goToLocation(this.target, true, yaw);
|
||||||
|
|
||||||
|
MyAvatar.headYaw = 0;
|
||||||
|
},
|
||||||
|
unload: function() {
|
||||||
|
this.hasButton = false;
|
||||||
|
Overlays.deleteOverlay(button);
|
||||||
|
Controller.mousePressEvent.disconnect(this.onClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new NavButton();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,109 @@
|
||||||
|
// Copyright 2016 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
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var version = 12;
|
||||||
|
|
||||||
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
var button;
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
function NavButton() {
|
||||||
|
_this = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
NavButton.prototype = {
|
||||||
|
button: null,
|
||||||
|
buttonImageURL: baseURL + "GUI/GUI_CellLayout.png?" + version,
|
||||||
|
hasButton: false,
|
||||||
|
entryPoint: {
|
||||||
|
x: 3000,
|
||||||
|
y: 13500,
|
||||||
|
z: 3000
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
x: 3276.6,
|
||||||
|
y: 13703.3,
|
||||||
|
z: 4405.6
|
||||||
|
},
|
||||||
|
preload: function(entityId) {
|
||||||
|
print('CeLL PRELOAD INSIDECELL 1')
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.addButton();
|
||||||
|
Controller.mousePressEvent.connect(this.onClick);
|
||||||
|
print('CeLL PRELOAD INSIDECELL 2')
|
||||||
|
},
|
||||||
|
addButton: function() {
|
||||||
|
if (this.hasButton === false) {
|
||||||
|
print('CELL ADDBUTTON INSIDECELL 1')
|
||||||
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
var buttonWidth = 150;
|
||||||
|
var buttonHeight = 50;
|
||||||
|
var buttonPadding = 10;
|
||||||
|
var offset = 1;
|
||||||
|
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
|
||||||
|
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
|
||||||
|
button = Overlays.addOverlay("image", {
|
||||||
|
x: buttonPositionX,
|
||||||
|
y: buttonPositionY,
|
||||||
|
width: buttonWidth,
|
||||||
|
height: buttonHeight,
|
||||||
|
imageURL: this.buttonImageURL,
|
||||||
|
visible: true,
|
||||||
|
alpha: 1.0
|
||||||
|
});
|
||||||
|
this.hasButton = true;
|
||||||
|
print('CELL ADDBUTTON INSIDECELL 2 button id is : ' +button)
|
||||||
|
} else {
|
||||||
|
print('CELL ADDBUTTON INSIDECELL FAIL - hasButton is' + this.hasButton)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onClick: function(event) {
|
||||||
|
//call to an internal function to get our scope back;
|
||||||
|
_this.handleClick(event);
|
||||||
|
},
|
||||||
|
handleClick: function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||||
|
x: event.x,
|
||||||
|
y: event.y
|
||||||
|
});
|
||||||
|
|
||||||
|
if (clickedOverlay === button) {
|
||||||
|
this.lookAtTarget();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lookAtTarget: function() {
|
||||||
|
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
|
||||||
|
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
MyAvatar.goToLocation(this.target, true, yaw);
|
||||||
|
|
||||||
|
MyAvatar.headYaw = 0;
|
||||||
|
},
|
||||||
|
unload: function() {
|
||||||
|
this.hasButton = false;
|
||||||
|
Overlays.deleteOverlay(button);
|
||||||
|
Controller.mousePressEvent.disconnect(this.onClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new NavButton();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,108 @@
|
||||||
|
// Copyright 2016 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
|
||||||
|
//
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var version = 12;
|
||||||
|
|
||||||
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
var button;
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
function NavButton() {
|
||||||
|
_this = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
NavButton.prototype = {
|
||||||
|
button: null,
|
||||||
|
buttonImageURL: baseURL + "GUI/GUI_Ribosome.png?" + version,
|
||||||
|
hasButton: false,
|
||||||
|
entryPoint: {
|
||||||
|
x: 13500,
|
||||||
|
y: 3000,
|
||||||
|
z: 3000
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
x: 3276.6,
|
||||||
|
y: 13703.3,
|
||||||
|
z: 4405.6
|
||||||
|
},
|
||||||
|
preload: function(entityId) {
|
||||||
|
print('CELL PRELOAD RIBOSOME 1')
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.addButton();
|
||||||
|
Controller.mousePressEvent.connect(this.onClick);
|
||||||
|
print('CELL PRELOAD RIBOSOME 2')
|
||||||
|
},
|
||||||
|
addButton: function() {
|
||||||
|
if (this.hasButton === false) {
|
||||||
|
print('CELL ADBUTTON RIBOSOME 1')
|
||||||
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
var buttonWidth = 150;
|
||||||
|
var buttonHeight = 50;
|
||||||
|
var buttonPadding = 10;
|
||||||
|
var offset = 2;
|
||||||
|
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
|
||||||
|
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
|
||||||
|
button = Overlays.addOverlay("image", {
|
||||||
|
x: buttonPositionX,
|
||||||
|
y: buttonPositionY,
|
||||||
|
width: buttonWidth,
|
||||||
|
height: buttonHeight,
|
||||||
|
imageURL: this.buttonImageURL,
|
||||||
|
visible: true,
|
||||||
|
alpha: 1.0
|
||||||
|
});
|
||||||
|
this.hasButton = true;
|
||||||
|
print('CELL ADDBUTTON RIBOSOME 2 button id is : ' +button)
|
||||||
|
} else {
|
||||||
|
print('CELL ADDBUTTON RIBOSOME FAIL - hasButton is' + this.hasButton)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onClick: function(event) {
|
||||||
|
//call to an internal function to get our scope back;
|
||||||
|
_this.handleClick(event);
|
||||||
|
},
|
||||||
|
handleClick: function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||||
|
x: event.x,
|
||||||
|
y: event.y
|
||||||
|
});
|
||||||
|
|
||||||
|
if (clickedOverlay === button) {
|
||||||
|
this.lookAtTarget();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lookAtTarget: function() {
|
||||||
|
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
|
||||||
|
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
MyAvatar.goToLocation(this.target, true, yaw);
|
||||||
|
|
||||||
|
MyAvatar.headYaw = 0;
|
||||||
|
},
|
||||||
|
unload: function() {
|
||||||
|
this.hasButton = false;
|
||||||
|
Overlays.deleteOverlay(button);
|
||||||
|
Controller.mousePressEvent.disconnect(this.onClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new NavButton();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
|
@ -14,7 +14,7 @@
|
||||||
Script.include(utilsScript);
|
Script.include(utilsScript);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
|
||||||
this.preload = function(entityId) {
|
this.preload = function(entityId) {
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
|
|
|
@ -6,113 +6,114 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var baseURL = "https://hifi-content.s3.amazonaws.com/hifi-content/DomainContent/CellScience/";
|
var baseURL = "https://hifi-production.s3.amazonaws.com/hifi-production/DomainContent/CellScience/";
|
||||||
var self = this;
|
var self = this;
|
||||||
this.buttonImageURL = baseURL + "GUI/play_audio.svg?2";
|
this.buttonImageURL = baseURL + "GUI/play_audio.svg?2";
|
||||||
|
|
||||||
|
this.preload = function(entityId) {
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.initialize(entityId)
|
||||||
|
this.initTimeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initialize = function(entityId) {
|
||||||
|
//print(' should initialize' + entityId)
|
||||||
|
var properties = Entities.getEntityProperties(entityId);
|
||||||
|
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
|
||||||
|
self.initTimeout = Script.setTimeout(function() {
|
||||||
|
// print(' no user data yet, try again in one second')
|
||||||
|
self.initialize(entityId);
|
||||||
|
}, 1000)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//print(' userdata before parse attempt' + properties.userData)
|
||||||
|
self.userData = null;
|
||||||
|
try {
|
||||||
|
self.userData = JSON.parse(properties.userData);
|
||||||
|
} catch (err) {
|
||||||
|
// print(' error parsing json');
|
||||||
|
// print(' properties are:' + properties.userData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.addButton();
|
||||||
|
self.buttonShowing = false;
|
||||||
|
self.showDistance = self.userData.showDistance;
|
||||||
|
self.soundURL = baseURL + "Audio/" + self.userData.soundName + ".wav";
|
||||||
|
// print("distance = " + self.userData.showDistance + ", sound = " + self.soundURL);
|
||||||
|
self.soundOptions = {
|
||||||
|
stereo: true,
|
||||||
|
loop: false,
|
||||||
|
localOnly: true,
|
||||||
|
volume: 1
|
||||||
|
};
|
||||||
|
self.sound = SoundCache.getSound(this.soundURL);
|
||||||
|
|
||||||
this.preload = function(entityId) {
|
|
||||||
this.entityId = entityId;
|
|
||||||
this.initialize(entityId)
|
|
||||||
this.initTimeout = null;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.initialize = function(entityId) {
|
this.addButton = function() {
|
||||||
//print(' should initialize' + entityId)
|
this.windowDimensions = Controller.getViewportDimensions();
|
||||||
var properties = Entities.getEntityProperties(entityId);
|
this.buttonWidth = 100;
|
||||||
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
|
this.buttonHeight = 100;
|
||||||
self.initTimeout = Script.setTimeout(function() {
|
this.buttonPadding = 0;
|
||||||
// print(' no user data yet, try again in one second')
|
|
||||||
self.initialize(entityId);
|
|
||||||
}, 1000)
|
|
||||||
|
|
||||||
|
this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth;
|
||||||
|
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding);
|
||||||
|
this.button = Overlays.addOverlay("image", {
|
||||||
|
x: self.buttonPositionX,
|
||||||
|
y: self.buttonPositionY,
|
||||||
|
width: self.buttonWidth,
|
||||||
|
height: self.buttonHeight,
|
||||||
|
imageURL: self.buttonImageURL,
|
||||||
|
visible: false,
|
||||||
|
alpha: 1.0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update = function(deltaTime) {
|
||||||
|
|
||||||
|
self.distance = Vec3.distance(MyAvatar.position, Entities.getEntityProperties(self.entityId).position);
|
||||||
|
//print(self.distance);
|
||||||
|
if (!self.buttonShowing && self.distance < self.userData.showDistance) {
|
||||||
|
self.buttonShowing = true;
|
||||||
|
Overlays.editOverlay(self.button, {
|
||||||
|
visible: true
|
||||||
|
});
|
||||||
|
} else if (self.buttonShowing && self.distance > self.userData.showDistance) {
|
||||||
|
self.buttonShowing = false;
|
||||||
|
Overlays.editOverlay(self.button, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.onClick = function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||||
|
x: event.x,
|
||||||
|
y: event.y
|
||||||
|
});
|
||||||
|
if (clickedOverlay === self.button) {
|
||||||
|
//print("button was clicked");
|
||||||
|
if (self.sound.downloaded) {
|
||||||
|
//print("play sound");
|
||||||
|
Audio.playSound(self.sound, self.soundOptions);
|
||||||
} else {
|
} else {
|
||||||
//print(' userdata before parse attempt' + properties.userData)
|
//print("not downloaded");
|
||||||
self.userData = null;
|
|
||||||
try {
|
|
||||||
self.userData = JSON.parse(properties.userData);
|
|
||||||
} catch (err) {
|
|
||||||
// print(' error parsing json');
|
|
||||||
// print(' properties are:' + properties.userData);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.addButton();
|
|
||||||
self.buttonShowing = false;
|
|
||||||
self.showDistance = self.userData.showDistance;
|
|
||||||
self.soundURL = baseURL + "Audio/" + self.userData.soundName + ".wav";
|
|
||||||
// print("distance = " + self.userData.showDistance + ", sound = " + self.soundURL);
|
|
||||||
self.soundOptions = {
|
|
||||||
stereo: true,
|
|
||||||
loop: false,
|
|
||||||
localOnly: true,
|
|
||||||
volume: 1
|
|
||||||
};
|
|
||||||
self.sound = SoundCache.getSound(this.soundURL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.addButton = function() {
|
this.unload = function() {
|
||||||
this.windowDimensions = Controller.getViewportDimensions();
|
Overlays.deleteOverlay(self.button);
|
||||||
this.buttonWidth = 100;
|
Controller.mousePressEvent.disconnect(this.onClick);
|
||||||
this.buttonHeight = 100;
|
Script.update.disconnect(this.update);
|
||||||
this.buttonPadding = 0;
|
if (this.initTimeout !== null) {
|
||||||
|
Script.clearTimeout(this.initTimeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth;
|
Controller.mousePressEvent.connect(this.onClick);
|
||||||
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding);
|
Script.update.connect(this.update);
|
||||||
this.button = Overlays.addOverlay("image", {
|
|
||||||
x: self.buttonPositionX,
|
|
||||||
y: self.buttonPositionY,
|
|
||||||
width: self.buttonWidth,
|
|
||||||
height: self.buttonHeight,
|
|
||||||
imageURL: self.buttonImageURL,
|
|
||||||
visible: false,
|
|
||||||
alpha: 1.0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.update = function(deltaTime) {
|
});
|
||||||
|
|
||||||
self.distance = Vec3.distance(MyAvatar.position, Entities.getEntityProperties(self.entityId).position);
|
|
||||||
//print(self.distance);
|
|
||||||
if (!self.buttonShowing && self.distance < self.userData.showDistance) {
|
|
||||||
self.buttonShowing = true;
|
|
||||||
Overlays.editOverlay(self.button, {
|
|
||||||
visible: true
|
|
||||||
});
|
|
||||||
} else if (self.buttonShowing && self.distance > self.userData.showDistance) {
|
|
||||||
self.buttonShowing = false;
|
|
||||||
Overlays.editOverlay(self.button, {
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.onClick = function(event) {
|
|
||||||
var clickedOverlay = Overlays.getOverlayAtPoint({
|
|
||||||
x: event.x,
|
|
||||||
y: event.y
|
|
||||||
});
|
|
||||||
if (clickedOverlay === self.button) {
|
|
||||||
//print("button was clicked");
|
|
||||||
if (self.sound.downloaded) {
|
|
||||||
//print("play sound");
|
|
||||||
Audio.playSound(self.sound, self.soundOptions);
|
|
||||||
} else {
|
|
||||||
//print("not downloaded");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.unload = function() {
|
|
||||||
Overlays.deleteOverlay(self.button);
|
|
||||||
Controller.mousePressEvent.disconnect(this.onClick);
|
|
||||||
Script.update.disconnect(this.update);
|
|
||||||
if (this.initTimeout !== null) {
|
|
||||||
Script.clearTimeout(this.initTimeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(this.onClick);
|
|
||||||
Script.update.connect(this.update);
|
|
||||||
|
|
||||||
});
|
|
|
@ -8,7 +8,7 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
|
||||||
var version = 3;
|
var version = 3;
|
||||||
this.preload = function(entityId) {
|
this.preload = function(entityId) {
|
||||||
|
|
|
@ -22,9 +22,14 @@
|
||||||
this.initialize = function(entityID) {
|
this.initialize = function(entityID) {
|
||||||
// print(' should initialize')
|
// print(' should initialize')
|
||||||
var properties = Entities.getEntityProperties(entityID);
|
var properties = Entities.getEntityProperties(entityID);
|
||||||
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
|
if (properties.hasOwnProperty('userData') === false) {
|
||||||
self.initTimeout = Script.setTimeout(function() {
|
self.initTimeout = Script.setTimeout(function() {
|
||||||
// print(' no user data yet, try again in one second')
|
// print(' no user data yet, try again in one second')
|
||||||
|
self.initialize(entityID);
|
||||||
|
}, 1000)
|
||||||
|
} else if (properties.userData.length === 0) {
|
||||||
|
self.initTimeout = Script.setTimeout(function() {
|
||||||
|
// print(' no user data yet, try again in one second')
|
||||||
self.initialize(entityID);
|
self.initialize(entityID);
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +44,7 @@
|
||||||
volume: 0.5
|
volume: 0.5
|
||||||
};
|
};
|
||||||
|
|
||||||
self.teleportSound = SoundCache.getSound("https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav");
|
self.teleportSound = SoundCache.getSound("https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav");
|
||||||
// print(" portal destination is " + self.portalDestination);
|
// print(" portal destination is " + self.portalDestination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +56,13 @@
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
|
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
|
||||||
|
|
||||||
MyAvatar.position = data.location;
|
MyAvatar.position = data.location;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lookAtTarget = function(entryPoint,target) {
|
this.lookAtTarget = function(entryPoint, target) {
|
||||||
//print('SHOULD LOOK AT TARGET')
|
//print('SHOULD LOOK AT TARGET')
|
||||||
var direction = Vec3.normalize(Vec3.subtract(entryPoint, target));
|
var direction = Vec3.normalize(Vec3.subtract(entryPoint, target));
|
||||||
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var soundMap = [{
|
var soundMap = [{
|
||||||
name: 'Cells',
|
name: 'Cells',
|
||||||
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Cells.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Cells.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15850,
|
x: 15850,
|
||||||
|
@ -12,7 +12,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Cell Layout',
|
name: 'Cell Layout',
|
||||||
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/CellLayout.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/CellLayout.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15950,
|
x: 15950,
|
||||||
|
@ -24,7 +24,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Ribsome',
|
name: 'Ribsome',
|
||||||
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Ribosome.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Ribosome.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15650,
|
x: 15650,
|
||||||
|
@ -36,7 +36,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Hexokinase',
|
name: 'Hexokinase',
|
||||||
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Hexokinase.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Hexokinase.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15750,
|
x: 15750,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,12 +9,8 @@ var numDynein = 2;
|
||||||
var numKinesin = 2;
|
var numKinesin = 2;
|
||||||
var percentOnMainMT = 100;
|
var percentOnMainMT = 100;
|
||||||
|
|
||||||
var baseLocation;
|
|
||||||
if (USE_LOCAL_HOST === true) {
|
baseLocation = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"
|
||||||
baseLocation = "http://localhost:8080/";
|
|
||||||
} else {
|
|
||||||
baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"
|
|
||||||
}
|
|
||||||
|
|
||||||
var WORLD_OFFSET = {
|
var WORLD_OFFSET = {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
|
|
@ -18,7 +18,6 @@ function offsetVectorToWorld(vector) {
|
||||||
|
|
||||||
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
|
||||||
return newVector
|
return newVector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ function offsetVectorToWorld(vector) {
|
||||||
|
|
||||||
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
|
||||||
return newVector
|
return newVector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue