diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index 06362e8885..0dc7253ba6 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -8711,6 +8711,14 @@ void Application::updateLoginDialogOverlayPosition() {
}
}
+bool Application::hasRiftControllers() {
+ return PluginUtils::isOculusTouchControllerAvailable();
+}
+
+bool Application::hasViveControllers() {
+ return PluginUtils::isViveControllerAvailable();
+}
+
void Application::onDismissedLoginDialog() {
_loginDialogPoppedUp = false;
loginDialogPoppedUp.set(false);
diff --git a/interface/src/Application.h b/interface/src/Application.h
index b70d5e72b9..dc30c3c22c 100644
--- a/interface/src/Application.h
+++ b/interface/src/Application.h
@@ -326,6 +326,10 @@ public:
void createLoginDialogOverlay();
void updateLoginDialogOverlayPosition();
+ // Check if a headset is connected
+ bool hasRiftControllers();
+ bool hasViveControllers();
+
#if defined(Q_OS_ANDROID)
void beforeEnterBackground();
void enterBackground();
diff --git a/interface/src/scripting/PlatformInfoScriptingInterface.cpp b/interface/src/scripting/PlatformInfoScriptingInterface.cpp
index bcbf87689e..b6e4df0d40 100644
--- a/interface/src/scripting/PlatformInfoScriptingInterface.cpp
+++ b/interface/src/scripting/PlatformInfoScriptingInterface.cpp
@@ -125,3 +125,11 @@ QString PlatformInfoScriptingInterface::getGraphicsCardType() {
return QString("NO IMPLEMENTED");
#endif
}
+
+bool PlatformInfoScriptingInterface::hasRiftControllers() {
+ return qApp->hasRiftControllers();
+}
+
+bool PlatformInfoScriptingInterface::hasViveControllers() {
+ return qApp->hasViveControllers();
+}
diff --git a/interface/src/scripting/PlatformInfoScriptingInterface.h b/interface/src/scripting/PlatformInfoScriptingInterface.h
index 903658cc20..3ed57965c9 100644
--- a/interface/src/scripting/PlatformInfoScriptingInterface.h
+++ b/interface/src/scripting/PlatformInfoScriptingInterface.h
@@ -53,6 +53,18 @@ public slots:
* @returns {string} graphics card type
*/
QString getGraphicsCardType();
+
+ /**jsdoc
+ * Returns true if Oculus Rift is connected (looks for hand controllers)
+ * @function Window.hasRift
+ * @returns {boolean} true
if running on Windows, otherwise false
.*/
+ bool hasRiftControllers();
+
+ /**jsdoc
+ * Returns true if HTC Vive is connected (looks for hand controllers)
+ * @function Window.hasRift
+ * @returns {boolean} true
if running on Windows, otherwise false
.*/
+ bool hasViveControllers();
};
#endif // hifi_PlatformInfoScriptingInterface_h