This commit is contained in:
James B. Pollack 2016-02-22 13:08:58 -08:00
parent f7b3da078b
commit e4bc0ce691
3 changed files with 9 additions and 28 deletions

View file

@ -52,13 +52,7 @@
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
MyAvatar.position = data.location;
// if (data.hasOwnProperty('entryPoint') && data.hasOwnProperty('target')) {
// this.lookAtTarget(data.entryPoint, data.target);
// }
// else{
// }
}
}
@ -103,10 +97,4 @@
}
}
this.hoverEnterEntity = function(entityID) {
Entities.editEntity(entityID, {
animationURL: animationURL,
animationSettings: '{ "fps": 24, "firstFrame": 1, "lastFrame": 25, "frameIndex": 1, "running": true, "hold": true }'
});
}
})

View file

@ -15,18 +15,19 @@
var self = this;
var baton;
var iOwn = false;
this.iOwn = false;
var currentInterval;
var _entityId;
function startUpdate() {
iOwn = true;
self.iOwn = true;
print('i am the owner ' + _entityId)
}
function stopUpdateAndReclaim() {
print('i released the object ' + _entityId)
iOwn = false;
self.iOwn = false;
baton.claim(startUpdate, stopUpdateAndReclaim);
}
@ -40,7 +41,7 @@
this.minAngularVelocity = 0.01;
this.maxAngularVelocity = 0.03;
baton = virtualBaton({
batonName: 'io.highfidelity.vesicles:' + entityID, // One winner for each entity
batonName: 'io.highfidelity.cells:' + entityID, // One winner for each entity
});
stopUpdateAndReclaim();
currentInterval = Script.setInterval(self.move, self.getTotalWait())
@ -146,19 +147,11 @@
}
this.move = function() {
if (!iOwn) {
if (self.iOwn===false) {
print('cell is not owned by me...')
return;
}
// var magnitudeV = self.maxVelocity;
// 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);
var magnitudeAV = self.maxAngularVelocity;
var directionAV = {
@ -166,7 +159,7 @@
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(self.entityId, {
// velocity: Vec3.multiply(magnitudeV, Vec3.normalize(directionV)),
angularVelocity: Vec3.multiply(magnitudeAV, Vec3.normalize(directionAV))

View file

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