fix for spacing

This commit is contained in:
Philip Rosedale 2014-10-24 17:10:46 -07:00
parent 1e832e7bbb
commit 54197b2c23

View file

@ -14,34 +14,34 @@ var LANDING_RANDOM = 0.2;
function update(deltaTime) { function update(deltaTime) {
if (Math.random() < deltaTime) { if (Math.random() < deltaTime) {
guide = AvatarList.avatarWithDisplayName(leaderName); guide = AvatarList.avatarWithDisplayName(leaderName);
if (guide && !isGuide) { if (guide && !isGuide) {
print("found a guide!"); print("found a guide!");
isGuide = true; isGuide = true;
} else if (!isGuide) { } else if (!isGuide) {
print("Lost My Guide"); print("Lost My Guide");
isguide = false; isguide = false;
}
} }
}
if (guide) { if (guide) {
// Check whether guide has moved, update if so // Check whether guide has moved, update if so
if (Vec3.length(lastGuidePosition) == 0.0) { if (Vec3.length(lastGuidePosition) == 0.0) {
lastGuidePosition = guide.position; lastGuidePosition = guide.position;
} else { } else {
if (Vec3.length(Vec3.subtract(lastGuidePosition, guide.position)) > MIN_CHANGE) { if (Vec3.length(Vec3.subtract(lastGuidePosition, guide.position)) > MIN_CHANGE) {
var meToGuide = Vec3.multiply(Vec3.normalize(Vec3.subtract(guide.position, MyAvatar.position)), LANDING_DISTANCE); var meToGuide = Vec3.multiply(Vec3.normalize(Vec3.subtract(guide.position, MyAvatar.position)), LANDING_DISTANCE);
var newPosition = Vec3.subtract(guide.position, meToGuide); var newPosition = Vec3.subtract(guide.position, meToGuide);
newPosition = Vec3.sum(newPosition, { x: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0, newPosition = Vec3.sum(newPosition, { x: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0,
y: 0, y: 0,
z: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0 }); z: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0 });
MyAvatar.position = newPosition; MyAvatar.position = newPosition;
lastGuidePosition = guide.position; lastGuidePosition = guide.position;
MyAvatar.orientation = guide.orientation; MyAvatar.orientation = guide.orientation;
} }
}
} }
}
} }
Script.update.connect(update); Script.update.connect(update);