mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 06:49:41 +02:00
move cellscience
This commit is contained in:
parent
b780fad83f
commit
b08a9baa5c
5 changed files with 157 additions and 77 deletions
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
this.initialize = function(entityId) {
|
this.initialize = function(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 || properties.userData==="") {
|
||||||
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);
|
self.initialize(entityId);
|
||||||
|
|
|
@ -5,80 +5,115 @@
|
||||||
// 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 = 1112;
|
var version = 1207;
|
||||||
|
|
||||||
|
var WORLD_OFFSET = {
|
||||||
|
x: -6000,
|
||||||
|
y: -6000,
|
||||||
|
z: -6000
|
||||||
|
}
|
||||||
|
|
||||||
|
var WORLD_SCALE_AMOUNT = 1.0;
|
||||||
|
|
||||||
|
|
||||||
|
function offsetVectorToWorld(vector) {
|
||||||
|
var newVector;
|
||||||
|
|
||||||
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
|
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
||||||
|
return newVector
|
||||||
|
}
|
||||||
|
|
||||||
|
function scaleVectorToWorld(vector) {
|
||||||
|
var newVector;
|
||||||
|
|
||||||
|
newVector = Vec3.multiply(vector, WORLD_SCALE_AMOUNT);
|
||||||
|
|
||||||
|
return newVector
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformToSmallerWorld(vector) {
|
||||||
|
var newVector = offsetVectorToWorld(vector);
|
||||||
|
// newVector = scaleVectorToWorld(newVector);
|
||||||
|
return newVector;
|
||||||
|
}
|
||||||
|
|
||||||
var cellLayout;
|
var cellLayout;
|
||||||
var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
||||||
|
|
||||||
var utilsScript = Script.resolvePath('Scripts/utils.js');
|
var utilsScript = Script.resolvePath('Scripts/utils.js');
|
||||||
Script.include(utilsScript);
|
Script.include(utilsScript);
|
||||||
|
|
||||||
function makeUngrabbable(entityID) {
|
// function makeUngrabbable(entityID) {
|
||||||
setEntityCustomData('grabbableKey', entityID, {
|
// setEntityCustomData('grabbableKey', entityID, {
|
||||||
grabbable: false
|
// grabbable: false
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
Entities.addingEntity.connect(makeUngrabbable);
|
// Entities.addingEntity.connect(makeUngrabbable);
|
||||||
|
|
||||||
assignVariables();
|
assignVariables();
|
||||||
|
|
||||||
var locations = {
|
var locations = {
|
||||||
cellLayout: [{
|
cellLayout: [offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
}, {
|
}), offsetVectorToWorld({
|
||||||
x: 3276.6,
|
x: 3276.6,
|
||||||
y: 13703.3,
|
y: 10703.3,
|
||||||
z: 4405.6
|
z: 4405.6
|
||||||
}, 1800],
|
}), 1800],
|
||||||
cells: [{
|
cells: [offsetVectorToWorld({
|
||||||
x: 13500,
|
x: 13500,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 13500
|
z: 13500
|
||||||
}, {
|
}), offsetVectorToWorld({
|
||||||
x: 13501,
|
x: 13501,
|
||||||
y: 13501,
|
y: 10501,
|
||||||
z: 13501
|
z: 13501
|
||||||
}, 400],
|
}), 400],
|
||||||
ribosome: [{
|
ribosome: [offsetVectorToWorld({
|
||||||
x: 13500,
|
x: 13500,
|
||||||
y: 3000,
|
y: 3000,
|
||||||
z: 3000
|
z: 3000
|
||||||
}, {
|
}), offsetVectorToWorld({
|
||||||
x: 13685,
|
x: 13685,
|
||||||
y: 3248,
|
y: 3248,
|
||||||
z: 2861
|
z: 2861
|
||||||
}, 1000],
|
}), 1000],
|
||||||
hexokinase: [{
|
hexokinase: [offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 3000,
|
y: 3000,
|
||||||
z: 13500
|
z: 13500
|
||||||
}, {
|
}), offsetVectorToWorld({
|
||||||
x: 2755,
|
x: 2755,
|
||||||
y: 3121,
|
y: 3121,
|
||||||
z: 13501
|
z: 13501
|
||||||
}, 2000],
|
}), 2000],
|
||||||
mitochondria: [{
|
mitochondria: [offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
}, {
|
}), offsetVectorToWorld({
|
||||||
x: 3240,
|
x: 3240,
|
||||||
y: 13519,
|
y: 13519,
|
||||||
z: 3874
|
z: 3874
|
||||||
}, 1000],
|
}), 1000],
|
||||||
translation: [{
|
translation: [offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
}, {
|
}), offsetVectorToWorld({
|
||||||
x: 2962,
|
x: 2962,
|
||||||
y: 13492,
|
y: 10492,
|
||||||
z: 3342
|
z: 3342
|
||||||
}, 1000]
|
}), 1000]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
print('JBP locations locations' +JSON.stringify(locations))
|
||||||
|
|
||||||
var scenes = [{
|
var scenes = [{
|
||||||
name: "Cells",
|
name: "Cells",
|
||||||
objects: "",
|
objects: "",
|
||||||
|
@ -507,7 +542,6 @@ var scenes = [{
|
||||||
|
|
||||||
function ImportScene(scene) {
|
function ImportScene(scene) {
|
||||||
|
|
||||||
|
|
||||||
var sceneDataLines = scene.objects.split(";");
|
var sceneDataLines = scene.objects.split(";");
|
||||||
for (var i = 1; i < sceneDataLines.length; i++) {
|
for (var i = 1; i < sceneDataLines.length; i++) {
|
||||||
var data = sceneDataLines[i].split(",");
|
var data = sceneDataLines[i].split(",");
|
||||||
|
@ -565,27 +599,15 @@ function ImportScene(scene) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearAllNav();
|
|
||||||
|
|
||||||
function clearAllNav() {
|
|
||||||
var result = Entities.findEntities(MyAvatar.position, 25000);
|
|
||||||
result.forEach(function(r) {
|
|
||||||
var properties = Entities.getEntityProperties(r, "name");
|
|
||||||
if (properties.name.indexOf('navigation button') > -1) {
|
|
||||||
Entities.deleteEntity(r);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function createLayoutLights() {
|
function createLayoutLights() {
|
||||||
Entities.addEntity({
|
Entities.addEntity({
|
||||||
type: "Light",
|
type: "Light",
|
||||||
name: "Cell layout light",
|
name: "Cell layout light",
|
||||||
position: {
|
position:offsetVectorToWorld( {
|
||||||
x: 3110,
|
x: 3110,
|
||||||
y: 13660,
|
y: 10660,
|
||||||
z: 3785
|
z: 3785
|
||||||
},
|
}),
|
||||||
dimensions: {
|
dimensions: {
|
||||||
x: 1500,
|
x: 1500,
|
||||||
y: 1500,
|
y: 1500,
|
||||||
|
@ -602,7 +624,8 @@ function createLayoutLights() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateNavigationButton(scene, number) {
|
function CreateNavigationButton(scene, number) {
|
||||||
Entities.addEntity({
|
|
||||||
|
var nav = Entities.addEntity({
|
||||||
type: "Box",
|
type: "Box",
|
||||||
name: scene.name + " navigation button",
|
name: scene.name + " navigation button",
|
||||||
color: {
|
color: {
|
||||||
|
@ -634,7 +657,7 @@ function CreateNavigationButton(scene, number) {
|
||||||
script: baseLocation + "Scripts/navigationButton.js?" + version,
|
script: baseLocation + "Scripts/navigationButton.js?" + version,
|
||||||
collisionless: true,
|
collisionless: true,
|
||||||
});
|
});
|
||||||
|
print('JBP CREATE NAV AT::' +nav+" name: " + scene.name + ": " + JSON.stringify(scene.location))
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateBoundary(scene) {
|
function CreateBoundary(scene) {
|
||||||
|
@ -8990,10 +9013,13 @@ function assignVariables() {
|
||||||
|
|
||||||
for (var i = 0; i < scenes.length; i++) {
|
for (var i = 0; i < scenes.length; i++) {
|
||||||
// print('setting up scene. first, delete' + JSON.stringify(scenes[i]))
|
// print('setting up scene. first, delete' + JSON.stringify(scenes[i]))
|
||||||
deleteAllInRadius(scenes[i].location, scenes[i].zone.dimensions.x);
|
// deleteAllInRadius(scenes[i].location, scenes[i].zone.dimensions.x);
|
||||||
|
CreateNavigationButton(scenes[i], i);
|
||||||
|
|
||||||
ImportScene(scenes[i]);
|
ImportScene(scenes[i]);
|
||||||
// print('setting up scene. then import')
|
// print('setting up scene. then import')
|
||||||
CreateNavigationButton(scenes[i], i);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createLayoutLights();
|
createLayoutLights();
|
||||||
|
@ -9002,7 +9028,7 @@ Script.scriptEnding.connect(function() {
|
||||||
Entities.addingEntity.disconnect(makeUngrabbable);
|
Entities.addingEntity.disconnect(makeUngrabbable);
|
||||||
});
|
});
|
||||||
|
|
||||||
Script.setTimeout(function() {
|
// Script.setTimeout(function() {
|
||||||
print('JBP stopping cell science import');
|
// print('JBP stopping cell science import');
|
||||||
Script.stop();
|
// Script.stop();
|
||||||
}, 30000)
|
// }, 30000)
|
|
@ -16,13 +16,32 @@ if (USE_LOCAL_HOST === true) {
|
||||||
baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"
|
baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var WORLD_OFFSET = {
|
||||||
|
x: -6000,
|
||||||
|
y: -6000,
|
||||||
|
z: -6000
|
||||||
|
}
|
||||||
|
|
||||||
|
var WORLD_SCALE_AMOUNT = 1.0;
|
||||||
|
|
||||||
|
function offsetVectorToWorld(vector) {
|
||||||
|
var newVector;
|
||||||
|
|
||||||
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
|
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
||||||
|
return newVector
|
||||||
|
}
|
||||||
|
|
||||||
var USE_LOCAL_HOST = false;
|
var USE_LOCAL_HOST = false;
|
||||||
|
|
||||||
EntityViewer.setPosition({
|
var basePosition = offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
EntityViewer.setPosition(basePosition);
|
||||||
EntityViewer.setKeyholeRadius(60000);
|
EntityViewer.setKeyholeRadius(60000);
|
||||||
var octreeQueryInterval = Script.setInterval(function() {
|
var octreeQueryInterval = Script.setInterval(function() {
|
||||||
EntityViewer.queryOctree();
|
EntityViewer.queryOctree();
|
||||||
|
@ -44,11 +63,12 @@ var scriptURL = this.baseLocation + "Scripts/clickToRideAndLook.js?" + Math.rand
|
||||||
|
|
||||||
var t = 0;
|
var t = 0;
|
||||||
var tInc = 0.001;
|
var tInc = 0.001;
|
||||||
var sceneOffset = {
|
var sceneOffset = offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
};
|
});
|
||||||
|
|
||||||
var yOffset = {
|
var yOffset = {
|
||||||
dynein: 16,
|
dynein: 16,
|
||||||
kinesin: -28
|
kinesin: -28
|
||||||
|
@ -60,11 +80,11 @@ var terms;
|
||||||
var secondaryInit = false;
|
var secondaryInit = false;
|
||||||
|
|
||||||
function deleteAllMotorProteins() {
|
function deleteAllMotorProteins() {
|
||||||
var position = {
|
var position = offsetVectorToWorld({
|
||||||
x: 3280,
|
x: 3280,
|
||||||
y: 13703,
|
y: 10703,
|
||||||
z: 4405
|
z: 4405
|
||||||
};
|
});
|
||||||
|
|
||||||
if (secondaryInit === true) {
|
if (secondaryInit === true) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,12 +4,29 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// 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 WORLD_OFFSET = {
|
||||||
|
x: -6000,
|
||||||
|
y: -6000,
|
||||||
|
z: -6000
|
||||||
|
}
|
||||||
|
|
||||||
var basePosition = {
|
var WORLD_SCALE_AMOUNT = 1.0;
|
||||||
|
|
||||||
|
|
||||||
|
function offsetVectorToWorld(vector) {
|
||||||
|
var newVector;
|
||||||
|
|
||||||
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
|
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
||||||
|
return newVector
|
||||||
|
}
|
||||||
|
|
||||||
|
var basePosition = offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
};
|
}, WORLD_OFFSET);
|
||||||
|
|
||||||
var initialized = false;
|
var initialized = false;
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,29 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// 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 WORLD_OFFSET = {
|
||||||
|
x: -6000,
|
||||||
|
y: -6000,
|
||||||
|
z: -6000
|
||||||
|
}
|
||||||
|
|
||||||
var basePosition = {
|
var WORLD_SCALE_AMOUNT = 1.0;
|
||||||
|
|
||||||
|
function offsetVectorToWorld(vector) {
|
||||||
|
var newVector;
|
||||||
|
|
||||||
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
|
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
||||||
|
return newVector
|
||||||
|
}
|
||||||
|
|
||||||
|
var basePosition = offsetVectorToWorld({
|
||||||
x: 3000,
|
x: 3000,
|
||||||
y: 13500,
|
y: 10500,
|
||||||
z: 3000
|
z: 3000
|
||||||
};
|
}, WORLD_OFFSET);
|
||||||
|
|
||||||
|
|
||||||
var initialized = false;
|
var initialized = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue