cleanup and submit

This commit is contained in:
James B. Pollack 2016-02-24 13:18:01 -08:00
parent 46fbf38b5d
commit baa030b7b0
3 changed files with 28 additions and 15 deletions

View file

@ -5,7 +5,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var version = 1057;
var version = 1100;
var cellLayout;
var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";

View file

@ -1,3 +1,10 @@
// 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 basePosition = {
x: 3000,
y: 13500,
@ -17,21 +24,21 @@ var THROTTLE_RATE = 5000;
var sinceLastUpdate = 0;
print('cells script')
//print('cells script')
function findCells() {
var results = Entities.findEntities(basePosition, 60000);
if (results.length === 0) {
print('no entities found')
// print('no entities found')
return;
}
results.forEach(function(v) {
var name = Entities.getEntityProperties(v, 'name').name;
print('name is:: ' + name)
// print('name is:: ' + name)
if (name === 'Cell') {
print('found a cell!!' + v)
// print('found a cell!!' + v)
Script.setTimeout(function() {
moveCell(v);
}, Math.random() * THROTTLE_RATE)
@ -44,7 +51,7 @@ var minAngularVelocity = 0.01;
var maxAngularVelocity = 0.03;
function moveCell(entityId) {
print('moving a cell! ' + entityId)
// print('moving a cell! ' + entityId)
var magnitudeAV = maxAngularVelocity;
@ -53,7 +60,7 @@ function moveCell(entityId) {
y: Math.random() - 0.5,
z: Math.random() - 0.5
};
print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
// print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
Entities.editEntity(entityId, {
angularVelocity: Vec3.multiply(magnitudeAV, Vec3.normalize(directionAV))
});
@ -77,7 +84,7 @@ function update(deltaTime) {
if (THROTTLE === true) {
sinceLastUpdate = sinceLastUpdate + deltaTime * 1000;
if (sinceLastUpdate > THROTTLE_RATE) {
print('SHOULD FIND CELLS!!!')
// print('SHOULD FIND CELLS!!!')
sinceLastUpdate = 0;
findCells();
} else {

View file

@ -1,3 +1,10 @@
// 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 basePosition = {
x: 3000,
y: 13500,
@ -17,7 +24,7 @@ var THROTTLE_RATE = 5000;
var sinceLastUpdate = 0;
print('vesicle script')
//print('vesicle script')
function findVesicles() {
var results = Entities.findEntities(basePosition, 60000);
@ -31,7 +38,7 @@ function findVesicles() {
var name = Entities.getEntityProperties(v, 'name').name;
print('name is:: ' + name)
if (name === 'vesicle') {
print('found a vesicle!!' + v)
// print('found a vesicle!!' + v)
Script.setTimeout(function() {
moveVesicle(v);
}, Math.random() * THROTTLE_RATE)
@ -45,7 +52,7 @@ var minAngularVelocity = 0.01;
var maxAngularVelocity = 0.03;
function moveVesicle(entityId) {
print('moving a vesicle! ' + entityId)
// print('moving a vesicle! ' + entityId)
var magnitudeV = maxVelocity;
var directionV = {
x: Math.random() - 0.5,
@ -53,7 +60,7 @@ function moveVesicle(entityId) {
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);
var magnitudeAV = maxAngularVelocity;
@ -62,7 +69,7 @@ function moveVesicle(entityId) {
y: Math.random() - 0.5,
z: Math.random() - 0.5
};
print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
// print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
Entities.editEntity(entityId, {
velocity: Vec3.multiply(magnitudeV, Vec3.normalize(directionV)),
angularVelocity: Vec3.multiply(magnitudeAV, Vec3.normalize(directionAV))
@ -71,7 +78,6 @@ function moveVesicle(entityId) {
}
function update(deltaTime) {
// print('deltaTime',deltaTime)
if (!initialized) {
print("checking for servers...");
@ -87,7 +93,7 @@ function update(deltaTime) {
if (THROTTLE === true) {
sinceLastUpdate = sinceLastUpdate + deltaTime * 1000;
if (sinceLastUpdate > THROTTLE_RATE) {
print('SHOULD FIND VESICLES!!!')
// print('SHOULD FIND VESICLES!!!')
sinceLastUpdate = 0;
findVesicles();
} else {