diff --git a/Assets/Gothic-Core/Scripts/Const/Constants.cs b/Assets/Gothic-Core/Scripts/Const/Constants.cs
index 89e651cf1..7d14f83e1 100644
--- a/Assets/Gothic-Core/Scripts/Const/Constants.cs
+++ b/Assets/Gothic-Core/Scripts/Const/Constants.cs
@@ -110,11 +110,11 @@ public static class Animations
public static LayerMask WaterLayer = LayerMask.NameToLayer("Water");
public static LayerMask UILayer = LayerMask.NameToLayer("UI");
- // HVR Layers (could also be reused and implemented for XRIT if needed)
- public static LayerMask PlayerLayer = LayerMask.NameToLayer("Player"); // Layer 8 (suggested by HVR)
- public static LayerMask DynamicPoseLayer = LayerMask.NameToLayer("DynamicPose"); // Layer 9 (suggested by HVR)
- public static LayerMask GrabbableLayer = LayerMask.NameToLayer("Grabbable"); // Layer 20 (suggested by HVR)
- public static LayerMask HandLayer = LayerMask.NameToLayer("Hand"); // Layer 21 (suggested by HVR)
+ // VR layers (used by the VR backend for player, hands and grabbables)
+ public static LayerMask PlayerLayer = LayerMask.NameToLayer("Player"); // Layer 8 (VR backend default)
+ public static LayerMask DynamicPoseLayer = LayerMask.NameToLayer("DynamicPose"); // Layer 9 (VR backend default)
+ public static LayerMask GrabbableLayer = LayerMask.NameToLayer("Grabbable"); // Layer 20 (VR backend default)
+ public static LayerMask HandLayer = LayerMask.NameToLayer("Hand"); // Layer 21 (VR backend default)
// Custom layers
public static LayerMask VobItemLayer = LayerMask.NameToLayer("VobItem");
diff --git a/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs b/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs
index b9c272e8a..14de065a6 100644
--- a/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs
+++ b/Assets/Gothic-Core/Scripts/Domain/Vobs/VobInitializerDomain.cs
@@ -802,7 +802,7 @@ private static void SnapDigSpotToLoader(GameObject go)
///
/// Child vobs are created inside their parent's GO without a VobLoader of their own. Their adapters
- /// (VRVobContainer, HvrPhysicsChest, door lock picking, VRFocus) call
+ /// (VRVobContainer, chest lid physics, door lock picking, VRFocus) call
/// GetComponentInParent<VobLoader>() and got the PARENT's vob (often an unnamed zCVob) -
/// InvalidCastExceptions, "No door or container found for ><", doors/chests that don't work (G2 Xardas' tower).
///
diff --git a/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs b/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs
index 4051cb677..fc33bd480 100644
--- a/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs
+++ b/Assets/Gothic-Core/Scripts/Services/Caches/ResourceCacheService.cs
@@ -112,7 +112,7 @@ public void Init(string root, bool mountModFiles = false, IReadOnlyList
_prefab = new(s =>
{
// Lookup is done in following places:
- // 1. CONTEXT_NAME/Prefabs/... - overwrites lookup path below, used for specific prefabs, for current context (HVR, Flat, ...)
+ // 1. CONTEXT_NAME/Prefabs/... - overwrites lookup path below, used for specific prefabs, for current context (VR, Flat, ...)
// 2. Prefabs/... - Located inside core module (Gothic-Core), if we don't need special handling.
var contextPrefixPath = $"{_contextInteractionService.GetContextName()}/{s}";
return new[] { contextPrefixPath, s }.Select(Resources.Load)
diff --git a/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs b/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs
index bfac97158..5a05209c7 100644
--- a/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs
+++ b/Assets/Gothic-Core/Scripts/Services/Npc/NpcHelperService.cs
@@ -24,7 +24,7 @@ public class NpcHelperService
{
///
/// Ranges are in meter.
- /// FIXME - We should use PERC_ASSESSTALK range to leverage HVR's Grabbable hover and remote grab distance!
+ /// FIXME - We should use PERC_ASSESSTALK range to leverage the VR grab hover and remote grab distance!
///
public readonly Dictionary PerceptionRanges = new ();
diff --git a/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs b/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs
index 7a3036323..613f8d4a4 100644
--- a/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs
+++ b/Assets/Gothic-Core/Scripts/Services/Vobs/MobInteractionService.cs
@@ -30,7 +30,7 @@ public class MobInteractionService
[Inject] private readonly NpcInventoryService _npcInventoryService;
///
- /// Doors use HVRPhysicsDoor and chests their lid physics - not the mob/trigger path.
+ /// Doors use VR hinge physics and chests their lid physics - not the mob/trigger path.
/// Beds are oCMobDoors too (BED*/BEDHIGH* visuals), but get used like other mobs (SLEEPABIT_S1).
///
public bool ShouldHandleGrab(IVirtualObject vob)
diff --git a/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs b/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs
index 5e60d2874..5b9f7325d 100644
--- a/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs
+++ b/Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs
@@ -515,7 +515,7 @@ private void AddToMobInteractableList(VobContainer container)
switch (container.Vob.Type)
{
// case VirtualObjectType.oCMOB: // FIXME - Needed? e.g. IMovableObject
- // oCMobDoor excluded: doors use HVRPhysicsDoor for VR interaction, not AI_UseMob.
+ // oCMobDoor excluded: doors use VR hinge physics for interaction, not AI_UseMob.
case VirtualObjectType.oCMobFire:
case VirtualObjectType.oCMobInter:
case VirtualObjectType.oCMobBed:
diff --git a/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs b/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs
index 965871736..01b692c4e 100644
--- a/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs
+++ b/Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs
@@ -6,7 +6,6 @@
using Gothic.Core.Services.Caches;
using Gothic.Core.Services.Npc;
using Gothic.Core.Extensions;
-using HurricaneVR.Framework.Core.Utils;
using Reflex.Attributes;
using TMPro;
using UnityEngine;
@@ -60,7 +59,7 @@ public void MonsterDestroyClick()
private IEnumerator SpawnMonster(int amount, string instanceName = null)
{
- if (instanceName.IsNullOrWhiteSpace())
+ if (string.IsNullOrWhiteSpace(instanceName))
instanceName = _monsterSelector.options[_monsterSelector.value].text;
while (amount-- > 0)
diff --git a/Assets/Gothic-VR/Editor/Backends.meta b/Assets/Gothic-VR/Editor/Backends.meta
new file mode 100644
index 000000000..e0bca044e
--- /dev/null
+++ b/Assets/Gothic-VR/Editor/Backends.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 50e2c55096528eb4e9862698e09895bf
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Gothic-VR/Editor/Backends/Hvr.meta b/Assets/Gothic-VR/Editor/Backends/Hvr.meta
new file mode 100644
index 000000000..33be139d3
--- /dev/null
+++ b/Assets/Gothic-VR/Editor/Backends/Hvr.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 20444a335b2a3ce468b4eed4495db208
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Gothic-VR/Editor/HurricaneActions.cs b/Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs
similarity index 93%
rename from Assets/Gothic-VR/Editor/HurricaneActions.cs
rename to Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs
index 42937c501..c014ca396 100644
--- a/Assets/Gothic-VR/Editor/HurricaneActions.cs
+++ b/Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs
@@ -5,7 +5,7 @@
using UnityEditor.Rendering.Universal;
using UnityEngine;
-namespace Gothic.VR.Editor
+namespace Gothic.VR.Editor.Backends.Hvr
{
public class HurricaneActions
{
@@ -24,6 +24,9 @@ private static void ConvertHVRMaterialToURP()
foreach (var folder in _hvrMaterialFolders)
{
+ if (!Directory.Exists(folder))
+ continue;
+
materialFiles.AddRange(Directory.GetFiles(folder, "*.mat"));
}
diff --git a/Assets/Gothic-VR/Editor/HurricaneActions.cs.meta b/Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs.meta
similarity index 100%
rename from Assets/Gothic-VR/Editor/HurricaneActions.cs.meta
rename to Assets/Gothic-VR/Editor/Backends/Hvr/HurricaneActions.cs.meta
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs b/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs
index 10999817b..94a0c7f45 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs
@@ -1,16 +1,23 @@
-#if GOTHIC_HVR_INSTALLED
+using System;
using Gothic.Core.Adapters.Context;
+using Gothic.Core.Extensions;
+using Gothic.Core.Logging;
using Gothic.Core.Models.Context;
using Gothic.Core.Services.Context;
+using Gothic.VR.Interaction.Ports;
using Gothic.VR.Services.Context;
-using Gothic.Core.Extensions;
using Reflex.Attributes;
using ZenKit;
+using Logger = Gothic.Core.Logging.Logger;
+#if GOTHIC_HVR_INSTALLED
+using Gothic.VR.Interaction.Backends.Hvr;
+#endif
namespace Gothic.VR.Adapters.Context
{
///
/// Bootstrap class which will register listener to set this module as Active if GameSettings.Controls match.
+ /// Also selects the VR backend (interaction framework) which provides our VR ports.
///
public class VRContextBootstrap : AbstractContextBootstrap
{
@@ -19,24 +26,42 @@ public class VRContextBootstrap : AbstractContextBootstrap
[Inject] private readonly ContextDialogService _contextDialogService;
[Inject] private readonly ContextTextInputService _contextTextInputService;
+ ///
+ /// Returns the VR backend compiled into this build, or null if none is available.
+ ///
+ public static IVrBackend SelectBackend()
+ {
+#if GOTHIC_HVR_INSTALLED
+ return new HvrBackend();
+#else
+ return null;
+#endif
+ }
+
protected override void RegisterControlModule(Controls controls)
{
if (controls != Controls.VR)
return;
-// We register VR only if we have HVR installed.
-#if GOTHIC_HVR_INSTALLED
- // We need to set our VR service now, as the Player.scene loading time (basically this Awake() call) is the first time,
- // when we can set our VR service. But the [Inject] resolves are done already at frame 0 at Bootstrap.scene.
- // Therefore, we need to set the VR service via new() and as proxy implementation.
+ var backend = SelectBackend();
+ if (backend == null)
+ {
+ const string message = "VR controls are set, but no VR backend is available. " +
+ "Set DeveloperConfig > Controls.GameControls = Flat, or install a VR backend " +
+ "(e.g. HVR, plus scripting define >GOTHIC_HVR_INSTALLED<).";
+ Logger.LogError(message, LogCat.VR);
+ throw new ArgumentException(message);
+ }
+
+ Logger.Log($"VR backend: {backend.Name}", LogCat.VR);
+
+ // We need to set our VR service now, as the Player.scene loading time (basically this Awake() call) is
+ // the first time, when we can set our VR service. But the [Inject] resolves are done already at frame 0
+ // at Bootstrap.scene. Therefore, we need to set the VR service via new() and as proxy implementation.
_contextInteractionService.SetImpl(new VRContextInteractionService());
_contextMenuService.SetImpl(new VRContextMenuService().Inject());
_contextDialogService.SetImpl(new VRContextDialogService().Inject());
_contextTextInputService.SetImpl(new VRContextTextInputService());
-#else
- throw new System.ArgumentException(
- "VR context is set, but compiler directive >GOTHIC_HVR_INSTALLED< isn't set. Did you set up Hurricane VR properly?");
-#endif
}
protected override void RegisterGameVersionModule(GameVersion version)
@@ -45,4 +70,3 @@ protected override void RegisterGameVersionModule(GameVersion version)
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs
index 6d71d715a..28be0b9de 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrColliderHitTracker.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Debugging.Fighting;
namespace Gothic.VR.Adapters.Debugging.Fighting
@@ -8,4 +7,3 @@ public class VrColliderHitTracker : ColliderHitTracker
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs
index ba89e15c4..02cc01d07 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Debugging/Fighting/VrNpcColliderDebugAdapter.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Debugging.Fighting;
namespace Gothic.VR.Debugging.Fighting
@@ -8,4 +7,3 @@ public class VrNpcColliderDebugAdapter : NpcColliderDebugAdapter
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs b/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs
index 3b55c8ca7..3e2a4fbdb 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Marvin/MarvinInspectorTabHandler.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using System.Collections.Generic;
using Gothic.Core.Adapters.UI;
using Gothic.Core;
@@ -230,4 +229,3 @@ private GameObject CreateField(MarvinProperty floatProperty, GameObject r
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs
index e94e0bca6..acec0ec87 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -368,4 +367,3 @@ private void SubtractItemFromHand(List inventory, GameObject handIt
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs
index 48cefc69c..ecd70d436 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRFistAttackAdapter.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Const;
using Gothic.VR.Adapters.Vob.VobItem;
@@ -24,4 +23,3 @@ private void Start()
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs
index fde3e48da..58b573193 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using Gothic.VR.Services;
using Reflex.Attributes;
using UnityEngine;
@@ -44,4 +43,3 @@ public void SetOnTop(bool onTop)
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs
index 0717f09ac..a810f6b77 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRIntroduceChapter.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using System.Collections;
using Gothic.Core.Extensions;
using Gothic.Core.Manager;
@@ -71,4 +70,3 @@ private IEnumerator DisableDelayed(int milliseconds)
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs
index 5e5c9f80d..53cae9242 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Adapters.UI.Menus;
using Gothic.Core.Const;
using Gothic.Core.Services;
@@ -101,4 +100,3 @@ private bool IsGameScene()
}
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs
index ec77eb34d..9e50444b2 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Manager;
using Gothic.VR.Interaction.Models;
using Gothic.VR.Interaction.Ports;
@@ -56,4 +55,3 @@ private void OnBeforeGrabbed(VrGrabArgs args)
}
}
-#endif
diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs
index 9b35186a2..c210ea7ca 100644
--- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs
+++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs
@@ -1,4 +1,3 @@
-#if GOTHIC_HVR_INSTALLED
using System.Collections.Generic;
using Gothic.Core.Adapters.Vob;
using Gothic.Core.Extensions;
@@ -235,4 +234,3 @@ public IEnumerable