Merge pull request #8123 from AlexanderOtavka/first-person-hmd

Automatically enter first person when in HMD mode
This commit is contained in:
Sam Gondelman 2016-06-24 15:58:38 -07:00 committed by GitHub
commit 3c809ef40c
4 changed files with 22 additions and 0 deletions

View file

@ -19,6 +19,9 @@
#include "Application.h"
HMDScriptingInterface::HMDScriptingInterface() {
connect(qApp, &Application::activeDisplayPluginChanged, [this]{
emit displayModeChanged(isHMDMode());
});
}
glm::vec3 HMDScriptingInterface::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction) const {

View file

@ -31,6 +31,7 @@ public:
signals:
void IPDScaleChanged();
void displayModeChanged(bool isHMDMode);
private:
float _IPDScale{ 1.0 };

View file

@ -24,3 +24,4 @@ Script.load("system/controllers/handControllerPointer.js");
Script.load("system/controllers/squeezeHands.js");
Script.load("system/controllers/grab.js");
Script.load("system/dialTone.js");
Script.load("system/firstPersonHMD.js");

View file

@ -0,0 +1,17 @@
//
// firstPersonHMD.js
// system
//
// Created by Zander Otavka on 6/24/16
// Copyright 2016 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
//
// Automatically enter first person mode when entering HMD mode
HMD.displayModeChanged.connect(function(isHMDMode) {
if (isHMDMode) {
Camera.setModeString("first person");
}
});