mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 09:42:20 +02:00
cleanup and fix script paths to get random movement working again
This commit is contained in:
parent
0e036d3e2c
commit
514edee3f1
11 changed files with 190 additions and 220 deletions
|
@ -7,10 +7,18 @@ var spriteDimensions = {
|
|||
var sprite;
|
||||
var isMouseDown = false;
|
||||
var RAD_TO_DEG = 180.0 / Math.PI;
|
||||
var Y_AXIS = { x: 0, y: 1, z: 0 };
|
||||
var X_AXIS = { x: 1, y: 0, z: 0 };
|
||||
var Y_AXIS = {
|
||||
x: 0,
|
||||
y: 1,
|
||||
z: 0
|
||||
};
|
||||
var X_AXIS = {
|
||||
x: 1,
|
||||
y: 0,
|
||||
z: 0
|
||||
};
|
||||
|
||||
function MakeSprite () {
|
||||
function MakeSprite() {
|
||||
sprite = Entities.addEntity({
|
||||
type: "Model",
|
||||
name: "sprite",
|
||||
|
@ -21,9 +29,9 @@ function MakeSprite () {
|
|||
});
|
||||
}
|
||||
|
||||
function UpdateOrientation (event) {
|
||||
function UpdateOrientation(event) {
|
||||
if (isMouseDown && event.isRightButton) {
|
||||
|
||||
|
||||
var direction,
|
||||
yaw,
|
||||
pitch,
|
||||
|
@ -33,7 +41,7 @@ function UpdateOrientation (event) {
|
|||
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||
rot = Quat.multiply(yaw, pitch);
|
||||
|
||||
|
||||
var avatar = Quat.safeEulerAngles(MyAvatar.orientation);
|
||||
var printRot = Quat.safeEulerAngles(rot);
|
||||
print("avatar = (" + avatar.x + ", " + avatar.y + ", " + avatar.z + ")");
|
||||
|
@ -55,4 +63,4 @@ function OnMouseUp(event) {
|
|||
MakeSprite();
|
||||
Controller.mouseMoveEvent.connect(UpdateOrientation);
|
||||
Controller.mousePressEvent.connect(OnMouseDown);
|
||||
Controller.mouseReleaseEvent.connect(OnMouseUp);
|
||||
Controller.mouseReleaseEvent.connect(OnMouseUp);
|
|
@ -9,7 +9,7 @@
|
|||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
this.preload = function(entityId) {
|
||||
|
||||
this.entityId = entityId;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
function deleteAllInRadius (r)
|
||||
{
|
||||
var n = 0;
|
||||
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]);
|
||||
Entities.deleteEntity(arrayFound[i]);
|
||||
}
|
||||
print("deleted " + arrayFound.length + " entities");
|
||||
print("deleted " + arrayFound.length + " entities");
|
||||
}
|
||||
|
||||
deleteAllInRadius(100000);
|
|
@ -1,15 +1,14 @@
|
|||
var scriptName = "Controller";
|
||||
|
||||
function findScriptsInRadius(r)
|
||||
{
|
||||
var n = 0;
|
||||
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) {
|
||||
if (Entities.getEntityProperties(arrayFound[i]).script.indexOf(scriptName) != -1) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
print("found " + n + " copies of " + scriptName);
|
||||
print("found " + n + " copies of " + scriptName);
|
||||
}
|
||||
|
||||
findScriptsInRadius(100000);
|
|
@ -1,68 +1,76 @@
|
|||
(function(){
|
||||
|
||||
(function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
this.preload = function(entityId) {
|
||||
|
||||
this.entityId = entityId;
|
||||
this.updateInterval = 100;
|
||||
this.posFrame = 0;
|
||||
this.rotFrame = 0;
|
||||
this.posInterval=100;
|
||||
this.rotInterval=100;
|
||||
this.rotFrame = 0;
|
||||
this.posInterval = 100;
|
||||
this.rotInterval = 100;
|
||||
this.minVelocity = 1;
|
||||
this.maxVelocity = 5;
|
||||
this.minAngularVelocity = 0.01;
|
||||
this.maxAngularVelocity = 0.03;
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.update = function(deltaTime) {
|
||||
|
||||
|
||||
self.posFrame++;
|
||||
self.rotFrame++;
|
||||
self.rotFrame++;
|
||||
|
||||
if (self.posFrame > self.posInterval) {
|
||||
|
||||
self.posInterval = 100 * Math.random() + 300;
|
||||
|
||||
self.posInterval = 100 * Math.random() + 300;
|
||||
self.posFrame = 0;
|
||||
|
||||
var magnitudeV = self.maxVelocity;
|
||||
var directionV = {x: Math.random() - 0.5, y: Math.random() - 0.5, z: Math.random() - 0.5};
|
||||
var directionV = {
|
||||
x: Math.random() - 0.5,
|
||||
y: Math.random() - 0.5,
|
||||
z: Math.random() - 0.5
|
||||
};
|
||||
|
||||
// print("POS magnitude is " + magnitudeV + " and direction is " + directionV.x);
|
||||
// print("POS magnitude is " + magnitudeV + " and direction is " + directionV.x);
|
||||
Entities.editEntity(self.entityId, {
|
||||
velocity: Vec3.multiply(magnitudeV, Vec3.normalize(directionV))
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (self.rotFrame > self.rotInterval) {
|
||||
|
||||
self.rotInterval = 100 * Math.random() +250;
|
||||
|
||||
if (self.rotFrame > self.rotInterval) {
|
||||
|
||||
self.rotInterval = 100 * Math.random() + 250;
|
||||
self.rotFrame = 0;
|
||||
|
||||
var magnitudeAV = self.maxAngularVelocity;
|
||||
|
||||
var directionAV = {x: Math.random() - 0.5, y: Math.random() - 0.5, z: Math.random() - 0.5};
|
||||
// print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
|
||||
|
||||
var directionAV = {
|
||||
x: Math.random() - 0.5,
|
||||
y: Math.random() - 0.5,
|
||||
z: Math.random() - 0.5
|
||||
};
|
||||
// print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
|
||||
Entities.editEntity(self.entityId, {
|
||||
angularVelocity: Vec3.multiply(magnitudeAV, Vec3.normalize(directionAV))
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.unload = function() {
|
||||
|
||||
|
||||
Script.update.disconnect(this.update);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Script.update.connect(this.update);
|
||||
|
||||
|
||||
})
|
|
@ -1,49 +0,0 @@
|
|||
(function(){
|
||||
|
||||
var self = this;
|
||||
|
||||
this.preload = function(entityId) {
|
||||
|
||||
this.entityId = entityId;
|
||||
this.updateInterval = 30;
|
||||
this.frame = 0;
|
||||
|
||||
this.minVelocity = 0.15;
|
||||
this.maxVelocity = 0.35;
|
||||
this.minAngularVelocity = 0.3;
|
||||
this.maxAngularVelocity = 0.7;
|
||||
|
||||
}
|
||||
|
||||
this.update = function(deltaTime) {
|
||||
|
||||
self.frame++;
|
||||
|
||||
if (self.frame > self.updateInterval) {
|
||||
|
||||
self.updateInterval = 20 * Math.random() + 0;
|
||||
self.frame = 0;
|
||||
|
||||
var magnitudeV = (self.maxVelocity - self.minVelocity) * Math.random() + self.minVelocity;
|
||||
var magnitudeAV = (self.maxAngularVelocity - self.minAngularVelocity) * Math.random() + self.minAngularVelocity;
|
||||
var directionV = {x: Math.random() - 0.5, y: Math.random() - 0.5, z: Math.random() - 0.5};
|
||||
var directionAV = {x: Math.random() - 0.5, y: Math.random() - 0.5, z: Math.random() - 0.5};
|
||||
|
||||
Entities.editEntity(self.entityId, {
|
||||
velocity: Vec3.multiply(magnitudeV, Vec3.normalize(directionV)),
|
||||
angularVelocity: Vec3.multiply(magnitudeAV, Vec3.normalize(directionAV))
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.unload = function() {
|
||||
|
||||
Script.update.disconnect(this.update);
|
||||
|
||||
}
|
||||
|
||||
Script.update.connect(this.update);
|
||||
|
||||
})
|
|
@ -1,5 +1,5 @@
|
|||
(function() {
|
||||
var baseURL ="https://hifi-content.s3.amazonaws.com/hifi-content/DomainContent/CellScience/";
|
||||
var baseURL = "https://hifi-content.s3.amazonaws.com/hifi-content/DomainContent/CellScience/";
|
||||
var self = this;
|
||||
this.buttonImageURL = baseURL + "GUI/play_audio.svg?2";
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
stereo: true,
|
||||
loop: false,
|
||||
localOnly: true,
|
||||
volume:0.5
|
||||
volume: 0.5
|
||||
};
|
||||
this.sound = SoundCache.getSound(this.soundURL);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
(function() {
|
||||
|
||||
var self = this;
|
||||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
||||
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
||||
|
||||
var version = 1;
|
||||
this.preload = function(entityId) {
|
||||
this.soundPlaying=null;
|
||||
this.soundPlaying = null;
|
||||
this.entityId = entityId;
|
||||
self.getUserData();
|
||||
this.labelURL = baseURL + "GUI/labels_" + self.userData.name + ".png?" + version;
|
||||
|
@ -119,7 +119,7 @@ var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"
|
|||
|
||||
this.unload = function() {
|
||||
Overlays.deleteOverlay(self.button);
|
||||
if(this.soundPlaying!==null) {
|
||||
if (this.soundPlaying !== null) {
|
||||
this.soundPlaying.stop();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
setEntityUserData = function(id, data) {
|
||||
var json = JSON.stringify(data)
|
||||
Entities.editEntity(id, { userData: json });
|
||||
Entities.editEntity(id, {
|
||||
userData: json
|
||||
});
|
||||
}
|
||||
|
||||
// FIXME do non-destructive modification of the existing user data
|
||||
|
@ -10,7 +12,7 @@ getEntityUserData = function(id) {
|
|||
if (properties.userData) {
|
||||
try {
|
||||
results = JSON.parse(properties.userData);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
logDebug(err);
|
||||
logDebug(properties.userData);
|
||||
}
|
||||
|
@ -37,4 +39,4 @@ getEntityCustomData = function(customKey, id, defaultValue) {
|
|||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,80 +1,85 @@
|
|||
(function(){
|
||||
var teleport;
|
||||
var portalDestination;
|
||||
var animationURL;
|
||||
var self=this;
|
||||
(function() {
|
||||
var teleport;
|
||||
var portalDestination;
|
||||
var animationURL;
|
||||
var self = this;
|
||||
|
||||
this.entered = true;
|
||||
this.entered = true;
|
||||
|
||||
this.preload = function(entityID) {
|
||||
this.preload = function(entityID) {
|
||||
|
||||
this.entityId = entityID;
|
||||
this.entityId = entityID;
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
portalDestination = properties.userData;
|
||||
animationURL = properties.modelURL;
|
||||
this.soundOptions = {
|
||||
stereo: true,
|
||||
loop: false,
|
||||
localOnly: false,
|
||||
position:this.position,
|
||||
volume: 0.5
|
||||
};
|
||||
this.teleportSound = SoundCache.getSound("https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav");
|
||||
print('JBP PRELOADING A ZOOM ENTITY')
|
||||
print(" portal destination is " + portalDestination);
|
||||
}
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
portalDestination = properties.userData;
|
||||
animationURL = properties.modelURL;
|
||||
this.soundOptions = {
|
||||
stereo: true,
|
||||
loop: false,
|
||||
localOnly: false,
|
||||
position: this.position,
|
||||
volume: 0.5
|
||||
};
|
||||
this.teleportSound = SoundCache.getSound("https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav");
|
||||
//print('JBP PRELOADING A ZOOM ENTITY')
|
||||
print(" portal destination is " + portalDestination);
|
||||
}
|
||||
|
||||
this.enterEntity = function(entityID) {
|
||||
print('ENTERED A BOUNDARY ENTITY, SHOULD ZOOM', entityID)
|
||||
this.enterEntity = function(entityID) {
|
||||
print('JBP 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);
|
||||
|
||||
|
||||
if (data != null) {
|
||||
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
|
||||
if (self.teleportSound.downloaded) {
|
||||
//print("play sound");
|
||||
Audio.playSound(self.teleportSound, self.soundOptions);
|
||||
} else {
|
||||
//print("not downloaded");
|
||||
}
|
||||
if (data != null) {
|
||||
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
|
||||
if (self.teleportSound.downloaded) {
|
||||
//print("play sound");
|
||||
Audio.playSound(self.teleportSound, self.soundOptions);
|
||||
} else {
|
||||
//print("not downloaded");
|
||||
}
|
||||
|
||||
this.lookAt(data.target, data.location);
|
||||
|
||||
this.lookAt(data.target, data.location);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.lookAt = function(targetPosition, avatarPosition) {
|
||||
var direction = Vec3.normalize(Vec3.subtract(MyAvatar.position, targetPosition));
|
||||
}
|
||||
|
||||
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});
|
||||
this.lookAt = function(targetPosition, avatarPosition) {
|
||||
var direction = Vec3.normalize(Vec3.subtract(MyAvatar.position, targetPosition));
|
||||
|
||||
// var rotation = Quat.multiply(yaw, pitch);
|
||||
// MyAvatar.orientation = rotation;
|
||||
|
||||
MyAvatar.goToLocation(avatarPosition, true, yaw);
|
||||
MyAvatar.headYaw = 0;
|
||||
}
|
||||
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(avatarPosition, true, yaw);
|
||||
MyAvatar.headYaw = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.leaveEntity = function(entityID) {
|
||||
Entities.editEntity(entityID, {
|
||||
animationURL: animationURL,
|
||||
animationSettings: '{ "frameIndex": 1, "running": false }'
|
||||
});
|
||||
this.entered = false;
|
||||
//playSound();
|
||||
}
|
||||
this.leaveEntity = function(entityID) {
|
||||
Entities.editEntity(entityID, {
|
||||
animationURL: animationURL,
|
||||
animationSettings: '{ "frameIndex": 1, "running": false }'
|
||||
});
|
||||
this.entered = false;
|
||||
//playSound();
|
||||
}
|
||||
|
||||
this.hoverEnterEntity = function(entityID) {
|
||||
Entities.editEntity(entityID, {
|
||||
animationURL: animationURL,
|
||||
animationSettings: '{ "fps": 24, "firstFrame": 1, "lastFrame": 25, "frameIndex": 1, "running": true, "hold": true }'
|
||||
});
|
||||
}
|
||||
})
|
||||
this.hoverEnterEntity = function(entityID) {
|
||||
Entities.editEntity(entityID, {
|
||||
animationURL: animationURL,
|
||||
animationSettings: '{ "fps": 24, "firstFrame": 1, "lastFrame": 25, "frameIndex": 1, "running": true, "hold": true }'
|
||||
});
|
||||
}
|
||||
})
|
|
@ -1,16 +1,18 @@
|
|||
var version = 1001;
|
||||
var version = 1003;
|
||||
var cellLayout;
|
||||
var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
|
||||
|
||||
var utilsScript = Script.resolvePath('Scripts/utils.js');
|
||||
Script.include(utilsScript);
|
||||
|
||||
function makeUngrabbable(entityID){
|
||||
setEntityCustomData('grabbableKey', entityID, {grabbable:false});
|
||||
function makeUngrabbable(entityID) {
|
||||
setEntityCustomData('grabbableKey', entityID, {
|
||||
grabbable: false
|
||||
});
|
||||
}
|
||||
|
||||
Entities.addingEntity.connect(makeUngrabbable);
|
||||
|
||||
|
||||
assignVariables();
|
||||
|
||||
var locations = {
|
||||
|
@ -70,9 +72,7 @@ var locations = {
|
|||
}, 1000]
|
||||
};
|
||||
|
||||
|
||||
var scenes = [
|
||||
|
||||
{
|
||||
name: "Cells",
|
||||
objects: "",
|
||||
|
@ -108,7 +108,7 @@ var scenes = [
|
|||
},
|
||||
radius: 500,
|
||||
number: 10,
|
||||
script: "moveRandomly",
|
||||
script: "moveRandomly.js?" + version,
|
||||
visible: true
|
||||
}],
|
||||
boundary: {
|
||||
|
@ -160,7 +160,7 @@ var scenes = [
|
|||
location: locations.ribosome[0],
|
||||
baseURL: baseLocation
|
||||
}),
|
||||
script:"zoom.js?" + version,
|
||||
script: "zoom.js?" + version,
|
||||
visible: true
|
||||
}, {
|
||||
model: "vesicle",
|
||||
|
@ -182,7 +182,7 @@ var scenes = [
|
|||
grabbable: false
|
||||
}
|
||||
}),
|
||||
script: "moveRandomly",
|
||||
script: "moveRandomly.js?" + version,
|
||||
visible: true
|
||||
}, { //golgi vesicles
|
||||
model: "vesicle",
|
||||
|
@ -226,7 +226,7 @@ var scenes = [
|
|||
grabbable: false
|
||||
}
|
||||
}),
|
||||
script: "moveRandomly",
|
||||
script: "moveRandomly.js?" + version,
|
||||
visible: true
|
||||
}, {
|
||||
model: "vesicle",
|
||||
|
@ -292,7 +292,7 @@ var scenes = [
|
|||
grabbable: false
|
||||
}
|
||||
}),
|
||||
script: "moveRandomly",
|
||||
script: "moveRandomly.js?" + version,
|
||||
visible: true
|
||||
}, { //outer vesicles
|
||||
model: "vesicle",
|
||||
|
@ -314,7 +314,7 @@ var scenes = [
|
|||
grabbable: false
|
||||
}
|
||||
}),
|
||||
script: "moveRandomly",
|
||||
script: "moveRandomly.js?" + version,
|
||||
visible: true
|
||||
},
|
||||
// {//wigglies
|
||||
|
@ -583,17 +583,18 @@ function ImportScene(scene) {
|
|||
}
|
||||
//create zone and instances
|
||||
|
||||
CreateZone(scene);
|
||||
CreateInstances(scene);
|
||||
CreateBoundary(scene);
|
||||
CreateZone(scene);
|
||||
CreateInstances(scene);
|
||||
CreateBoundary(scene);
|
||||
|
||||
CreateBackgroundAudio(scene.name, scene.location, scene.dimensions);
|
||||
CreateBackgroundAudio(scene.name, scene.location, scene.dimensions);
|
||||
|
||||
// print("done " + scene.name);
|
||||
|
||||
}
|
||||
|
||||
clearAllNav();
|
||||
|
||||
function clearAllNav() {
|
||||
// print('NAV CLEARING ALL NAV');
|
||||
var result = Entities.findEntities(MyAvatar.position, 25000);
|
||||
|
@ -605,6 +606,31 @@ function clearAllNav() {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
function createLayoutLights() {
|
||||
Entities.addEntity({
|
||||
type: "Light",
|
||||
name: "Cell layout light",
|
||||
position: {
|
||||
x: locations.cellLayout[0] + 110,
|
||||
y: locations.cellLayout[0] + 160,
|
||||
z: locations.cellLayout[0] + 785
|
||||
},
|
||||
dimensions: {
|
||||
x: 1500,
|
||||
y: 1500,
|
||||
z: 1500
|
||||
},
|
||||
intensity: 2,
|
||||
color: {
|
||||
red: 240,
|
||||
green: 165,
|
||||
blue: 240
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function CreateNavigationButton(scene, number) {
|
||||
// print('NAV NAVIGATION CREATING NAV!!' +scene.name + " " + number)
|
||||
|
||||
|
@ -634,7 +660,7 @@ function CreateNavigationButton(scene, number) {
|
|||
}
|
||||
}),
|
||||
// position:{x:3000,y:13500,z:3000},
|
||||
script: baseLocation + "Scripts/navigationButton.js?"+version ,
|
||||
script: baseLocation + "Scripts/navigationButton.js?" + version,
|
||||
collisionless: true,
|
||||
|
||||
});
|
||||
|
@ -734,7 +760,7 @@ function deleteAllInRadius(position, radius) {
|
|||
|
||||
Entities.deleteEntity(arrayFound[i]);
|
||||
}
|
||||
// print("deleted " + arrayFound.length + " entities");
|
||||
// print("deleted " + arrayFound.length + " entities");
|
||||
}
|
||||
|
||||
function CreateInstances(scene) {
|
||||
|
@ -744,7 +770,6 @@ function CreateInstances(scene) {
|
|||
var point = getPointOnSphereOfRadius(scene.instances[i].radius, j + 2, scene.instances[i].number);
|
||||
// print(scene.name + " point is " + point.x + " " + point.y + " " + point.z);
|
||||
|
||||
|
||||
var posX = scene.location.x + point.x + scene.instances[i].offset.x + Math.random() * (scene.instances[i].radius / 10);
|
||||
var posY = scene.location.y + point.y + scene.instances[i].offset.y + Math.random() * (scene.instances[i].radius / 10);
|
||||
var posZ = scene.location.z + point.z + scene.instances[i].offset.z + Math.random() * (scene.instances[i].radius / 10);
|
||||
|
@ -754,13 +779,13 @@ function CreateInstances(scene) {
|
|||
z: posZ
|
||||
};
|
||||
var url = baseLocation + "Instances/" + scene.instances[i].model + ".fbx?" + version;
|
||||
var script = scene.instances[i].script + ".js?" + version;
|
||||
var script = scene.instances[i].script;
|
||||
var rotX = 360 * Math.random() - 180;
|
||||
var rotY = 360 * Math.random() - 180;
|
||||
var rotZ = 360 * Math.random() - 180;
|
||||
var rotation = Quat.fromPitchYawRollDegrees(rotX, rotY, rotZ);
|
||||
var dimensions;
|
||||
if (scene.instances[i].script == "") {
|
||||
if (scene.instances[i].script === "") {
|
||||
script = "";
|
||||
}
|
||||
//is there a smarter way to randomize size?
|
||||
|
@ -780,7 +805,7 @@ function CreateInstances(scene) {
|
|||
}, idBounds, 150);
|
||||
|
||||
}
|
||||
|
||||
print('JBP SCRIPT AT CREATE ENTITY: ' + script)
|
||||
CreateEntity(scene.instances[i].model, position, rotation, scene.instances[i].dimensions, url, script, scene.instances[i].userData, scene.instances[i].visible);
|
||||
}
|
||||
}
|
||||
|
@ -876,12 +901,13 @@ function getPointOnSphereOfRadius(radius, number, totalNumber) {
|
|||
|
||||
function CreateEntity(name, position, rotation, dimensions, url, script, userData, visible) {
|
||||
var scriptLocation;
|
||||
if (script == "") {
|
||||
if (script === "") {
|
||||
scriptLocation = "";
|
||||
} else {
|
||||
scriptLocation = baseLocation + "Scripts/" + script;
|
||||
}
|
||||
|
||||
print('JBP SCRIPT LOCATION IN CREATE ENTITY' + scriptLocation)
|
||||
Entities.addEntity({
|
||||
type: "Model",
|
||||
name: name,
|
||||
|
@ -9020,36 +9046,8 @@ for (var i = 0; i < scenes.length; i++) {
|
|||
CreateNavigationButton(scenes[i], i);
|
||||
}
|
||||
|
||||
//Entities.addEntity({
|
||||
// type: "Box",
|
||||
// name: "motorProteinController",
|
||||
// position: {x:4000, y:4000, z:4000},
|
||||
// color: {red: 200, green: 0, blue: 0},
|
||||
// script: baseLocation + "Scripts/motorProteinController.js?"+version,
|
||||
// visible: false
|
||||
//});
|
||||
createLayoutLights();
|
||||
|
||||
Entities.addEntity({
|
||||
type: "Light",
|
||||
name: "Cell layout light",
|
||||
position: {
|
||||
x: locations.cellLayout[0] + 110,
|
||||
y: locations.cellLayout[0] + 160,
|
||||
z: locations.cellLayout[0] + 785
|
||||
},
|
||||
dimensions: {
|
||||
x: 1500,
|
||||
y: 1500,
|
||||
z: 1500
|
||||
},
|
||||
intensity: 2,
|
||||
color: {
|
||||
red: 240,
|
||||
green: 165,
|
||||
blue: 240
|
||||
}
|
||||
})
|
||||
|
||||
Script.scriptEnding.connect(function(){
|
||||
Script.scriptEnding.connect(function() {
|
||||
Entities.addingEntity.disconnect(makeUngrabbable);
|
||||
});
|
Loading…
Reference in a new issue