This commit is contained in:
Andrzej Kapolka 2014-12-10 15:23:27 -08:00
commit d402f767c1
10 changed files with 86 additions and 134 deletions

View file

@ -13,7 +13,6 @@ Script.include("libraries/globals.js");
var panelWall = false; var panelWall = false;
var orbShell = false; var orbShell = false;
var reticle = false;
var descriptionText = false; var descriptionText = false;
var showText = false; var showText = false;
@ -24,8 +23,6 @@ var numberOfLines = 2;
var textMargin = 0.0625; var textMargin = 0.0625;
var lineHeight = (textHeight - (2 * textMargin)) / numberOfLines; var lineHeight = (textHeight - (2 * textMargin)) / numberOfLines;
var lastMouseMove = 0;
var IDLE_HOVER_TIME = 2000; // if you haven't moved the mouse in 2 seconds, and in HMD mode, then we use reticle for hover
var avatarStickPosition = {}; var avatarStickPosition = {};
var orbNaturalExtentsMin = { x: -1.230354, y: -1.22077, z: -1.210487 }; var orbNaturalExtentsMin = { x: -1.230354, y: -1.22077, z: -1.210487 };
@ -58,13 +55,6 @@ var elevatorSound = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/Lobby/eleva
var currentMuzakInjector = null; var currentMuzakInjector = null;
var currentSound = null; var currentSound = null;
var inOculusMode = false;
function reticlePosition() {
var RETICLE_DISTANCE = 1;
return Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), RETICLE_DISTANCE));
}
function textOverlayPosition() { function textOverlayPosition() {
var TEXT_DISTANCE_OUT = 6; var TEXT_DISTANCE_OUT = 6;
var TEXT_DISTANCE_DOWN = -2; var TEXT_DISTANCE_DOWN = -2;
@ -72,6 +62,21 @@ function textOverlayPosition() {
Vec3.multiply(Quat.getUp(Camera.orientation), TEXT_DISTANCE_DOWN)); Vec3.multiply(Quat.getUp(Camera.orientation), TEXT_DISTANCE_DOWN));
} }
var panelLocationOrder = [
7, 8, 9, 10, 11, 12, 13,
0, 1, 2, 3, 4, 5, 6,
14, 15, 16, 17, 18, 19, 20
];
// Location index is 0-based
function locationIndexToPanelIndex(locationIndex) {
return panelLocationOrder.indexOf(locationIndex) + 1;
}
// Panel index is 1-based
function panelIndexToLocationIndex(panelIndex) {
return panelLocationOrder[panelIndex - 1];
}
var MAX_NUM_PANELS = 21; var MAX_NUM_PANELS = 21;
var DRONE_VOLUME = 0.3; var DRONE_VOLUME = 0.3;
@ -126,22 +131,6 @@ function drawLobby() {
orbShell = Overlays.addOverlay("model", orbShellProps); orbShell = Overlays.addOverlay("model", orbShellProps);
descriptionText = Overlays.addOverlay("text3d", descriptionTextProps); descriptionText = Overlays.addOverlay("text3d", descriptionTextProps);
inOculusMode = Menu.isOptionChecked("Enable VR Mode");
// for HMD wearers, create a reticle in center of screen
if (inOculusMode) {
var CURSOR_SCALE = 0.025;
reticle = Overlays.addOverlay("billboard", {
url: HIFI_PUBLIC_BUCKET + "images/cursor.svg",
position: reticlePosition(),
ignoreRayIntersection: true,
isFacingAvatar: true,
alpha: 1.0,
scale: CURSOR_SCALE
});
}
// add an attachment on this avatar so other people see them in the lobby // add an attachment on this avatar so other people see them in the lobby
MyAvatar.attach(HELMET_ATTACHMENT_URL, "Neck", {x: 0, y: 0, z: 0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.15); MyAvatar.attach(HELMET_ATTACHMENT_URL, "Neck", {x: 0, y: 0, z: 0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.15);
@ -169,7 +158,8 @@ function changeLobbyTextures() {
}; };
for (var j = 0; j < NUM_PANELS; j++) { for (var j = 0; j < NUM_PANELS; j++) {
textureProp["textures"]["file" + (j + 1)] = "http:" + locations[j].thumbnail_url var panelIndex = locationIndexToPanelIndex(j);
textureProp["textures"]["file" + panelIndex] = "http:" + locations[j].thumbnail_url;
}; };
Overlays.editOverlay(panelWall, textureProp); Overlays.editOverlay(panelWall, textureProp);
@ -228,14 +218,8 @@ function cleanupLobby() {
Overlays.deleteOverlay(orbShell); Overlays.deleteOverlay(orbShell);
Overlays.deleteOverlay(descriptionText); Overlays.deleteOverlay(descriptionText);
if (reticle) {
Overlays.deleteOverlay(reticle);
}
panelWall = false; panelWall = false;
orbShell = false; orbShell = false;
reticle = false;
Audio.stopInjector(currentDrone); Audio.stopInjector(currentDrone);
currentDrone = null; currentDrone = null;
@ -260,12 +244,13 @@ function actionStartEvent(event) {
var panelStringIndex = panelName.indexOf("Panel"); var panelStringIndex = panelName.indexOf("Panel");
if (panelStringIndex != -1) { if (panelStringIndex != -1) {
var panelIndex = parseInt(panelName.slice(5)) - 1; var panelIndex = parseInt(panelName.slice(5));
if (panelIndex < locations.length) { var locationIndex = panelIndexToLocationIndex(panelIndex);
var actionLocation = locations[panelIndex]; if (locationIndex < locations.length) {
var actionLocation = locations[locationIndex];
print("Jumping to " + actionLocation.name + " at " + actionLocation.path print("Jumping to " + actionLocation.name + " at " + actionLocation.path
+ " in " + actionLocation.domain.name + " after click on panel " + panelIndex); + " in " + actionLocation.domain.name + " after click on panel " + panelIndex + " with location index " + locationIndex);
Window.location = actionLocation; Window.location = actionLocation;
maybeCleanupLobby(); maybeCleanupLobby();
@ -309,9 +294,10 @@ function handleLookAt(pickRay) {
var panelName = result.extraInfo; var panelName = result.extraInfo;
var panelStringIndex = panelName.indexOf("Panel"); var panelStringIndex = panelName.indexOf("Panel");
if (panelStringIndex != -1) { if (panelStringIndex != -1) {
var panelIndex = parseInt(panelName.slice(5)) - 1; var panelIndex = parseInt(panelName.slice(5));
if (panelIndex < locations.length) { var locationIndex = panelIndexToLocationIndex(panelIndex);
var actionLocation = locations[panelIndex]; if (locationIndex < locations.length) {
var actionLocation = locations[locationIndex];
if (actionLocation.description == "") { if (actionLocation.description == "") {
Overlays.editOverlay(descriptionText, { text: actionLocation.name, visible: showText }); Overlays.editOverlay(descriptionText, { text: actionLocation.name, visible: showText });
@ -359,20 +345,6 @@ function handleLookAt(pickRay) {
function update(deltaTime) { function update(deltaTime) {
maybeCleanupLobby(); maybeCleanupLobby();
if (panelWall) { if (panelWall) {
if (reticle) {
Overlays.editOverlay(reticle, {
position: reticlePosition()
});
var nowDate = new Date();
var now = nowDate.getTime();
if (now - lastMouseMove > IDLE_HOVER_TIME) {
var pickRay = Camera.computeViewPickRay(0.5, 0.5);
handleLookAt(pickRay);
}
}
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() }); Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
// if the reticle is up then we may need to play the next muzak // if the reticle is up then we may need to play the next muzak
@ -384,8 +356,6 @@ function update(deltaTime) {
function mouseMoveEvent(event) { function mouseMoveEvent(event) {
if (panelWall) { if (panelWall) {
var nowDate = new Date();
lastMouseMove = nowDate.getTime();
var pickRay = Camera.computePickRay(event.x, event.y); var pickRay = Camera.computePickRay(event.x, event.y);
handleLookAt(pickRay); handleLookAt(pickRay);
} }

View file

@ -86,6 +86,7 @@ ChessGame.Board = (function(position, scale) {
modelURL: ChessGame.BOARD.modelURL, modelURL: ChessGame.BOARD.modelURL,
position: this.position, position: this.position,
dimensions: this.dimensions, dimensions: this.dimensions,
rotation: ChessGame.BOARD.rotation,
userData: this.buildUserDataString() userData: this.buildUserDataString()
} }
this.entity = null; this.entity = null;

View file

@ -167,8 +167,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_raiseMirror(0.0f), _raiseMirror(0.0f),
_lastMouseMove(usecTimestampNow()), _lastMouseMove(usecTimestampNow()),
_lastMouseMoveWasSimulated(false), _lastMouseMoveWasSimulated(false),
_mouseHidden(false),
_seenMouseMove(false),
_touchAvgX(0.0f), _touchAvgX(0.0f),
_touchAvgY(0.0f), _touchAvgY(0.0f),
_isTouchPressed(false), _isTouchPressed(false),
@ -1130,7 +1128,8 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (!event->isAutoRepeat()) { if (!event->isAutoRepeat()) {
// this starts an HFActionEvent // this starts an HFActionEvent
HFActionEvent startActionEvent(HFActionEvent::startType(), HFActionEvent startActionEvent(HFActionEvent::startType(),
_myCamera.computeViewPickRay(0.5f, 0.5f)); _myCamera.computePickRay(getTrueMouseX(),
getTrueMouseY()));
sendEvent(this, &startActionEvent); sendEvent(this, &startActionEvent);
} }
@ -1221,10 +1220,11 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
case Qt::Key_Space: { case Qt::Key_Space: {
if (!event->isAutoRepeat()) { if (!event->isAutoRepeat()) {
// this ends the HFActionEvent // this ends the HFActionEvent
HFActionEvent endActionEvent(HFActionEvent::endType(), _myCamera.computeViewPickRay(0.5f, 0.5f)); HFActionEvent endActionEvent(HFActionEvent::endType(),
_myCamera.computePickRay(getTrueMouseX(),
getTrueMouseY()));
sendEvent(this, &endActionEvent); sendEvent(this, &endActionEvent);
} }
break; break;
} }
case Qt::Key_Escape: { case Qt::Key_Escape: {
@ -1233,7 +1233,6 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
HFBackEvent endBackEvent(HFBackEvent::endType()); HFBackEvent endBackEvent(HFBackEvent::endType());
sendEvent(this, &endBackEvent); sendEvent(this, &endBackEvent);
} }
break; break;
} }
default: default:
@ -1252,34 +1251,24 @@ void Application::focusOutEvent(QFocusEvent* event) {
} }
void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
bool showMouse = true;
// Used by application overlay to determine how to draw cursor(s) // Used by application overlay to determine how to draw cursor(s)
_lastMouseMoveWasSimulated = deviceID > 0; _lastMouseMoveWasSimulated = deviceID > 0;
if (!_lastMouseMoveWasSimulated) {
// If this mouse move event is emitted by a controller, dont show the mouse cursor _lastMouseMove = usecTimestampNow();
if (_lastMouseMoveWasSimulated) { }
showMouse = false;
if (_aboutToQuit) {
return;
} }
if (!_aboutToQuit) {
_entities.mouseMoveEvent(event, deviceID); _entities.mouseMoveEvent(event, deviceID);
}
_controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it // if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface.isMouseCaptured()) { if (_controllerScriptingInterface.isMouseCaptured()) {
return; return;
} }
_lastMouseMove = usecTimestampNow();
if (_mouseHidden && showMouse && !OculusManager::isConnected() && !TV3DManager::isConnected()) {
getGLWidget()->setCursor(Qt::ArrowCursor);
_mouseHidden = false;
_seenMouseMove = true;
}
} }
void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
@ -2111,13 +2100,7 @@ void Application::updateMouseRay() {
// make sure the frustum is up-to-date // make sure the frustum is up-to-date
loadViewFrustum(_myCamera, _viewFrustum); loadViewFrustum(_myCamera, _viewFrustum);
// if the mouse pointer isn't visible, act like it's at the center of the screen PickRay pickRay = _myCamera.computePickRay(getTrueMouseX(), getTrueMouseY());
float x = 0.5f, y = 0.5f;
if (!_mouseHidden) {
x = getTrueMouseX() / (float)_glWidget->width();
y = getTrueMouseY() / (float)_glWidget->height();
}
PickRay pickRay = _myCamera.computeViewPickRay(x, y);
_mouseRayOrigin = pickRay.origin; _mouseRayOrigin = pickRay.origin;
_mouseRayDirection = pickRay.direction; _mouseRayDirection = pickRay.direction;
@ -2313,22 +2296,29 @@ void Application::updateCursor(float deltaTime) {
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateCursor()"); PerformanceWarning warn(showWarnings, "Application::updateCursor()");
// watch mouse position, if it hasn't moved, hide the cursor bool hideMouse = false;
bool underMouse = _glWidget->underMouse(); bool underMouse = _glWidget->underMouse();
if (!_mouseHidden) {
quint64 now = usecTimestampNow(); static const int HIDE_CURSOR_TIMEOUT = 3 * USECS_PER_SECOND; // 3 second
int elapsed = now - _lastMouseMove; int elapsed = usecTimestampNow() - _lastMouseMove;
const int HIDE_CURSOR_TIMEOUT = 1 * 1000 * 1000; // 1 second if ((elapsed > HIDE_CURSOR_TIMEOUT && underMouse) ||
if (elapsed > HIDE_CURSOR_TIMEOUT && (underMouse || !_seenMouseMove)) { (OculusManager::isConnected() && Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode))) {
getGLWidget()->setCursor(Qt::BlankCursor); hideMouse = true;
_mouseHidden = true; }
setCursorVisible(!hideMouse);
}
void Application::setCursorVisible(bool visible) {
if (visible) {
if (overrideCursor() != NULL) {
restoreOverrideCursor();
} }
} else { } else {
// if the mouse is hidden, but we're not inside our window, then consider ourselves to be moving if (overrideCursor() != NULL) {
if (!underMouse && _seenMouseMove) { changeOverrideCursor(Qt::BlankCursor);
_lastMouseMove = usecTimestampNow(); } else {
getGLWidget()->setCursor(Qt::ArrowCursor); setOverrideCursor(Qt::BlankCursor);
_mouseHidden = false;
} }
} }
} }
@ -2350,17 +2340,6 @@ void Application::update(float deltaTime) {
} }
static QCursor cursor;
if (OculusManager::isConnected() &&
Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)){
if (_window->cursor().shape() != Qt::BlankCursor) {
cursor = _window->cursor();
_window->setCursor(QCursor(Qt::BlankCursor));
}
} else if(_window->cursor().shape() == Qt::BlankCursor) {
_window->setCursor(cursor);
}
// Dispatch input events // Dispatch input events
_controllerScriptingInterface.updateInputControllers(); _controllerScriptingInterface.updateInputControllers();
@ -2874,8 +2853,13 @@ void Application::updateShadowMap() {
// store view matrix without translation, which we'll use for precision-sensitive objects // store view matrix without translation, which we'll use for precision-sensitive objects
updateUntranslatedViewMatrix(); updateUntranslatedViewMatrix();
// TODO: assign an equivalent viewTransform object to the application to match the current path which uses glMatrixStack
// setViewTransform(viewTransform); // Equivalent to what is happening with _untranslatedViewMatrix and the _viewMatrixTranslation
// the viewTransofmr object is updatded with the correct values and saved,
// this is what is used for rendering the Entities and avatars
Transform viewTransform;
viewTransform.setRotation(rotation);
setViewTransform(viewTransform);
glEnable(GL_POLYGON_OFFSET_FILL); glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.1f, 4.0f); // magic numbers courtesy http://www.eecs.berkeley.edu/~ravir/6160/papers/shadowmaps.ppt glPolygonOffset(1.1f, 4.0f); // magic numbers courtesy http://www.eecs.berkeley.edu/~ravir/6160/papers/shadowmaps.ppt
@ -4372,14 +4356,6 @@ void Application::skipVersion(QString latestVersion) {
skipFile.write(latestVersion.toStdString().c_str()); skipFile.write(latestVersion.toStdString().c_str());
} }
void Application::setCursorVisible(bool visible) {
if (visible) {
restoreOverrideCursor();
} else {
setOverrideCursor(Qt::BlankCursor);
}
}
void Application::takeSnapshot() { void Application::takeSnapshot() {
QMediaPlayer* player = new QMediaPlayer(); QMediaPlayer* player = new QMediaPlayer();
QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav"); QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav");

View file

@ -211,7 +211,8 @@ public:
EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; } EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; }
Environment* getEnvironment() { return &_environment; } Environment* getEnvironment() { return &_environment; }
bool isMousePressed() const { return _mousePressed; } bool isMousePressed() const { return _mousePressed; }
bool isMouseHidden() const { return _mouseHidden; } bool isMouseHidden() const { return _glWidget->cursor().shape() == Qt::BlankCursor; }
void setCursorVisible(bool visible);
const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; } const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; }
const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; } const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; }
bool mouseOnScreen() const; bool mouseOnScreen() const;
@ -310,8 +311,6 @@ public:
QStringList getRunningScripts() { return _scriptEnginesHash.keys(); } QStringList getRunningScripts() { return _scriptEnginesHash.keys(); }
ScriptEngine* getScriptEngine(QString scriptHash) { return _scriptEnginesHash.contains(scriptHash) ? _scriptEnginesHash[scriptHash] : NULL; } ScriptEngine* getScriptEngine(QString scriptHash) { return _scriptEnginesHash.contains(scriptHash) ? _scriptEnginesHash[scriptHash] : NULL; }
void setCursorVisible(bool visible);
bool isLookingAtMyAvatar(Avatar* avatar); bool isLookingAtMyAvatar(Avatar* avatar);
float getRenderResolutionScale() const; float getRenderResolutionScale() const;
@ -567,8 +566,6 @@ private:
int _mouseDragStartedY; int _mouseDragStartedY;
quint64 _lastMouseMove; quint64 _lastMouseMove;
bool _lastMouseMoveWasSimulated; bool _lastMouseMoveWasSimulated;
bool _mouseHidden;
bool _seenMouseMove;
glm::vec3 _mouseRayOrigin; glm::vec3 _mouseRayOrigin;
glm::vec3 _mouseRayDirection; glm::vec3 _mouseRayDirection;

View file

@ -132,8 +132,10 @@ void JoystickScriptingInterface::update() {
: HFActionEvent::endType(); : HFActionEvent::endType();
// global action events fire in the center of the screen // global action events fire in the center of the screen
HFActionEvent actionEvent(actionType, Application* app = Application::getInstance();
Application::getInstance()->getCamera()->computeViewPickRay(0.5f, 0.5f)); PickRay pickRay = app->getCamera()->computePickRay(app->getTrueMouseX(),
app->getTrueMouseY());
HFActionEvent actionEvent(actionType, pickRay);
qApp->sendEvent(qApp, &actionEvent); qApp->sendEvent(qApp, &actionEvent);
} }

View file

@ -536,7 +536,7 @@ void ApplicationOverlay::renderPointers() {
glm::vec2 screenPos = sphericalToScreen(glm::vec2(yaw, -pitch)); glm::vec2 screenPos = sphericalToScreen(glm::vec2(yaw, -pitch));
position = QPoint(screenPos.x, screenPos.y); position = QPoint(screenPos.x, screenPos.y);
QCursor::setPos(application->getGLWidget()->mapToGlobal(position)); application->getGLWidget()->cursor().setPos(application->getGLWidget()->mapToGlobal(position));
} }
_reticlePosition[MOUSE] = position; _reticlePosition[MOUSE] = position;

View file

@ -122,21 +122,21 @@ void FramelessDialog::mousePressEvent(QMouseEvent* mouseEvent) {
if (hitLeft || hitRight) { if (hitLeft || hitRight) {
_isResizing = true; _isResizing = true;
_resizeInitialWidth = size().width(); _resizeInitialWidth = size().width();
QApplication::setOverrideCursor(Qt::SizeHorCursor); setCursor(Qt::SizeHorCursor);
} }
} else { } else {
bool hitTop = (_position == POSITION_TOP) && (abs(mouseEvent->pos().y() - size().height()) < RESIZE_HANDLE_WIDTH); bool hitTop = (_position == POSITION_TOP) && (abs(mouseEvent->pos().y() - size().height()) < RESIZE_HANDLE_WIDTH);
if (hitTop) { if (hitTop) {
_isResizing = true; _isResizing = true;
_resizeInitialWidth = size().height(); _resizeInitialWidth = size().height();
QApplication::setOverrideCursor(Qt::SizeHorCursor); setCursor(Qt::SizeHorCursor);
} }
} }
} }
} }
void FramelessDialog::mouseReleaseEvent(QMouseEvent* mouseEvent) { void FramelessDialog::mouseReleaseEvent(QMouseEvent* mouseEvent) {
QApplication::restoreOverrideCursor(); unsetCursor();
_isResizing = false; _isResizing = false;
} }

