mirror of
https://github.com/lubosz/overte.git
synced 2025-08-29 05:06:35 +02:00
Merge pull request #3848 from PhilipRosedale/master
Jump with number keys to preset places, improve HeadMove
This commit is contained in:
commit
8ca2a613a2
2 changed files with 30 additions and 2 deletions
|
@ -89,6 +89,7 @@ var WARP_SMOOTHING = 0.90;
|
|||
var WARP_START_TIME = 0.25;
|
||||
var WARP_START_DISTANCE = 2.5;
|
||||
var WARP_SENSITIVITY = 0.15;
|
||||
var MAX_WARP_DISTANCE = 25.0;
|
||||
|
||||
var fixedHeight = true;
|
||||
|
||||
|
@ -105,7 +106,7 @@ function updateWarp() {
|
|||
willMove = (keyDownTime > WARP_START_TIME);
|
||||
|
||||
if (willMove) {
|
||||
var distance = Math.exp(deltaPitch * WARP_SENSITIVITY) * WARP_START_DISTANCE;
|
||||
var distance = Math.min(Math.exp(deltaPitch * WARP_SENSITIVITY) * WARP_START_DISTANCE, MAX_WARP_DISTANCE);
|
||||
var warpDirection = Vec3.normalize({ x: look.x, y: (fixedHeight ? 0 : look.y), z: look.z });
|
||||
var startPosition = (watchAvatar ? Camera.getPosition(): MyAvatar.getEyePosition());
|
||||
warpPosition = Vec3.mix(Vec3.sum(startPosition, Vec3.multiply(warpDirection, distance)), warpPosition, WARP_SMOOTHING);
|
||||
|
@ -113,7 +114,7 @@ function updateWarp() {
|
|||
|
||||
var cameraPosition;
|
||||
|
||||
if (!watchAvatar && willMove) {
|
||||
if (!watchAvatar && willMove && (distance < WARP_START_DISTANCE * 0.5)) {
|
||||
pullBack();
|
||||
watchAvatar = true;
|
||||
}
|
||||
|
|
27
examples/hotPlaces.js
Normal file
27
examples/hotPlaces.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// hotPlaces.js
|
||||
//
|
||||
// Press the number keys to jump to different places in the metaverse!
|
||||
//
|
||||
// Created by Philip Rosedale on November 20, 2014
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
|
||||
Controller.keyPressEvent.connect(function (event) {
|
||||
if (event.text == "1") {
|
||||
Window.location = "hifi://starchamber";
|
||||
} else if (event.text == "2") {
|
||||
Window.location = "hifi://apartment";
|
||||
} else if (event.text == "3") {
|
||||
Window.location = "hifi://rivenglen";
|
||||
} else if (event.text == "4") {
|
||||
Window.location = "hifi://sanfrancisco";
|
||||
} else if (event.text == "5") {
|
||||
Window.location = "hifi://porto";
|
||||
} else if (event.text == "6") {
|
||||
Window.location = "hifi://hoo";
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue