addressing some feedback

This commit is contained in:
Dante Ruiz 2018-08-30 13:22:17 -07:00
parent 8c77820e30
commit 93b0f15116

View file

@ -18,13 +18,13 @@
var MAX_X_SIZE = 3.8; var MAX_X_SIZE = 3.8;
var EPSILON = 0.01; var EPSILON = 0.01;
var isVisible = false; var isVisible = false;
var STABILITY = 3.0;
var VOLUME = 0.4; var VOLUME = 0.4;
var tune = SoundCache.getSound("http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/crystals_and_voices.wav"); var tune = SoundCache.getSound("http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/crystals_and_voices.wav");
var sample = null; var sample = null;
var MAX_LEFT_MARGIN = 1.9; var MAX_LEFT_MARGIN = 1.9;
var INNER_CIRCLE_WIDTH = 4.7; var INNER_CIRCLE_WIDTH = 4.7;
var DEFAULT_Z_OFFSET = 5.45; var DEFAULT_Z_OFFSET = 5.45;
var previousCameraMode = Camera.mode;
var renderViewTask = Render.getConfig("RenderMainView"); var renderViewTask = Render.getConfig("RenderMainView");
var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
@ -181,7 +181,7 @@
var TARGET_UPDATE_HZ = 60; // 50hz good enough, but we're using update var TARGET_UPDATE_HZ = 60; // 50hz good enough, but we're using update
var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ;
var lastInterval = Date.now(); var lastInterval = Date.now();
var currentDomain = ""; var currentDomain = "no domain";
var timer = null; var timer = null;
var target = 0; var target = 0;
@ -228,6 +228,8 @@
target = 0; target = 0;
currentProgress = 0.1; currentProgress = 0.1;
connectionToDomainFailed = false; connectionToDomainFailed = false;
previousCameraMode = Camera.mode;
Camera.mode = "first person";
timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS);
} }
} }
@ -249,30 +251,42 @@
print("domain changed: " + domain); print("domain changed: " + domain);
if (domain !== currentDomain) { if (domain !== currentDomain) {
MyAvatar.restoreAnimation(); MyAvatar.restoreAnimation();
var name = AddressManager.placename; var name = location.placename;
domainName = name.charAt(0).toUpperCase() + name.slice(1); domainName = name.charAt(0).toUpperCase() + name.slice(1);
var doRequest = true;
if (name.length === 0 && location.href === "file:///~/serverless/tutorial.json") {
domainName = "Serveless Domain (Tutorial)";
doRequest = false;
}
var domainNameLeftMargin = getLeftMargin(domainNameTextID, domainName); var domainNameLeftMargin = getLeftMargin(domainNameTextID, domainName);
var textProperties = { var textProperties = {
text: domainName, text: domainName,
leftMargin: domainNameLeftMargin leftMargin: domainNameLeftMargin
}; };
var url = Account.metaverseServerURL + '/api/v1/places/' + domain; if (doRequest) {
request({ var url = Account.metaverseServerURL + '/api/v1/places/' + domain;
uri: url request({
}, function(error, data) { uri: url
if (data.status === "success") { }, function(error, data) {
var domainInfo = data.data; if (data.status === "success") {
var domainDescriptionText = domainInfo.place.description; var domainInfo = data.data;
print("domainText: " + domainDescriptionText); var domainDescriptionText = domainInfo.place.description;
var leftMargin = getLeftMargin(domainDescription, domainDescriptionText); print("domainText: " + domainDescriptionText);
var domainDescriptionProperties = { var leftMargin = getLeftMargin(domainDescription, domainDescriptionText);
text: domainDescriptionText, var domainDescriptionProperties = {
leftMargin: leftMargin text: domainDescriptionText,
}; leftMargin: leftMargin
Overlays.editOverlay(domainDescription, domainDescriptionProperties); };
} Overlays.editOverlay(domainDescription, domainDescriptionProperties);
}); }
});
} else {
var domainDescriptionProperties = {
text: ""
};
Overlays.editOverlay(domainDescription, domainDescriptionProperties);
}
var randomIndex = Math.floor(Math.random() * userTips.length); var randomIndex = Math.floor(Math.random() * userTips.length);
var tip = userTips[randomIndex]; var tip = userTips[randomIndex];
@ -320,8 +334,6 @@
visible: !physicsEnabled visible: !physicsEnabled
}; };
// Menu.setIsOptionChecked("Show Overlays", physicsEnabled);
if (!HMD.active) { if (!HMD.active) {
MyAvatar.headOrientation = Quat.multiply(Quat.cancelOutRollAndPitch(MyAvatar.headOrientation), Quat.fromPitchYawRollDegrees(-3.0, 0, 0)); MyAvatar.headOrientation = Quat.multiply(Quat.cancelOutRollAndPitch(MyAvatar.headOrientation), Quat.fromPitchYawRollDegrees(-3.0, 0, 0));
} }
@ -343,7 +355,9 @@
resetValues(); resetValues();
Camera.mode = "first person"; if (physicsEnabled) {
Camera.mode = previousCameraMode;
}
} }
@ -358,11 +372,6 @@
Overlays.editOverlay(anchorOverlay, { localPosition: localPosition }); Overlays.editOverlay(anchorOverlay, { localPosition: localPosition });
} }
Window.interstitialStatusChanged.connect(function(interstitialMode) {
print("------> insterstitial mode changed " + interstitialMode + " <------");
});
function update() { function update() {
var physicsEnabled = Window.isPhysicsEnabled(); var physicsEnabled = Window.isPhysicsEnabled();
var thisInterval = Date.now(); var thisInterval = Date.now();
@ -372,10 +381,13 @@
var domainLoadingProgressPercentage = Window.domainLoadingProgress(); var domainLoadingProgressPercentage = Window.domainLoadingProgress();
var progress = MAX_X_SIZE * domainLoadingProgressPercentage; var progress = MAX_X_SIZE * domainLoadingProgressPercentage;
print(progress); if (progress >= target) {
//if (progress >= target) {
target = progress; target = progress;
//} }
if ((physicsEnabled && (currentProgress < MAX_X_SIZE))) {
target = MAX_X_SIZE;
}
currentProgress = lerp(currentProgress, target, 0.2); currentProgress = lerp(currentProgress, target, 0.2);
var properties = { var properties = {
@ -393,6 +405,7 @@
timer = null; timer = null;
return; return;
} }
timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS);
} }
@ -400,7 +413,6 @@
location.hostChanged.connect(domainChanged); location.hostChanged.connect(domainChanged);
location.lookupResultsFinished.connect(function() { location.lookupResultsFinished.connect(function() {
Script.setTimeout(function() { Script.setTimeout(function() {
print("location connected: " + location.isConnected);
connectionToDomainFailed = !location.isConnected; connectionToDomainFailed = !location.isConnected;
}, 1200); }, 1200);
}); });