View file

@ -1542,7 +1542,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
} }
} else { } else {
std::string whatisthat = subobject.name; std::string whatisthat = subobject.name;
if (whatisthat == "WTF") { if (whatisthat == "Shape") {
} }
} }
#endif #endif

View file

@ -44,7 +44,9 @@ bool ReceivedPacketProcessor::process() {
NetworkPacket& packet = _packets.front(); // get the oldest packet NetworkPacket& packet = _packets.front(); // get the oldest packet
NetworkPacket temporary = packet; // make a copy of the packet in case the vector is resized on us NetworkPacket temporary = packet; // make a copy of the packet in case the vector is resized on us
_packets.erase(_packets.begin()); // remove the oldest packet _packets.erase(_packets.begin()); // remove the oldest packet
if (!temporary.getNode().isNull()) {
_nodePacketCounts[temporary.getNode()->getUUID()]--; _nodePacketCounts[temporary.getNode()->getUUID()]--;
}
unlock(); // let others add to the packets unlock(); // let others add to the packets
processPacket(temporary.getNode(), temporary.getByteArray()); // process our temporary copy processPacket(temporary.getNode(), temporary.getByteArray()); // process our temporary copy
midProcess(); midProcess();

View file

@ -729,6 +729,10 @@ bool Octree::findRayIntersection(const glm::vec3& origin, const glm::vec3& direc
recurseTreeWithOperation(findRayIntersectionOp, &args); recurseTreeWithOperation(findRayIntersectionOp, &args);
if (args.found) {
args.distance *= (float)(TREE_SCALE); // scale back up to meters
}
if (gotLock) { if (gotLock) {
unlock(); unlock();
} }