mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-15 16:19:17 +02:00
updates
This commit is contained in:
parent
937ba3b796
commit
d920a3d721
6 changed files with 42 additions and 183 deletions
|
@ -1,17 +0,0 @@
|
||||||
// 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 deleteAllInRadius(r) {
|
|
||||||
var n = 0;
|
|
||||||
var arrayFound = Entities.findEntities(MyAvatar.position, r);
|
|
||||||
for (var i = 0; i < arrayFound.length; i++) {
|
|
||||||
Entities.deleteEntity(arrayFound[i]);
|
|
||||||
}
|
|
||||||
print("deleted " + arrayFound.length + " entities");
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteAllInRadius(100000);
|
|
|
@ -1,21 +0,0 @@
|
||||||
// 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
|
|
||||||
//
|
|
||||||
|
|
||||||
var scriptName = "Controller";
|
|
||||||
|
|
||||||
function findScriptsInRadius(r) {
|
|
||||||
var n = 0;
|
|
||||||
var arrayFound = Entities.findEntities(MyAvatar.position, r);
|
|
||||||
for (var i = 0; i < arrayFound.length; i++) {
|
|
||||||
if (Entities.getEntityProperties(arrayFound[i]).script.indexOf(scriptName) != -1) {
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print("found " + n + " copies of " + scriptName);
|
|
||||||
}
|
|
||||||
|
|
||||||
findScriptsInRadius(100000);
|
|
|
@ -23,22 +23,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initialize = function(entityId) {
|
this.initialize = function(entityId) {
|
||||||
// print(' should initialize' + entityId)
|
print('JBP nav button should initialize' + entityId)
|
||||||
var properties = Entities.getEntityProperties(entityId);
|
var properties = Entities.getEntityProperties(entityId);
|
||||||
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
|
if (properties.userData.length === 0 || 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('JBP no user data yet, try again in one second')
|
||||||
self.initialize(entityId);
|
self.initialize(entityId);
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// print(' userdata before parse attempt' + properties.userData)
|
print('JBP userdata before parse attempt' + properties.userData)
|
||||||
self.userData = null;
|
self.userData = null;
|
||||||
try {
|
try {
|
||||||
self.userData = JSON.parse(properties.userData);
|
self.userData = JSON.parse(properties.userData);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// print(' error parsing json');
|
print('JBP error parsing json');
|
||||||
// print(' properties are:' + properties.userData);
|
print('JBP properties are:' + properties.userData);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@
|
||||||
var mySavedSettings = Settings.getValue(entityId);
|
var mySavedSettings = Settings.getValue(entityId);
|
||||||
|
|
||||||
if (mySavedSettings.buttons !== undefined) {
|
if (mySavedSettings.buttons !== undefined) {
|
||||||
//print(' preload buttons' + mySavedSettings.buttons)
|
print('JBP preload buttons' + mySavedSettings.buttons)
|
||||||
mySavedSettings.buttons.forEach(function(b) {
|
mySavedSettings.buttons.forEach(function(b) {
|
||||||
//print(' deleting button' + b)
|
print('JBP deleting button' + b)
|
||||||
Overlays.deleteOverlay(b);
|
Overlays.deleteOverlay(b);
|
||||||
})
|
})
|
||||||
Settings.setValue(entityId, '')
|
Settings.setValue(entityId, '')
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
|
|
||||||
self.buttonImageURL = baseURL + "GUI/GUI_" + self.userData.name + ".png?" + version;
|
self.buttonImageURL = baseURL + "GUI/GUI_" + self.userData.name + ".png?" + version;
|
||||||
//print('BUTTON IMAGE URL:' + self.buttonImageURL)
|
print('JBP BUTTON IMAGE URL:' + self.buttonImageURL)
|
||||||
if (self.button === undefined) {
|
if (self.button === undefined) {
|
||||||
// print('NAV NO BUTTON ADDING ONE!!')
|
// print('NAV NO BUTTON ADDING ONE!!')
|
||||||
self.button = true;
|
self.button = true;
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
// 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 self = this;
|
|
||||||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
|
||||||
var version = 11;
|
|
||||||
this.preload = function(entityId) {
|
|
||||||
self.soundPlaying = false;
|
|
||||||
self.entityId = entityId;
|
|
||||||
this.initTimeout = null;
|
|
||||||
this.initialize(entityId);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//print(' USERDATA NAME ' + self.userData.name)
|
|
||||||
self.soundURL = baseURL + "Audio/" + self.userData.name + ".wav?" + version;
|
|
||||||
//print(" creating WAV name location is " + baseURL + "Audio/" + self.userData.name + ".wav");
|
|
||||||
//print(' self soundURL' + self.soundURL)
|
|
||||||
|
|
||||||
self.soundOptions = {
|
|
||||||
stereo: true,
|
|
||||||
loop: true,
|
|
||||||
localOnly: true,
|
|
||||||
volume: 0.035
|
|
||||||
};
|
|
||||||
|
|
||||||
self.sound = SoundCache.getSound(self.soundURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.enterEntity = function(entityID) {
|
|
||||||
//print("entering audio zone");
|
|
||||||
if (self.sound.downloaded) {
|
|
||||||
//print("playing background audio named " + self.userData.name + "which has been downloaded");
|
|
||||||
this.soundPlaying = Audio.playSound(self.sound, self.soundOptions);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//print("sound is not downloaded");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.leaveEntity = function(entityID) {
|
|
||||||
//print("leaving audio area " + self.userData.name);
|
|
||||||
if (self.soundPlaying !== false) {
|
|
||||||
//print("not null");
|
|
||||||
//print("Stopped sound " + self.userData.name);
|
|
||||||
self.soundPlaying.stop();
|
|
||||||
} else {
|
|
||||||
//print("Sound not playing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.unload = function() {
|
|
||||||
if (this.initTimeout !== null) {
|
|
||||||
Script.clearTimeout(this.initTimeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
|
@ -45,12 +45,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.enterEntity = function(entityID) {
|
this.enterEntity = function(entityID) {
|
||||||
print('JBP ENTERED A BOUNDARY ENTITY, SHOULD ZOOM', entityID)
|
//print('ENTERED A BOUNDARY ENTITY, SHOULD ZOOM', entityID)
|
||||||
|
|
||||||
var data = JSON.parse(Entities.getEntityProperties(this.entityId).userData);
|
var data = JSON.parse(Entities.getEntityProperties(this.entityId).userData);
|
||||||
print('JBP DATA IS::' + data)
|
//print('DATA IS::' + data)
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
print("JBP 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;
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lookAtTarget = function(entryPoint,target) {
|
this.lookAtTarget = function(entryPoint,target) {
|
||||||
print('JBP 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, {
|
||||||
x: 1,
|
x: 1,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var version = 1021;
|
var version = 1029;
|
||||||
var cellLayout;
|
var cellLayout;
|
||||||
var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ var scenes = [{
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
radius: 300,
|
radius: 300,
|
||||||
number: 15,
|
number: 7,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -188,7 +188,7 @@ var scenes = [{
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
radius: 1000,
|
radius: 1000,
|
||||||
number: 45,
|
number: 22,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -210,7 +210,7 @@ var scenes = [{
|
||||||
z: 976
|
z: 976
|
||||||
},
|
},
|
||||||
radius: 140,
|
radius: 140,
|
||||||
number: 20,
|
number: 10,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -232,7 +232,7 @@ var scenes = [{
|
||||||
z: 976
|
z: 976
|
||||||
},
|
},
|
||||||
radius: 115,
|
radius: 115,
|
||||||
number: 15,
|
number: 7,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -254,7 +254,7 @@ var scenes = [{
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
radius: 600,
|
radius: 600,
|
||||||
number: 30,
|
number: 15,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -276,7 +276,7 @@ var scenes = [{
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
radius: 1600,
|
radius: 1600,
|
||||||
number: 45,
|
number: 22,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -298,7 +298,7 @@ var scenes = [{
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
radius: 1400,
|
radius: 1400,
|
||||||
number: 45,
|
number: 22,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -320,7 +320,7 @@ var scenes = [{
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
radius: 1800,
|
radius: 1800,
|
||||||
number: 45,
|
number: 22,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -365,7 +365,7 @@ var scenes = [{
|
||||||
z: 771
|
z: 771
|
||||||
},
|
},
|
||||||
radius: 80,
|
radius: 80,
|
||||||
number: 15,
|
number: 7,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
|
@ -390,13 +390,15 @@ var scenes = [{
|
||||||
z: 771
|
z: 771
|
||||||
},
|
},
|
||||||
radius: 60,
|
radius: 60,
|
||||||
number: 15,
|
number: 7,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
}
|
},
|
||||||
|
target: locations.hexokinase[1],
|
||||||
|
location: locations.hexokinase[0],
|
||||||
}),
|
}),
|
||||||
script: "",
|
script: "zoom.js?" + version,
|
||||||
visible: true
|
visible: true
|
||||||
}, {
|
}, {
|
||||||
model: "glucose_isomerase",
|
model: "glucose_isomerase",
|
||||||
|
@ -412,13 +414,15 @@ var scenes = [{
|
||||||
z: 771
|
z: 771
|
||||||
},
|
},
|
||||||
radius: 70,
|
radius: 70,
|
||||||
number: 15,
|
number: 7,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
}
|
},
|
||||||
|
target: locations.hexokinase[1],
|
||||||
|
location: locations.hexokinase[0],
|
||||||
}),
|
}),
|
||||||
script: "",
|
script: "zoom.js?" + version,
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
|
@ -598,8 +602,6 @@ function ImportScene(scene) {
|
||||||
CreateInstances(scene);
|
CreateInstances(scene);
|
||||||
CreateBoundary(scene);
|
CreateBoundary(scene);
|
||||||
|
|
||||||
// CreateBackgroundAudio(scene.name, scene.location, scene.dimensions);
|
|
||||||
|
|
||||||
// print("done " + scene.name);
|
// print("done " + scene.name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -647,7 +649,7 @@ function CreateNavigationButton(scene, number) {
|
||||||
|
|
||||||
|
|
||||||
Entities.addEntity({
|
Entities.addEntity({
|
||||||
type: "Sphere",
|
type: "Box",
|
||||||
name: scene.name + " navigation button",
|
name: scene.name + " navigation button",
|
||||||
color: {
|
color: {
|
||||||
red: 200,
|
red: 200,
|
||||||
|
@ -655,9 +657,9 @@ function CreateNavigationButton(scene, number) {
|
||||||
blue: 0
|
blue: 0
|
||||||
},
|
},
|
||||||
dimensions: {
|
dimensions: {
|
||||||
x: 10,
|
x: 16000,
|
||||||
y: 10,
|
y: 16000,
|
||||||
z: 10
|
z: 16000
|
||||||
},
|
},
|
||||||
visible: false,
|
visible: false,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
|
@ -670,10 +672,13 @@ function CreateNavigationButton(scene, number) {
|
||||||
grabbable: false
|
grabbable: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// position:{x:3000,y:13500,z:3000},
|
position: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
script: baseLocation + "Scripts/navigationButton.js?" + version,
|
script: baseLocation + "Scripts/navigationButton.js?" + version,
|
||||||
collisionless: true,
|
collisionless: true,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -850,27 +855,6 @@ function CreateIdentification(name, position, rotation, dimensions, showDistance
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateBackgroundAudio(name, position) {
|
|
||||||
Entities.addEntity({
|
|
||||||
type: "Sphere",
|
|
||||||
name: "Location " + name + " background audio",
|
|
||||||
dimensions: {
|
|
||||||
x: 4000,
|
|
||||||
y: 4000,
|
|
||||||
z: 4000
|
|
||||||
},
|
|
||||||
position: position,
|
|
||||||
visible: false,
|
|
||||||
userData: JSON.stringify({
|
|
||||||
name: name,
|
|
||||||
baseURL: baseLocation
|
|
||||||
}),
|
|
||||||
script: baseLocation + "Scripts/playBackgroundAudio.js?" + version,
|
|
||||||
collisionless: true,
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPointOnSphereOfRadius(radius, number, totalNumber) {
|
function getPointOnSphereOfRadius(radius, number, totalNumber) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue