mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 04:15:14 +02:00
Added a detached mode by default in inpect.js
This commit is contained in:
parent
f84abeaa7b
commit
f367e1840d
1 changed files with 26 additions and 1 deletions
|
@ -34,6 +34,7 @@ var noMode = 0;
|
||||||
var orbitMode = 1;
|
var orbitMode = 1;
|
||||||
var radialMode = 2;
|
var radialMode = 2;
|
||||||
var panningMode = 3;
|
var panningMode = 3;
|
||||||
|
var detachedMode = 4;
|
||||||
|
|
||||||
var mode = noMode;
|
var mode = noMode;
|
||||||
|
|
||||||
|
@ -48,6 +49,9 @@ var radius = 0.0;
|
||||||
var azimuth = 0.0;
|
var azimuth = 0.0;
|
||||||
var altitude = 0.0;
|
var altitude = 0.0;
|
||||||
|
|
||||||
|
var avatarPosition;
|
||||||
|
var avatarOrientation;
|
||||||
|
|
||||||
|
|
||||||
function handleRadialMode(dx, dy) {
|
function handleRadialMode(dx, dy) {
|
||||||
azimuth += dx / AZIMUTH_RATE;
|
azimuth += dx / AZIMUTH_RATE;
|
||||||
|
@ -108,7 +112,7 @@ function restoreCameraState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModes() {
|
function handleModes() {
|
||||||
var newMode = noMode;
|
var newMode = (mode == noMode) ? noMode : detachedMode;
|
||||||
if (alt) {
|
if (alt) {
|
||||||
if (control) {
|
if (control) {
|
||||||
if (shift) {
|
if (shift) {
|
||||||
|
@ -121,6 +125,22 @@ function handleModes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if entering detachMode
|
||||||
|
if (newMode == detachedMode && mode != detachedMode) {
|
||||||
|
avatarPosition = MyAvatar.position;
|
||||||
|
avatarOrientation = MyAvatar.orientation;
|
||||||
|
}
|
||||||
|
// if leaving detachMode
|
||||||
|
if (mode == detachedMode && newMode == detachedMode &&
|
||||||
|
(avatarPosition.x != MyAvatar.position.x ||
|
||||||
|
avatarPosition.y != MyAvatar.position.y ||
|
||||||
|
avatarPosition.z != MyAvatar.position.z ||
|
||||||
|
avatarOrientation.x != MyAvatar.orientation.x ||
|
||||||
|
avatarOrientation.y != MyAvatar.orientation.y ||
|
||||||
|
avatarOrientation.z != MyAvatar.orientation.z ||
|
||||||
|
avatarOrientation.w != MyAvatar.orientation.w)) {
|
||||||
|
newMode = noMode;
|
||||||
|
}
|
||||||
// if leaving noMode
|
// if leaving noMode
|
||||||
if (mode == noMode && newMode != noMode) {
|
if (mode == noMode && newMode != noMode) {
|
||||||
saveCameraState();
|
saveCameraState();
|
||||||
|
@ -252,6 +272,10 @@ function mouseMoveEvent(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
handleModes();
|
||||||
|
}
|
||||||
|
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
if (mode != noMode) {
|
if (mode != noMode) {
|
||||||
restoreCameraState();
|
restoreCameraState();
|
||||||
|
@ -265,4 +289,5 @@ Controller.mousePressEvent.connect(mousePressEvent);
|
||||||
Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
|
Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
|
||||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
||||||
|
|
||||||
|
Script.update.connect(update);
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
Loading…
Reference in a new issue