mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:18:24 +02:00
update camera calls in JS to use new mode methods
This commit is contained in:
parent
790aa848ae
commit
81ef722ef8
6 changed files with 16 additions and 16 deletions
|
@ -23,7 +23,7 @@ var THRUST_CONTROLLER = 0;
|
||||||
var VIEW_CONTROLLER = 1;
|
var VIEW_CONTROLLER = 1;
|
||||||
|
|
||||||
function checkCamera(deltaTime) {
|
function checkCamera(deltaTime) {
|
||||||
if (Camera.getMode() == "independent") {
|
if (Camera.getModeString() == "independent") {
|
||||||
var THRUST_MAG_UP = 800.0;
|
var THRUST_MAG_UP = 800.0;
|
||||||
var THRUST_MAG_DOWN = 300.0;
|
var THRUST_MAG_DOWN = 300.0;
|
||||||
var THRUST_MAG_FWD = 500.0;
|
var THRUST_MAG_FWD = 500.0;
|
||||||
|
|
|
@ -20,7 +20,7 @@ var cameraLocations = [ {x: 7971.9, y: 241.3, z: 7304.1}, {x: 7973.0, y: 241.3,
|
||||||
var cameraLookAts = [ {x: 7971.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7971.3, y: 241.3, z: 7304.2} ];
|
var cameraLookAts = [ {x: 7971.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7972.1, y: 241.3, z: 7304.1}, {x: 7971.3, y: 241.3, z: 7304.2} ];
|
||||||
|
|
||||||
function saveCameraState() {
|
function saveCameraState() {
|
||||||
oldMode = Camera.getMode();
|
oldMode = Camera.getModeString();
|
||||||
avatarPosition = MyAvatar.position;
|
avatarPosition = MyAvatar.position;
|
||||||
Camera.setModeShiftPeriod(0.0);
|
Camera.setModeShiftPeriod(0.0);
|
||||||
Camera.setMode("independent");
|
Camera.setMode("independent");
|
||||||
|
|
|
@ -20,15 +20,15 @@ var cameraLocations = [ {x: 2921.5, y: 251.3, z: 8254.8}, {x: 2921.5, y: 251.3,
|
||||||
var cameraLookAts = [ {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.4 , y: 251.3, z: 8255.1} ];
|
var cameraLookAts = [ {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.5, y: 251.3, z: 8255.7}, {x: 2921.4 , y: 251.3, z: 8255.1} ];
|
||||||
|
|
||||||
function saveCameraState() {
|
function saveCameraState() {
|
||||||
oldMode = Camera.getMode();
|
oldMode = Camera.getModeString();
|
||||||
avatarPosition = MyAvatar.position;
|
avatarPosition = MyAvatar.position;
|
||||||
Camera.setModeShiftPeriod(0.0);
|
Camera.setModeShiftPeriod(0.0);
|
||||||
Camera.setMode("independent");
|
Camera.setModeString("independent");
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCameraState() {
|
function restoreCameraState() {
|
||||||
Camera.stopLooking();
|
Camera.stopLooking();
|
||||||
Camera.setMode(oldMode);
|
Camera.setModeString(oldMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update(deltaTime) {
|
function update(deltaTime) {
|
||||||
|
@ -52,7 +52,7 @@ function keyPressEvent(event) {
|
||||||
saveCameraState();
|
saveCameraState();
|
||||||
freeCamera = true;
|
freeCamera = true;
|
||||||
}
|
}
|
||||||
Camera.setMode("independent");
|
Camera.setModeString("independent");
|
||||||
Camera.setPosition(cameraLocations[choice - 1]);
|
Camera.setPosition(cameraLocations[choice - 1]);
|
||||||
Camera.keepLookingAt(cameraLookAts[choice - 1]);
|
Camera.keepLookingAt(cameraLookAts[choice - 1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,12 +53,12 @@ var lastYawTurned = 0.0;
|
||||||
var startPullbackPosition;
|
var startPullbackPosition;
|
||||||
|
|
||||||
function saveCameraState() {
|
function saveCameraState() {
|
||||||
oldMode = Camera.getMode();
|
oldMode = Camera.getModeString();
|
||||||
Camera.setMode("independent");
|
Camera.setModeString("independent");
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCameraState() {
|
function restoreCameraState() {
|
||||||
Camera.setMode(oldMode);
|
Camera.setModeString(oldMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function activateWarp() {
|
function activateWarp() {
|
||||||
|
|
|
@ -118,14 +118,14 @@ function handlePanMode(dx, dy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveCameraState() {
|
function saveCameraState() {
|
||||||
oldMode = Camera.getMode();
|
oldMode = Camera.getModeString();
|
||||||
var oldPosition = Camera.getPosition();
|
var oldPosition = Camera.getPosition();
|
||||||
Camera.setMode("independent");
|
Camera.setModeString("independent");
|
||||||
Camera.setPosition(oldPosition);
|
Camera.setPosition(oldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCameraState() {
|
function restoreCameraState() {
|
||||||
Camera.setMode(oldMode);
|
Camera.setModeString(oldMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModes() {
|
function handleModes() {
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
var lookingAtSomething = false;
|
var lookingAtSomething = false;
|
||||||
var oldMode = Camera.getMode();
|
var oldMode = Camera.getModeString();
|
||||||
|
|
||||||
function cancelLookAt() {
|
function cancelLookAt() {
|
||||||
if (lookingAtSomething) {
|
if (lookingAtSomething) {
|
||||||
lookingAtSomething = false;
|
lookingAtSomething = false;
|
||||||
Camera.stopLooking();
|
Camera.stopLooking();
|
||||||
Camera.setMode(oldMode);
|
Camera.setModeString(oldMode);
|
||||||
releaseMovementKeys();
|
releaseMovementKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,13 @@ function mousePressEvent(event) {
|
||||||
if (intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
|
|
||||||
// remember the old mode we were in
|
// remember the old mode we were in
|
||||||
oldMode = Camera.getMode();
|
oldMode = Camera.getModeString();
|
||||||
|
|
||||||
print("looking at intersection point: " + intersection.intersection.x + ", "
|
print("looking at intersection point: " + intersection.intersection.x + ", "
|
||||||
+ intersection.intersection.y + ", " + intersection.intersection.z);
|
+ intersection.intersection.y + ", " + intersection.intersection.z);
|
||||||
|
|
||||||
// switch to independent mode
|
// switch to independent mode
|
||||||
Camera.setMode("independent");
|
Camera.setModeString("independent");
|
||||||
|
|
||||||
// tell the camera to fix it's look at on the point we clicked
|
// tell the camera to fix it's look at on the point we clicked
|
||||||
Camera.keepLookingAt(intersection.intersection);
|
Camera.keepLookingAt(intersection.intersection);
|
||||||
|
|
Loading…
Reference in a new issue