Merge branch 'tweak_lazers' of github.com:imgntn/hifi into tweak_lazers

This commit is contained in:
James B. Pollack 2016-08-03 15:00:05 -07:00
commit e012d3cebb
2 changed files with 51 additions and 241 deletions

View file

@ -23,12 +23,12 @@
// UTILITIES -------------
//
function ignore() {}
function ignore() { }
// Utility to make it easier to setup and disconnect cleanly.
function setupHandler(event, handler) {
event.connect(handler);
Script.scriptEnding.connect(function() {
Script.scriptEnding.connect(function () {
event.disconnect(handler);
});
}
@ -36,10 +36,10 @@ function setupHandler(event, handler) {
// If some capability is not available until expiration milliseconds after the last update.
function TimeLock(expiration) {
var last = 0;
this.update = function(optionalNow) {
this.update = function (optionalNow) {
last = optionalNow || Date.now();
};
this.expired = function(optionalNow) {
this.expired = function (optionalNow) {
return ((optionalNow || Date.now()) - last) > expiration;
};
}
@ -52,17 +52,13 @@ function Trigger(label) {
that.label = label;
that.TRIGGER_SMOOTH_RATIO = 0.1; // Time averaging of trigger - 0.0 disables smoothing
that.TRIGGER_OFF_VALUE = 0.10;
that.TRIGGER_ON_VALUE = that.TRIGGER_OFF_VALUE + 0.05; // Squeezed just enough to activate search or near grab
that.TRIGGER_ON_VALUE = that.TRIGGER_OFF_VALUE + 0.05; // Squeezed just enough to activate search or near grab
that.rawTriggerValue = 0;
that.triggerValue = 0; // rolling average of trigger value
that.triggerValue = 0; // rolling average of trigger value
that.triggerClicked = false;
that.triggerClick = function(value) {
that.triggerClicked = value;
};
that.triggerPress = function(value) {
that.rawTriggerValue = value;
};
that.updateSmoothedTrigger = function() { // e.g., call once/update for effect
that.triggerClick = function (value) { that.triggerClicked = value; };
that.triggerPress = function (value) { that.rawTriggerValue = value; };
that.updateSmoothedTrigger = function () { // e.g., call once/update for effect
var triggerValue = that.rawTriggerValue;
// smooth out trigger value
that.triggerValue = (that.triggerValue * that.TRIGGER_SMOOTH_RATIO) +
@ -70,19 +66,19 @@ function Trigger(label) {
OffscreenFlags.navigationFocusDisabled = that.triggerValue != 0.0;
};
// Current smoothed state, without hysteresis. Answering booleans.
that.triggerSmoothedClick = function() {
that.triggerSmoothedClick = function () {
return that.triggerClicked;
};
that.triggerSmoothedSqueezed = function() {
that.triggerSmoothedSqueezed = function () {
return that.triggerValue > that.TRIGGER_ON_VALUE;
};
that.triggerSmoothedReleased = function() {
that.triggerSmoothedReleased = function () {
return that.triggerValue < that.TRIGGER_OFF_VALUE;
};
// This part is not from handControllerGrab.js
that.state = null; // tri-state: falsey, 'partial', 'full'
that.update = function() { // update state, called from an update function
that.update = function () { // update state, called from an update function
var state = that.state;
that.updateSmoothedTrigger();
@ -100,10 +96,10 @@ function Trigger(label) {
that.state = state;
};
// Answer a controller source function (answering either 0.0 or 1.0).
that.partial = function() {
that.partial = function () {
return that.state ? 1.0 : 0.0; // either 'partial' or 'full'
};
that.full = function() {
that.full = function () {
return (that.state === 'full') ? 1.0 : 0.0;
};
}
@ -119,7 +115,6 @@ function updateFieldOfView() {
// SHIMS ----------
//
var weMovedReticle = false;
function ignoreMouseActivity() {
// If we're paused, or if change in cursor position is from this script, not the hardware mouse.
if (!Reticle.allowMouseCapture) {
@ -137,16 +132,13 @@ function ignoreMouseActivity() {
return true;
}
var MARGIN = 25;
var reticleMinX = MARGIN,
reticleMaxX, reticleMinY = MARGIN,
reticleMaxY;
var reticleMinX = MARGIN, reticleMaxX, reticleMinY = MARGIN, reticleMaxY;
function updateRecommendedArea() {
var dims = Controller.getViewportDimensions();
reticleMaxX = dims.x - MARGIN;
reticleMaxY = dims.y - MARGIN;
}
var setReticlePosition = function(point2d) {
var setReticlePosition = function (point2d) {
weMovedReticle = true;
point2d.x = Math.max(reticleMinX, Math.min(point2d.x, reticleMaxX));
point2d.y = Math.max(reticleMinY, Math.min(point2d.y, reticleMaxY));
@ -162,7 +154,6 @@ function findRayIntersection(pickRay) {
}
return result;
}
function isPointingAtOverlay(optionalHudPosition2d) {
return Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(optionalHudPosition2d || Reticle.position);
}
@ -170,7 +161,6 @@ function isPointingAtOverlay(optionalHudPosition2d) {
// Generalized HUD utilities, with or without HMD:
// This "var" is for documentation. Do not change the value!
var PLANAR_PERPENDICULAR_HUD_DISTANCE = 1;
function calculateRayUICollisionPoint(position, direction) {
// Answer the 3D intersection of the HUD by the given ray, or falsey if no intersection.
if (HMD.active) {
@ -190,7 +180,6 @@ function calculateRayUICollisionPoint(position, direction) {
return Vec3.sum(position, Vec3.multiply(scale, direction));
}
var DEGREES_TO_HALF_RADIANS = Math.PI / 360;
function overlayFromWorldPoint(point) {
// Answer the 2d pixel-space location in the HUD that covers the given 3D point.
// REQUIRES: that the 3d point be on the hud surface!
@ -210,10 +199,7 @@ function overlayFromWorldPoint(point) {
var verticalFraction = 1 - (cameraY / hudHeight + 0.5);
var horizontalPixels = size.x * horizontalFraction;
var verticalPixels = size.y * verticalFraction;
return {
x: horizontalPixels,
y: verticalPixels
};
return { x: horizontalPixels, y: verticalPixels };
}
function activeHudPoint2d(activeHand) { // if controller is valid, update reticle position and answer 2d point. Otherwise falsey.
@ -223,14 +209,14 @@ function activeHudPoint2d(activeHand) { // if controller is valid, update reticl
return; // Controller is cradled.
}
var controllerPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, controllerPose.translation),
MyAvatar.position);
MyAvatar.position);
// This gets point direction right, but if you want general quaternion it would be more complicated:
var controllerDirection = Quat.getUp(Quat.multiply(MyAvatar.orientation, controllerPose.rotation));
var hudPoint3d = calculateRayUICollisionPoint(controllerPosition, controllerDirection);
if (!hudPoint3d) {
if (Menu.isOptionChecked("Overlays")) { // With our hud resetting strategy, hudPoint3d should be valid here
print('Controller is parallel to HUD'); // so let us know that our assumptions are wrong.
print('Controller is parallel to HUD'); // so let us know that our assumptions are wrong.
}
return;
}
@ -245,17 +231,12 @@ function activeHudPoint2d(activeHand) { // if controller is valid, update reticl
// MOUSE ACTIVITY --------
//
var isSeeking = false;
var averageMouseVelocity = 0,
lastIntegration = 0,
lastMouse;
var averageMouseVelocity = 0, lastIntegration = 0, lastMouse;
var WEIGHTING = 1 / 20; // simple moving average over last 20 samples
var ONE_MINUS_WEIGHTING = 1 - WEIGHTING;
var AVERAGE_MOUSE_VELOCITY_FOR_SEEK_TO = 20;
function isShakingMouse() { // True if the person is waving the mouse around trying to find it.
var now = Date.now(),
mouse = Reticle.position,
isShaking = false;
var now = Date.now(), mouse = Reticle.position, isShaking = false;
if (lastIntegration && (lastIntegration !== now)) {
var velocity = Vec3.length(Vec3.subtract(mouse, lastMouse)) / (now - lastIntegration);
averageMouseVelocity = (ONE_MINUS_WEIGHTING * averageMouseVelocity) + (WEIGHTING * velocity);
@ -269,7 +250,6 @@ function isShakingMouse() { // True if the person is waving the mouse around try
}
var NON_LINEAR_DIVISOR = 2;
var MINIMUM_SEEK_DISTANCE = 0.1;
function updateSeeking(doNotStartSeeking) {
if (!doNotStartSeeking && (!Reticle.visible || isShakingMouse())) {
if (!isSeeking) {
@ -288,7 +268,6 @@ function updateSeeking(doNotStartSeeking) {
return; // E.g., if parallel to location in HUD
}
var copy = Reticle.position;
function updateDimension(axis) {
var distanceBetween = lookAt2D[axis] - Reticle.position[axis];
var move = distanceBetween / NON_LINEAR_DIVISOR;
@ -298,8 +277,7 @@ function updateSeeking(doNotStartSeeking) {
copy[axis] += move;
return true;
}
var okX = !updateDimension('x'),
okY = !updateDimension('y'); // Evaluate both. Don't short-circuit.
var okX = !updateDimension('x'), okY = !updateDimension('y'); // Evaluate both. Don't short-circuit.
if (okX && okY) {
print('Finished seeking mouse');
isSeeking = false;
@ -322,19 +300,16 @@ function updateMouseActivity(isClick) {
handControllerLockOut.update(now);
Reticle.visible = true;
}
function expireMouseCursor(now) {
if (!isPointingAtOverlay() && mouseCursorActivity.expired(now)) {
Reticle.visible = false;
}
}
function hudReticleDistance() { // 3d distance from camera to the reticle position on hud
// (The camera is only in the center of the sphere on reset.)
var reticlePositionOnHUD = HMD.worldPointFromOverlay(Reticle.position);
return Vec3.distance(reticlePositionOnHUD, HMD.position);
}
function onMouseMove() {
// Display cursor at correct depth (as in depthReticle.js), and updateMouseActivity.
if (ignoreMouseActivity()) {
@ -352,7 +327,6 @@ function onMouseMove() {
}
updateMouseActivity(); // After the above, just in case the depth movement is awkward when becoming visible.
}
function onMouseClick() {
updateMouseActivity(true);
}
@ -371,7 +345,6 @@ var LEFT_HUD_LASER = 1;
var RIGHT_HUD_LASER = 2;
var BOTH_HUD_LASERS = LEFT_HUD_LASER + RIGHT_HUD_LASER;
var activeHudLaser = RIGHT_HUD_LASER;
function toggleHand() { // unequivocally switch which hand controls mouse position
if (activeHand === Controller.Standard.RightHand) {
activeHand = Controller.Standard.LeftHand;
@ -384,9 +357,8 @@ function toggleHand() { // unequivocally switch which hand controls mouse positi
}
clearSystemLaser();
}
function makeToggleAction(hand) { // return a function(0|1) that makes the specified hand control mouse when 1
return function(on) {
return function (on) {
if (on && (activeHand !== hand)) {
toggleHand();
}
@ -406,7 +378,7 @@ function isPointingAtOverlayStartedNonFullTrigger(trigger) {
// true if isPointingAtOverlay AND we were NOT full triggered when we became so.
// The idea is to not count clicks when we're full-triggering and reach the edge of a window.
var lockedIn = false;
return function() {
return function () {
if (trigger !== activeTrigger) {
return lockedIn = false;
}
@ -426,28 +398,26 @@ clickMapping.from(leftTrigger.full).when(isPointingAtOverlayStartedNonFullTrigge
// clickMapping.from(Controller.Standard.RightSecondaryThumb).peek().to(Controller.Actions.ContextMenu);
// except that we first update the reticle position from the appropriate hand position, before invoking the ContextMenu.
var wantsMenu = 0;
clickMapping.from(function() {
return wantsMenu;
}).to(Controller.Actions.ContextMenu);
clickMapping.from(Controller.Standard.RightSecondaryThumb).peek().to(function(clicked) {
clickMapping.from(function () { return wantsMenu; }).to(Controller.Actions.ContextMenu);
clickMapping.from(Controller.Standard.RightSecondaryThumb).peek().to(function (clicked) {
if (clicked) {
activeHudPoint2d(Controller.Standard.RightHand);
}
wantsMenu = clicked;
});
clickMapping.from(Controller.Standard.LeftSecondaryThumb).peek().to(function(clicked) {
clickMapping.from(Controller.Standard.LeftSecondaryThumb).peek().to(function (clicked) {
if (clicked) {
activeHudPoint2d(Controller.Standard.LeftHand);
}
wantsMenu = clicked;
});
clickMapping.from(Controller.Hardware.Keyboard.RightMouseClicked).peek().to(function() {
clickMapping.from(Controller.Hardware.Keyboard.RightMouseClicked).peek().to(function () {
// Allow the reticle depth to be set correctly:
// Wait a tick for the context menu to be displayed, and then simulate a (non-hand-controller) mouse move
// so that the system updates qml state (Reticle.pointingAtSystemOverlay) before it gives us a mouseMove.
// We don't want the system code to always do this for us, because, e.g., we do not want to get a mouseMove
// after the Left/RightSecondaryThumb gives us a context menu. Only from the mouse.
Script.setTimeout(function() {
Script.setTimeout(function () {
Reticle.setPosition(Reticle.position);
}, 0);
});
@ -459,25 +429,10 @@ clickMapping.enable();
// VISUAL AID -----------
// Same properties as handControllerGrab search sphere
var LASER_ALPHA = 0.5;
var LASER_SEARCH_COLOR_XYZW = {
x: 10 / 255,
y: 10 / 255,
z: 255 / 255,
w: LASER_ALPHA
};
var LASER_TRIGGER_COLOR_XYZW = {
x: 250 / 255,
y: 10 / 255,
z: 10 / 255,
w: LASER_ALPHA
};
var SYSTEM_LASER_DIRECTION = {
x: 0,
y: 0,
z: -1
};
var LASER_SEARCH_COLOR_XYZW = {x: 10 / 255, y: 10 / 255, z: 255 / 255, w: LASER_ALPHA};
var LASER_TRIGGER_COLOR_XYZW = {x: 250 / 255, y: 10 / 255, z: 10 / 255, w: LASER_ALPHA};
var SYSTEM_LASER_DIRECTION = {x: 0, y: 0, z: -1};
var systemLaserOn = false;
function clearSystemLaser() {
if (!systemLaserOn) {
return;
@ -485,12 +440,8 @@ function clearSystemLaser() {
HMD.disableHandLasers(BOTH_HUD_LASERS);
systemLaserOn = false;
weMovedReticle = true;
Reticle.position = {
x: -1,
y: -1
};
Reticle.position = { x: -1, y: -1 };
}
function setColoredLaser() { // answer trigger state if lasers supported, else falsey.
var color = (activeTrigger.state === 'full') ? LASER_TRIGGER_COLOR_XYZW : LASER_SEARCH_COLOR_XYZW;
return HMD.setHandLasers(activeHudLaser, true, color, SYSTEM_LASER_DIRECTION) && activeTrigger.state;
@ -500,7 +451,6 @@ function setColoredLaser() { // answer trigger state if lasers supported, else f
//
function update() {
var now = Date.now();
function off() {
expireMouseCursor();
clearSystemLaser();
@ -554,31 +504,7 @@ function checkSettings() {
checkSettings();
var settingsChecker = Script.setInterval(checkSettings, SETTINGS_CHANGE_RECHECK_INTERVAL);
Script.scriptEnding.connect(function() {
Script.scriptEnding.connect(function () {
Script.clearInterval(settingsChecker);
OffscreenFlags.navigationFocusDisabled = false;
});
var isDisabled = false;
var handleHandMessages = function(channel, message, sender) {
var data;
if (sender === MyAvatar.sessionUUID) {
if (channel === 'Hifi-Hand-Pointer-Disabler') {
if (message === 'both') {
isDisabled = 'both';
}
if (message === 'left') {
isDisabled = 'left';
}
if (message === 'right') {
isDisabled = 'right';
}
if (message === 'none') {
isDisabled = false;
}
}
}
}
Messages.subscribe('Hifi-Hand-Pointer-Disabler');
Messages.messageReceived.connect(handleHandMessages);

View file

@ -1,21 +1,13 @@
// Created by james b. pollack @imgntn on 7/2/2016
// Copyright 2016 High Fidelity, Inc.
//
// Creates a beam and target and then teleports you there when you let go of either activation button.
// Creates a beam and target and then teleports you there.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
var inTeleportMode = false;
var currentFadeSphereOpacity = 1;
var fadeSphereInterval = null;
var fadeSphereUpdateInterval = null;
//milliseconds between fading one-tenth -- so this is a half second fade total
var USE_FADE_MODE = false;
var USE_FADE_OUT = true;
var FADE_OUT_INTERVAL = 25;
// instant
// var NUMBER_OF_STEPS = 0;
// var SMOOTH_ARRIVAL_SPACING = 0;
@ -36,16 +28,13 @@ var NUMBER_OF_STEPS = 6;
// var SMOOTH_ARRIVAL_SPACING = 10;
// var NUMBER_OF_STEPS = 20;
var TARGET_MODEL_URL = Script.resolvePath("../assets/models/teleport.fbx");
var TARGET_MODEL_DIMENSIONS = {
x: 1.15,
y: 0.5,
z: 1.15
};
var COLORS_TELEPORT_CAN_TELEPORT = {
red: 97,
green: 247,
@ -58,7 +47,6 @@ var COLORS_TELEPORT_CANNOT_TELEPORT = {
blue: 141
};
var MAX_AVATAR_SPEED = 0.25;
function ThumbPad(hand) {
@ -75,7 +63,6 @@ function ThumbPad(hand) {
}
};
}
function Trigger(hand) {
@ -101,7 +88,6 @@ function Teleporter() {
this.targetOverlay = null;
this.updateConnected = null;
this.smoothArrivalInterval = null;
this.fadeSphere = null;
this.teleportHand = null;
this.initialize = function() {
@ -141,86 +127,22 @@ function Teleporter() {
if (isDisabled === 'both') {
return;
}
inTeleportMode = true;
if (this.smoothArrivalInterval !== null) {
Script.clearInterval(this.smoothArrivalInterval);
}
if (fadeSphereInterval !== null) {
Script.clearInterval(fadeSphereInterval);
}
if (activationTimeout !== null) {
Script.clearInterval(activationTimeout);
}
this.teleportHand = hand;
this.initialize();
Script.update.connect(this.update);
this.updateConnected = true;
};
this.createFadeSphere = function(avatarHead) {
var sphereProps = {
position: avatarHead,
size: -1,
color: {
red: 0,
green: 0,
blue: 0,
},
alpha: 1,
solid: true,
visible: true,
ignoreRayIntersection: true,
drawInFront: false
};
currentFadeSphereOpacity = 10;
_this.fadeSphere = Overlays.addOverlay("sphere", sphereProps);
Script.clearInterval(fadeSphereInterval)
Script.update.connect(_this.updateFadeSphere);
if (USE_FADE_OUT === true) {
this.fadeSphereOut();
}
};
this.fadeSphereOut = function() {
fadeSphereInterval = Script.setInterval(function() {
if (currentFadeSphereOpacity <= 0) {
Script.clearInterval(fadeSphereInterval);
_this.deleteFadeSphere();
fadeSphereInterval = null;
return;
}
if (currentFadeSphereOpacity > 0) {
currentFadeSphereOpacity = currentFadeSphereOpacity - 1;
}
Overlays.editOverlay(_this.fadeSphere, {
alpha: currentFadeSphereOpacity / 10
})
}, FADE_OUT_INTERVAL);
};
this.updateFadeSphere = function() {
var headPosition = MyAvatar.getHeadPosition();
Overlays.editOverlay(_this.fadeSphere, {
position: headPosition
})
};
this.deleteFadeSphere = function() {
if (_this.fadeSphere !== null) {
Script.update.disconnect(_this.updateFadeSphere);
Overlays.deleteOverlay(_this.fadeSphere);
_this.fadeSphere = null;
}
};
this.deleteTargetOverlay = function() {
if (this.targetOverlay === null) {
@ -288,14 +210,12 @@ function Teleporter() {
this.rightRay = function() {
var rightPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, Controller.getPoseValue(Controller.Standard.RightHand).translation), MyAvatar.position);
var rightControllerRotation = Controller.getPoseValue(Controller.Standard.RightHand).rotation;
var rightRotation = Quat.multiply(MyAvatar.orientation, rightControllerRotation)
var rightFinal = Quat.multiply(rightRotation, Quat.angleAxis(90, {
x: 1,
y: 0,
@ -335,14 +255,12 @@ function Teleporter() {
var leftRotation = Quat.multiply(MyAvatar.orientation, Controller.getPoseValue(Controller.Standard.LeftHand).rotation)
var leftFinal = Quat.multiply(leftRotation, Quat.angleAxis(90, {
x: 1,
y: 0,
z: 0
}));
var leftPickRay = {
origin: leftPosition,
direction: Quat.getUp(leftRotation),
@ -364,7 +282,6 @@ function Teleporter() {
this.createTargetOverlay();
}
} else {
this.deleteTargetOverlay();
@ -378,7 +295,7 @@ function Teleporter() {
start: closePoint,
end: farPoint,
color: color,
ignoreRayIntersection: true, // always ignore this
ignoreRayIntersection: true,
visible: true,
alpha: 1,
solid: true,
@ -390,14 +307,9 @@ function Teleporter() {
} else {
var success = Overlays.editOverlay(this.rightOverlayLine, {
lineWidth: 50,
start: closePoint,
end: farPoint,
color: color,
visible: true,
ignoreRayIntersection: true, // always ignore this
alpha: 1,
glow: 1.0
color: color
});
}
};
@ -405,7 +317,7 @@ function Teleporter() {
this.leftLineOn = function(closePoint, farPoint, color) {
if (this.leftOverlayLine === null) {
var lineProperties = {
ignoreRayIntersection: true, // always ignore this
ignoreRayIntersection: true,
start: closePoint,
end: farPoint,
color: color,
@ -422,11 +334,7 @@ function Teleporter() {
var success = Overlays.editOverlay(this.leftOverlayLine, {
start: closePoint,
end: farPoint,
color: color,
visible: true,
alpha: 1,
solid: true,
glow: 1.0
color: color
});
}
};
@ -479,16 +387,11 @@ function Teleporter() {
this.exitTeleportMode();
}
if (this.intersection !== null) {
if (USE_FADE_MODE === true) {
this.createFadeSphere();
}
var offset = getAvatarFootOffset();
this.intersection.intersection.y += offset;
this.exitTeleportMode();
this.smoothArrival();
}
};
@ -498,12 +401,8 @@ function Teleporter() {
return midpoint
};
this.getArrivalPoints = function(startPoint, endPoint) {
var arrivalPoints = [];
var i;
var lastPoint;
@ -516,9 +415,9 @@ function Teleporter() {
arrivalPoints.push(newPoint);
}
arrivalPoints.push(endPoint)
arrivalPoints.push(endPoint);
return arrivalPoints
return arrivalPoints;
};
this.smoothArrival = function() {
@ -529,7 +428,6 @@ function Teleporter() {
Script.clearInterval(_this.smoothArrivalInterval);
return;
}
var landingPoint = _this.arrivalPoints.shift();
MyAvatar.position = landingPoint;
@ -537,8 +435,7 @@ function Teleporter() {
_this.deleteTargetOverlay();
}
}, SMOOTH_ARRIVAL_SPACING)
}, SMOOTH_ARRIVAL_SPACING);
}
}
@ -563,14 +460,14 @@ function getAvatarFootOffset() {
toe = d.translation.y;
}
if (jointName === "RightToe_End") {
toeTop = d.translation.y
toeTop = d.translation.y;
}
})
var myPosition = MyAvatar.position;
var offset = upperLeg + lowerLeg + foot + toe + toeTop;
offset = offset / 100;
return offset
return offset;
};
function getJointData() {
@ -590,11 +487,6 @@ function getJointData() {
return allJointData;
};
function getAvatarSpeed() {
return Vec3.length(MyAvatar.velocity)
}
var leftPad = new ThumbPad('left');
var rightPad = new ThumbPad('right');
var leftTrigger = new Trigger('left');
@ -606,13 +498,12 @@ var activationTimeout = null;
var TELEPORT_DELAY = 0;
function isMoving() {
var LY = Controller.getValue(Controller.Standard.LY);
var LX = Controller.getValue(Controller.Standard.LX);
if (LY !== 0 || LX !== 0) {
return true
return true;
} else {
return false
return false;
}
}
@ -639,9 +530,6 @@ function registerMappings() {
if (isMoving() === true) {
return;
}
// if (getAvatarSpeed() >= MAX_AVATAR_SPEED) {
// return;
// }
activationTimeout = Script.setTimeout(function() {
Script.clearTimeout(activationTimeout);
activationTimeout = null;
@ -663,9 +551,7 @@ function registerMappings() {
if (isMoving() === true) {
return;
}
// if (getAvatarSpeed() >= MAX_AVATAR_SPEED) {
// return;
// }
activationTimeout = Script.setTimeout(function() {
teleporter.enterTeleportMode('right')
Script.clearTimeout(activationTimeout);
@ -673,7 +559,6 @@ function registerMappings() {
}, TELEPORT_DELAY)
return;
});
}
registerMappings();
@ -689,7 +574,6 @@ function cleanup() {
teleporter.disableMappings();
teleporter.deleteTargetOverlay();
teleporter.turnOffOverlayBeams();
teleporter.deleteFadeSphere();
if (teleporter.updateConnected !== null) {
Script.update.disconnect(teleporter.update);
}