mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +02:00
Merge pull request #8123 from AlexanderOtavka/first-person-hmd
Automatically enter first person when in HMD mode
This commit is contained in:
commit
3c809ef40c
4 changed files with 22 additions and 0 deletions
|
@ -19,6 +19,9 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
HMDScriptingInterface::HMDScriptingInterface() {
|
HMDScriptingInterface::HMDScriptingInterface() {
|
||||||
|
connect(qApp, &Application::activeDisplayPluginChanged, [this]{
|
||||||
|
emit displayModeChanged(isHMDMode());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 HMDScriptingInterface::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction) const {
|
glm::vec3 HMDScriptingInterface::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction) const {
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void IPDScaleChanged();
|
void IPDScaleChanged();
|
||||||
|
void displayModeChanged(bool isHMDMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float _IPDScale{ 1.0 };
|
float _IPDScale{ 1.0 };
|
||||||
|
|
|
@ -24,3 +24,4 @@ Script.load("system/controllers/handControllerPointer.js");
|
||||||
Script.load("system/controllers/squeezeHands.js");
|
Script.load("system/controllers/squeezeHands.js");
|
||||||
Script.load("system/controllers/grab.js");
|
Script.load("system/controllers/grab.js");
|
||||||
Script.load("system/dialTone.js");
|
Script.load("system/dialTone.js");
|
||||||
|
Script.load("system/firstPersonHMD.js");
|
||||||
|
|
17
scripts/system/firstPersonHMD.js
Normal file
17
scripts/system/firstPersonHMD.js
Normal 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");
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in a new issue