Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vive Streaming fix / workaround #30

Merged
merged 6 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion Assets/Scenes/ModularInputScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.009389741, g: 0.010874605, b: 0.014736945, a: 1}
m_IndirectSpecularColor: {r: 0.009389737, g: 0.0108745955, b: 0.014736922, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -4672,7 +4672,42 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 6317846110913897978, guid: 9e86f8938bf545645ac69df2d86083ec,
type: 3}
insertIndex: -1
addedObject: {fileID: 6317846112967465990}
m_SourcePrefab: {fileID: 100100000, guid: 9e86f8938bf545645ac69df2d86083ec, type: 3}
--- !u!1 &6317846112967465988 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6317846110913897978, guid: 9e86f8938bf545645ac69df2d86083ec,
type: 3}
m_PrefabInstance: {fileID: 6317846112967465987}
m_PrefabAsset: {fileID: 0}
--- !u!114 &6317846112967465989 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6317846110913897976, guid: 9e86f8938bf545645ac69df2d86083ec,
type: 3}
m_PrefabInstance: {fileID: 6317846112967465987}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6317846112967465988}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6317846112967465990
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6317846112967465988}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7908bddc6dc44f86ad92b95c64d33d04, type: 3}
m_Name:
m_EditorClassIdentifier:
uiInputModule: {fileID: 6317846112967465989}
--- !u!224 &7101856252187588039 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5350470879762543667, guid: a064c784b84570846be74dc3380b0743,
Expand Down
7 changes: 7 additions & 0 deletions Assets/Scripts/VitrivrVR/Config/VitrivrVrConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ public enum SpeechToText
/// Path to location where log files are to be written.
/// </summary>
public string logFileLocation;

/// <summary>
/// Enables a fix for the Vive streaming bug by periodically disabling and re-enabling UI interactions when no
/// interactions are detected.
/// </summary>
public bool viveStreamingFixEnabled;

private VitrivrVrConfig()
{
Expand Down Expand Up @@ -204,6 +210,7 @@ private VitrivrVrConfig()
interactionLogSubmissionInterval = 10f;
writeLogsToFile = false;
logFileLocation = "session_logs/";
viveStreamingFixEnabled = false;
}

public static VitrivrVrConfig GetDefault()
Expand Down
36 changes: 36 additions & 0 deletions Assets/Scripts/VitrivrVR/Util/ViveStreamingFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem.UI;
using VitrivrVR.Config;

namespace VitrivrVR.Util
{
public class ViveStreamingFix : MonoBehaviour
{
public InputSystemUIInputModule uiInputModule;
private float _timer;

private void Awake()
{
if (ConfigManager.Config.viveStreamingFixEnabled) return;

Destroy(this);
}

private void FixedUpdate()
{
_timer += Time.fixedDeltaTime;
if (!(_timer >= 1)) return;

var res0 = uiInputModule.GetLastRaycastResult(0);
var res1 = uiInputModule.GetLastRaycastResult(1);
if (!res0.isValid && !res1.isValid)
{
uiInputModule.enabled = false;
uiInputModule.enabled = true;
}

_timer %= 1;
}
}
}
3 changes: 3 additions & 0 deletions Assets/Scripts/VitrivrVR/Util/ViveStreamingFix.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.