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 19cfd848f..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, VRVobContainerPhysicsChest, 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/GlobalEventDispatcher.cs b/Assets/Gothic-Core/Scripts/GlobalEventDispatcher.cs index aa7fefb6b..d8566a242 100644 --- a/Assets/Gothic-Core/Scripts/GlobalEventDispatcher.cs +++ b/Assets/Gothic-Core/Scripts/GlobalEventDispatcher.cs @@ -63,6 +63,11 @@ public static class GlobalEventDispatcher // Fight events + + /// + /// HINT: Left/Right have other values than Gothic.VR.Interaction.Models.VrHandSide (Left=0, Right=1). + /// Map them with VrHandSideExtensions, never cast. + /// public enum HandSide { None = 0, @@ -99,7 +104,8 @@ public enum HandSide // LockPicking events // 1. VobContainer -> LockPick // 2. VobContainer -> Door/Chest - // 3. HandSide (for VR) -> (0 = Left, 1 = Right) + // 3. HandSide (for VR) -> int of Gothic.VR.Interaction.Models.VrHandSide (0 = Left, 1 = Right), + // not GlobalEventDispatcher.HandSide. public static readonly UnityEvent LockPickComboCorrect = new(); public static readonly UnityEvent LockPickComboWrong = new(); public static readonly UnityEvent LockPickComboFinished = new(); 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/Resources/VR/Prefabs/HVR - Player.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/HVR - Player.prefab index 2a31bd4b2..860bf49bb 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/HVR - Player.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/HVR - Player.prefab @@ -709,90 +709,6 @@ PrefabInstance: propertyPath: RaycastLayermask.m_Bits value: 9438272 objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 4104050421938227924} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 4104050421938227924} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnGrabbed - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnReleased - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 5592562468148006618} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Components.Player.VRPlayerWeaponInteraction, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Components.Player.VRPlayerWeaponInteraction, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRPlayerItemAdapter, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 2034389217661245426, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} propertyPath: m_LocalRotation.w value: 0.5 @@ -825,10 +741,6 @@ PrefabInstance: propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 9da7c4efedc95434385f95fd36a71279, type: 2} - - target: {fileID: 2573056120201010472, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: 'm_Materials.Array.data[1]' - value: - objectReference: {fileID: 2100000, guid: 9da7c4efedc95434385f95fd36a71279, type: 2} - target: {fileID: 2623048716060499684, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: @@ -905,34 +817,6 @@ PrefabInstance: propertyPath: SFXGrab value: objectReference: {fileID: 0} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 5592562468148006618} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRPlayerItemAdapter, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 2980805439611176150, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 3063419232759952031, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} propertyPath: Tags.Tags value: @@ -941,122 +825,6 @@ PrefabInstance: propertyPath: Tags._data value: 1 objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.size - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[1].m_Mode - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3760600358070659426} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 9202099228209387433} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 3760600358070659426} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[1].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnReleased - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 9202099228209387433} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 3367897735511474143, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 3367897735596539136, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} propertyPath: SocketContainer value: @@ -1093,34 +861,6 @@ PrefabInstance: propertyPath: SFXGrab value: objectReference: {fileID: 0} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 5592562468148006618} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRPlayerItemAdapter, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 3964033594404211023, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 4653310549361533989, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} propertyPath: m_IsActive value: 0 @@ -1205,90 +945,6 @@ PrefabInstance: propertyPath: RaycastLayermask.m_Bits value: 5243968 objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 4104050421938227924} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 4104050421938227924} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnGrabbed - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnReleased - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 5592562468148006618} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Components.Player.VRPlayerWeaponInteraction, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Components.Player.VRPlayerWeaponInteraction, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRPlayerItemAdapter, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 7340868166416387179, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} propertyPath: m_LocalRotation.w value: 0 @@ -1499,24 +1155,51 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 2923976313076319325, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: -1 addedObject: {fileID: 3523100539866759593} + - targetCorrespondingSourceObject: {fileID: 2923976313076319325, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 201725255711756182} - targetCorrespondingSourceObject: {fileID: 2923976313507361695, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: -1 addedObject: {fileID: 3789326534228044634} + - targetCorrespondingSourceObject: {fileID: 3367897735596539146, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 265470885364990989} - targetCorrespondingSourceObject: {fileID: 3367897735511474145, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: 1 addedObject: {fileID: 6510255065976159289} + - targetCorrespondingSourceObject: {fileID: 3367897735511474145, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 6830298057528518834} - targetCorrespondingSourceObject: {fileID: 703588620095445913, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: -1 addedObject: {fileID: 851891696609758034} - targetCorrespondingSourceObject: {fileID: 2641012728304036569, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: 1 addedObject: {fileID: 1678881631422854599} + - targetCorrespondingSourceObject: {fileID: 2641012728304036569, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 8030036349999634828} - targetCorrespondingSourceObject: {fileID: 887448239260712835, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: 1 addedObject: {fileID: 757337884793384726} + - targetCorrespondingSourceObject: {fileID: 887448239260712835, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 7010009710009411731} + - targetCorrespondingSourceObject: {fileID: 8237771281066642269, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 2406662486614375646} + - targetCorrespondingSourceObject: {fileID: 3327876949398026377, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 8462357697535986096} - targetCorrespondingSourceObject: {fileID: 8886962481680141934, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: -1 addedObject: {fileID: 4516976911541839521} + - targetCorrespondingSourceObject: {fileID: 8653842037556556660, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 1976198550646775587} + - targetCorrespondingSourceObject: {fileID: 3309422083963978583, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + insertIndex: -1 + addedObject: {fileID: 9213565482220769279} - targetCorrespondingSourceObject: {fileID: 6718914276336705915, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} insertIndex: -1 addedObject: {fileID: 3489498994974388381} @@ -1537,7 +1220,7 @@ MonoBehaviour: m_CorrespondingSourceObject: {fileID: 1685099869530008038, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 6965913448549182659} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ce026d01d1f538044a048be125f5a85e, type: 3} @@ -1626,63 +1309,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 9202099228209387433} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 3760600358070659426} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutIntoHolster - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 9202099228209387433} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 3760600358070659426} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutOutOfHolster - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -1726,6 +1359,18 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] DebugScale: 0 +--- !u!114 &7010009710009411731 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1505226319018549300} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!4 &1672321467721471303 stripped Transform: m_CorrespondingSourceObject: {fileID: 1118649348335930096, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} @@ -1905,9 +1550,6 @@ MonoBehaviour: MouseSensitivityX: 1 IsGrounded: 0 _actualVelocity: 0 - MenuHandler: {fileID: 2192772470500779476} - Cinema: {fileID: 8331837288116874071} - _characterControllerSwimDiveStepHeight: 1 --- !u!114 &6929123780788603430 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1975,25 +1617,6 @@ MonoBehaviour: UseWASD: 0 IsMouseDown: 0 MouseAxis: {x: 0, y: 0} - IsMenuActivated: 0 - MenuState: - Active: 0 - JustActivated: 0 - JustDeactivated: 0 - Value: 0 - IsMenuButtonEnabled: 1 - BothGripsActivatedState: - Active: 0 - JustActivated: 0 - JustDeactivated: 0 - Value: 0 - IsBothGripsActivated: 0 - IsBothGripsActive: 0 - BothGripsActiveState: - Active: 0 - JustActivated: 0 - JustDeactivated: 0 - Value: 0 --- !u!82 &4890979928761266796 AudioSource: m_ObjectHideFlags: 0 @@ -2123,8 +1746,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4722222ff5b643658bd19ac210dbf94b, type: 3} m_Name: m_EditorClassIdentifier: - _playerController: {fileID: 1958783043908878430} - _playerInputs: {fileID: 6929123780788603430} _waterBobAmplitude: 0.001 _waterBobFrequency: 2.5 _swimStartDiveVerticalVelocity: -1 @@ -2167,8 +1788,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 94f83c78c0664d83b28cbaed370379c1, type: 3} m_Name: m_EditorClassIdentifier: - _playerController: {fileID: 1958783043908878430} - _playerInputs: {fileID: 6929123780788603430} _leftHandModel: {fileID: 2989725703437136398} _rightHandModel: {fileID: 3179937809927698473} _leftHandRigidbody: {fileID: 7701449421344543976} @@ -2202,6 +1821,22 @@ MonoBehaviour: - {fileID: 4383562423631724883} _onTopMaterial: {fileID: 2100000, guid: 0733e67100959404abf850e406e5cb05, type: 2} _onTopRenderQueue: 3950 +--- !u!114 &201725255711756182 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3469872688444955626} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ae71b0be15a534849b5249a3e671a43f, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Player.VRPlayer + MenuHandler: {fileID: 2192772470500779476} + Cinema: {fileID: 8331837288116874071} + SwimDiveStepHeight: 1 + IsMenuButtonEnabled: 1 --- !u!114 &3699890743539135334 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 3164866306463935697, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} @@ -2213,6 +1848,23 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6bccf1e5bfe81ea449669046dd363b91, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &3845537509841100000 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3309422083963978583, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + m_PrefabInstance: {fileID: 1779900574691844023} + m_PrefabAsset: {fileID: 0} +--- !u!114 &9213565482220769279 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3845537509841100000} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4fc5f324acfcbc3428010a9db3c9422e, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrGrabberBridge --- !u!1 &3895146393672982614 stripped GameObject: m_CorrespondingSourceObject: {fileID: 3367897735511474145, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} @@ -2232,63 +1884,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 9202099228209387433} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 3760600358070659426} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutIntoHolster - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 9202099228209387433} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 3760600358070659426} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutOutOfHolster - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -2331,17 +1933,63 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] DebugScale: 0 +--- !u!114 &6830298057528518834 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3895146393672982614} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!114 &3895146393690940081 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 3367897735596539142, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 3895146393690940093} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 6953a3149e8e4d1468962577608f0002, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &3895146393690940093 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3367897735596539146, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + m_PrefabInstance: {fileID: 1779900574691844023} + m_PrefabAsset: {fileID: 0} +--- !u!114 &265470885364990989 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3895146393690940093} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge +--- !u!1 &3935447129917564734 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3327876949398026377, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + m_PrefabInstance: {fileID: 1779900574691844023} + m_PrefabAsset: {fileID: 0} +--- !u!114 &8462357697535986096 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3935447129917564734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4fc5f324acfcbc3428010a9db3c9422e, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrGrabberBridge --- !u!137 &4253138355794772639 stripped SkinnedMeshRenderer: m_CorrespondingSourceObject: {fileID: 2573056120201010472, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} @@ -2366,63 +2014,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 9202099228209387433} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 3760600358070659426} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutIntoHolster - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 9202099228209387433} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 3760600358070659426} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutOutOfHolster - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -2466,6 +2064,18 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] DebugScale: 0 +--- !u!114 &8030036349999634828 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4329570237425759598} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!137 &4383562423631724883 stripped SkinnedMeshRenderer: m_CorrespondingSourceObject: {fileID: 2623048716060499684, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} @@ -2545,12 +2155,29 @@ Rigidbody: m_CorrespondingSourceObject: {fileID: 8653842037556556662, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} +--- !u!1 &6965913448549182659 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8653842037556556660, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + m_PrefabInstance: {fileID: 1779900574691844023} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1976198550646775587 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6965913448549182659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4fc5f324acfcbc3428010a9db3c9422e, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrGrabberBridge --- !u!114 &6965913448549182662 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8653842037556556657, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 6965913448549182659} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: de1e5b754bd6d9241a88e889575193b2, type: 3} @@ -2630,12 +2257,29 @@ Rigidbody: m_CorrespondingSourceObject: {fileID: 8237771281066642271, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} +--- !u!1 &7701449421344543978 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8237771281066642269, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} + m_PrefabInstance: {fileID: 1779900574691844023} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2406662486614375646 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7701449421344543978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4fc5f324acfcbc3428010a9db3c9422e, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrGrabberBridge --- !u!114 &7701449421344543983 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8237771281066642264, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 7701449421344543978} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: de1e5b754bd6d9241a88e889575193b2, type: 3} @@ -2687,7 +2331,7 @@ MonoBehaviour: m_CorrespondingSourceObject: {fileID: 7204430235297583144, guid: c43ac1b5fbd2fc24ea40fb28bae6be3e, type: 3} m_PrefabInstance: {fileID: 1779900574691844023} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 7701449421344543978} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ce026d01d1f538044a048be125f5a85e, type: 3} @@ -3457,6 +3101,22 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 3389792897302281518, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: _additionalSockets.Array.size + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 3389792897302281518, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: '_additionalSockets.Array.data[0]' + value: + objectReference: {fileID: 1505226319018549300} + - target: {fileID: 3389792897302281518, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: '_additionalSockets.Array.data[1]' + value: + objectReference: {fileID: 4329570237425759598} + - target: {fileID: 3389792897302281518, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: '_additionalSockets.Array.data[2]' + value: + objectReference: {fileID: 3895146393672982614} - target: {fileID: 6429825415842413170, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} propertyPath: m_Name value: BackPack @@ -3465,62 +3125,22 @@ PrefabInstance: propertyPath: Socket value: objectReference: {fileID: 3895146393690940081} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 0 + - target: {fileID: 7245954016319570917, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: _holsterSockets.Array.size + value: 3 objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target + - target: {fileID: 7245954016319570917, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: '_holsterSockets.Array.data[0]' value: - objectReference: {fileID: 3760600358070659426} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target + objectReference: {fileID: 1505226319018549300} + - target: {fileID: 7245954016319570917, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: '_holsterSockets.Array.data[1]' value: - objectReference: {fileID: 3760600358070659426} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBackpackGrabbedToShoulder - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBackpackReleasedFromShoulder - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 6847336371662012770, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} + objectReference: {fileID: 4329570237425759598} + - target: {fileID: 7245954016319570917, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} + propertyPath: '_holsterSockets.Array.data[2]' + value: + objectReference: {fileID: 3895146393672982614} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -3537,17 +3157,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6ebc937e678155e4d86feeb9248cca97, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &3760600358070659426 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7245954016319570917, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - m_PrefabInstance: {fileID: 5818257988439845511} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0e87e25baf014b28a5aaa89ab1e7c31f, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &4505433718888639186 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 7942131790731640917, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} @@ -3580,17 +3189,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 3447029125977450136, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} m_PrefabInstance: {fileID: 5818257988439845511} m_PrefabAsset: {fileID: 0} ---- !u!114 &9202099228209387433 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3389792897302281518, guid: 9887ca19e46b4d547b2ad40c47c756b9, type: 3} - m_PrefabInstance: {fileID: 5818257988439845511} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d33b9b45f9124f6b8afdb52a10613db0, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &6171425951156898325 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack.prefab index 07854330c..3c8964429 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack.prefab @@ -1244,6 +1244,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d33b9b45f9124f6b8afdb52a10613db0, type: 3} m_Name: m_EditorClassIdentifier: + _additionalSockets: [] --- !u!1 &8611331733936325895 GameObject: m_ObjectHideFlags: 0 @@ -1293,15 +1294,15 @@ PrefabInstance: m_Modifications: - target: {fileID: 6401121504383089494, guid: 4293d805a850fb84885c55f47b7299bd, type: 3} propertyPath: m_text - value: '' + value: objectReference: {fileID: 0} - target: {fileID: 6401121504383089494, guid: 4293d805a850fb84885c55f47b7299bd, type: 3} propertyPath: m_fontAsset - value: + value: objectReference: {fileID: 11400000, guid: ed34b05229166f3469c21b7208879736, type: 2} - target: {fileID: 6401121504383089494, guid: 4293d805a850fb84885c55f47b7299bd, type: 3} propertyPath: m_sharedMaterial - value: + value: objectReference: {fileID: 5152873236376385906, guid: ed34b05229166f3469c21b7208879736, type: 2} - target: {fileID: 6401121504383089494, guid: 4293d805a850fb84885c55f47b7299bd, type: 3} propertyPath: m_VerticalAlignment @@ -1476,54 +1477,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: -8.42 objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnReleased - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, Assembly-CSharp - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, Assembly-CSharp - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 5745926728969230625, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} propertyPath: m_Name value: LargeInventorySlot (1) @@ -1535,13 +1488,33 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 5745926728969230625, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} + insertIndex: -1 + addedObject: {fileID: 2684062889524706141} m_SourcePrefab: {fileID: 100100000, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} --- !u!4 &1092358407863461626 stripped Transform: m_CorrespondingSourceObject: {fileID: 279963425429311615, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} m_PrefabInstance: {fileID: 921680395576817285} m_PrefabAsset: {fileID: 0} +--- !u!1 &4861590189747613604 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5745926728969230625, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} + m_PrefabInstance: {fileID: 921680395576817285} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2684062889524706141 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4861590189747613604} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1001 &1005704614264749958 PrefabInstance: m_ObjectHideFlags: 0 @@ -1594,30 +1567,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (5) @@ -1632,6 +1581,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} m_PrefabInstance: {fileID: 1005704614264749958} m_PrefabAsset: {fileID: 0} +--- !u!1 &6675445855591365778 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 1005704614264749958} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1389077964738786662 PrefabInstance: m_ObjectHideFlags: 0 @@ -1684,30 +1638,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (9) @@ -1722,6 +1652,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} m_PrefabInstance: {fileID: 1389077964738786662} m_PrefabAsset: {fileID: 0} +--- !u!1 &4760857495613421170 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 1389077964738786662} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1530620310586974029 PrefabInstance: m_ObjectHideFlags: 0 @@ -1944,30 +1879,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (1) @@ -1982,6 +1893,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} m_PrefabInstance: {fileID: 1687738458635627183} m_PrefabAsset: {fileID: 0} +--- !u!1 &5060643589338769851 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 1687738458635627183} + m_PrefabAsset: {fileID: 0} --- !u!1001 &2058406356030869475 PrefabInstance: m_ObjectHideFlags: 0 @@ -2034,30 +1950,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (7) @@ -2072,6 +1964,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} m_PrefabInstance: {fileID: 2058406356030869475} m_PrefabAsset: {fileID: 0} +--- !u!1 &5604698998649162999 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 2058406356030869475} + m_PrefabAsset: {fileID: 0} --- !u!1001 &2426361580239670146 PrefabInstance: m_ObjectHideFlags: 0 @@ -2298,30 +2195,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (4) @@ -2336,6 +2209,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} m_PrefabInstance: {fileID: 2803095436446461417} m_PrefabAsset: {fileID: 0} +--- !u!1 &8624835105962077949 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 2803095436446461417} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3540224607268887998 PrefabInstance: m_ObjectHideFlags: 0 @@ -2392,54 +2270,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: -8.42 objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnReleased - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, Assembly-CSharp - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, Assembly-CSharp - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 4130146776124590184, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 5745926728969230625, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} propertyPath: m_Name value: LargeInventorySlot @@ -2451,13 +2281,33 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 5745926728969230625, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} + insertIndex: -1 + addedObject: {fileID: 2341765446252910576} m_SourcePrefab: {fileID: 100100000, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} --- !u!4 &3657985873771433409 stripped Transform: m_CorrespondingSourceObject: {fileID: 279963425429311615, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} m_PrefabInstance: {fileID: 3540224607268887998} m_PrefabAsset: {fileID: 0} +--- !u!1 &9123385126480888991 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5745926728969230625, guid: 9c8562e025362a940aa6d5640a2299a3, type: 3} + m_PrefabInstance: {fileID: 3540224607268887998} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2341765446252910576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9123385126480888991} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1001 &3809279864917086369 PrefabInstance: m_ObjectHideFlags: 0 @@ -2510,30 +2360,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (2) @@ -2548,6 +2374,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} m_PrefabInstance: {fileID: 3809279864917086369} m_PrefabAsset: {fileID: 0} +--- !u!1 &7316746845000471477 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 3809279864917086369} + m_PrefabAsset: {fileID: 0} --- !u!1001 &5194386894083015225 PrefabInstance: m_ObjectHideFlags: 0 @@ -2600,30 +2431,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (3) @@ -2633,6 +2440,11 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} +--- !u!1 &1819774192277225773 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 5194386894083015225} + m_PrefabAsset: {fileID: 0} --- !u!4 &6343286390695634847 stripped Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} @@ -2732,6 +2544,15 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: -2445633797789926738, guid: 6cb8512e2712dc24ab93173e96e1a2bf, type: 3} insertIndex: -1 addedObject: {fileID: 7245954016319570917} + - targetCorrespondingSourceObject: {fileID: -2445633797789926738, guid: 6cb8512e2712dc24ab93173e96e1a2bf, type: 3} + insertIndex: -1 + addedObject: {fileID: 9172675630291073396} + - targetCorrespondingSourceObject: {fileID: -2445633797789926738, guid: 6cb8512e2712dc24ab93173e96e1a2bf, type: 3} + insertIndex: -1 + addedObject: {fileID: 6751980293987059883} + - targetCorrespondingSourceObject: {fileID: -2445633797789926738, guid: 6cb8512e2712dc24ab93173e96e1a2bf, type: 3} + insertIndex: -1 + addedObject: {fileID: 7637540381203976400} m_SourcePrefab: {fileID: 100100000, guid: 6cb8512e2712dc24ab93173e96e1a2bf, type: 3} --- !u!1 &510075797823002552 stripped GameObject: @@ -2745,10 +2566,10 @@ Rigidbody: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 510075797823002552} - serializedVersion: 4 + serializedVersion: 5 m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 + m_LinearDamping: 0 + m_AngularDamping: 0.05 m_CenterOfMass: {x: 0, y: 0, z: 0} m_InertiaTensor: {x: 1, y: 1, z: 1} m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} @@ -2984,7 +2805,54 @@ MonoBehaviour: m_EditorClassIdentifier: _categoryText: {fileID: 2564309041635058493} _pagerText: {fileID: 5783876815826470689} - _socketContainer: {fileID: 7942131790731640917} + _holsterSockets: [] + _inventorySockets: + - {fileID: 5060643589338769851} + - {fileID: 7316746845000471477} + - {fileID: 1819774192277225773} + - {fileID: 8624835105962077949} + - {fileID: 6675445855591365778} + - {fileID: 1134907965030801990} + - {fileID: 5604698998649162999} + - {fileID: 922373524700368431} + - {fileID: 4760857495613421170} + - {fileID: 3572143840313904494} +--- !u!114 &9172675630291073396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510075797823002552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &6751980293987059883 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510075797823002552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge +--- !u!114 &7637540381203976400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510075797823002552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3698197d5ce58d542a61ce69122e3160, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketContainerBridge --- !u!4 &3447029125977450136 stripped Transform: m_CorrespondingSourceObject: {fileID: 8560556203703700366, guid: 6cb8512e2712dc24ab93173e96e1a2bf, type: 3} @@ -3047,30 +2915,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (8) @@ -3080,6 +2924,11 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} +--- !u!1 &922373524700368431 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 6745236048955395387} + m_PrefabAsset: {fileID: 0} --- !u!4 &5587329364365519005 stripped Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} @@ -3137,30 +2986,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - target: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} propertyPath: m_Name value: BackpackInventorySlot (6) @@ -3170,6 +2995,11 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} +--- !u!1 &1134907965030801990 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} + m_PrefabInstance: {fileID: 6815926870810616146} + m_PrefabAsset: {fileID: 0} --- !u!4 &5658424827838203124 stripped Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 2dd29fe4a7e819740af535267b7cc113, type: 3} @@ -3243,46 +3073,6 @@ PrefabInstance: propertyPath: Size value: 0.3 objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 7245954016319570917} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnItemPutIntoBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnReleased - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: OnItemPutOutOfBackpack - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 3389792897302281518} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnBeforeGrabbed - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: Released.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, Gothic.VR - objectReference: {fileID: 0} - - target: {fileID: 3711332657821201227, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} - propertyPath: BeforeGrabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Vob.Container.VRVobContainerSocketInventory, Gothic.VR - objectReference: {fileID: 0} - target: {fileID: 4434190707277561806, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} propertyPath: Target value: @@ -3333,6 +3123,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 5274205726842812995, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} m_PrefabInstance: {fileID: 6973195385822662266} m_PrefabAsset: {fileID: 0} +--- !u!1 &3572143840313904494 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5861164055357080340, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} + m_PrefabInstance: {fileID: 6973195385822662266} + m_PrefabAsset: {fileID: 0} --- !u!4 &8130138916144720860 stripped Transform: m_CorrespondingSourceObject: {fileID: 1157928709923595686, guid: 8301813fbd70d3b47b2ab9ec26c3615e, type: 3} @@ -3692,7 +3487,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 6401121504383089494, guid: 4293d805a850fb84885c55f47b7299bd, type: 3} propertyPath: m_text - value: '' + value: objectReference: {fileID: 0} - target: {fileID: 6401121504383089494, guid: 4293d805a850fb84885c55f47b7299bd, type: 3} propertyPath: m_fontSize diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackInventorySlot.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackInventorySlot.prefab index 566d7b1bf..6b4fee0f5 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackInventorySlot.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackInventorySlot.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 4434190707277561806} - component: {fileID: 7810595717036477131} - component: {fileID: 8782956222347397959} + - component: {fileID: 1881403388789157283} m_Layer: 0 m_Name: VRBackpackInventorySlot m_TagString: Untagged @@ -51,63 +52,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, - Assembly-CSharp - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutOutOfBackpack - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, - Assembly-CSharp - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutIntoBackpack - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -219,6 +170,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &1881403388789157283 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5861164055357080340} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &7098095399602562181 GameObject: m_ObjectHideFlags: 0 @@ -280,6 +243,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -301,7 +266,9 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackLargeInventorySlot.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackLargeInventorySlot.prefab index e1815ce5c..24dd48465 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackLargeInventorySlot.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Player-Elements/BackPack/VRBackpackLargeInventorySlot.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 1109714354293663205} - component: {fileID: 4434190707277561806} - component: {fileID: 8782956222347397959} + - component: {fileID: 3068390016136051502} m_Layer: 0 m_Name: VRBackpackLargeInventorySlot m_TagString: Untagged @@ -51,63 +52,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, - Assembly-CSharp - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutOutOfBackpack - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.HVR.Components.VobContainer.HVRVobContainerSocketInventory, - Assembly-CSharp - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: Gothic.VR.Adapters.Player.VRBackpack, Gothic.VR - m_MethodName: OnItemPutIntoBackpack - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -119,7 +70,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -220,6 +170,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &3068390016136051502 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5861164055357080340} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1001 &3062234451954866645 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem.prefab index b701fdb9e..ccbf13ffa 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem.prefab @@ -16,6 +16,8 @@ GameObject: - component: {fileID: 8543334853728962911} - component: {fileID: 8461469363836242350} - component: {fileID: 2018021949967966991} + - component: {fileID: 5746501746354695612} + - component: {fileID: 6145980801324581266} m_Layer: 6 m_Name: oCItem m_TagString: GothicVob @@ -46,10 +48,10 @@ Rigidbody: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6503575194566409312} - serializedVersion: 4 + serializedVersion: 5 m_Mass: 2.5 - m_Drag: 0 - m_AngularDrag: 0.05 + m_LinearDamping: 0 + m_AngularDamping: 0.05 m_CenterOfMass: {x: 0, y: 0, z: 0} m_InertiaTensor: {x: 1, y: 1, z: 1} m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} @@ -166,64 +168,16 @@ MonoBehaviour: m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 8543334853728962911} - m_TargetAssemblyTypeName: Gothic.HVR.Components.HVROCItem, Assembly-CSharp - m_MethodName: OnGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 8543334853728962911} - m_TargetAssemblyTypeName: Gothic.HVR.Components.HVRoCItem, Assembly-CSharp - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 6759220176799969513} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 6759220176799969513} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -309,6 +263,30 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _injectionStrategy: 2 +--- !u!114 &5746501746354695612 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6503575194566409312} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &6145980801324581266 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6503575194566409312} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1001 &2283517946604736509 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem/LockPick.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem/LockPick.prefab index 8b50348a1..321b61843 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem/LockPick.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCItem/LockPick.prefab @@ -161,9 +161,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5b286a6d3f574029ae48428e93591d28, type: 3} m_Name: m_EditorClassIdentifier: - IsSocketed: 0 IsInsideLock: 0 - ActiveDoorLock: {fileID: 0} + ActiveContainerDoorPicking: {fileID: 0} HoldingHand: {fileID: 0} --- !u!4 &6888142504213485964 stripped Transform: diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobBed.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobBed.prefab index e05e3d41e..26c42099d 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobBed.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobBed.prefab @@ -13,6 +13,8 @@ GameObject: - component: {fileID: 2854363553026066547} - component: {fileID: 6907302684280751333} - component: {fileID: 2225125317086924068} + - component: {fileID: 6622844009418538601} + - component: {fileID: 2985694541242234038} m_Layer: 6 m_Name: BIP01.*|ZM.* m_TagString: Untagged @@ -152,34 +154,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -224,6 +202,30 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: dc7b9870e5ee6804aa346c39e83f17c7, type: 3} m_Name: m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Vob.VRMobInteraction +--- !u!114 &6622844009418538601 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &2985694541242234038 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1 &6503575194566409312 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobContainer.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobContainer.prefab index d27fbccbc..2592d8fd0 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobContainer.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobContainer.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 3492144785080063237} - component: {fileID: 7889487273161906977} - component: {fileID: 7785860572896069705} + - component: {fileID: 1468309271852763067} m_Layer: 0 m_Name: ItemSocket (1) m_TagString: Untagged @@ -51,39 +52,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -95,7 +70,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -195,6 +169,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &1468309271852763067 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 251161015644863541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &1058267453060700974 GameObject: m_ObjectHideFlags: 0 @@ -209,6 +195,7 @@ GameObject: - component: {fileID: 6214475728348187998} - component: {fileID: 8532409929422760468} - component: {fileID: 7916747858208428323} + - component: {fileID: 521888360392017761} m_Layer: 0 m_Name: ItemSocket (11) m_TagString: Untagged @@ -246,39 +233,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -290,7 +251,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -390,6 +350,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &521888360392017761 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1058267453060700974} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &1378983584142208125 GameObject: m_ObjectHideFlags: 0 @@ -404,6 +376,7 @@ GameObject: - component: {fileID: 1875918564020284620} - component: {fileID: 9153324367550496876} - component: {fileID: 5755579173600781048} + - component: {fileID: 8487832477624126045} m_Layer: 0 m_Name: ItemSocket (5) m_TagString: Untagged @@ -441,39 +414,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -485,7 +432,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -585,6 +531,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &8487832477624126045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1378983584142208125} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &1404770959867932707 GameObject: m_ObjectHideFlags: 0 @@ -646,6 +604,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -667,9 +627,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &2214792497711643535 GameObject: @@ -732,6 +694,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -753,9 +717,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &2987689210569271698 GameObject: @@ -837,7 +803,6 @@ MonoBehaviour: m_EditorClassIdentifier: _rootGO: {fileID: 6503575194566409312} _audioSource: {fileID: 1934416043258242669} - _hvrPhysicsDoor: {fileID: 6797639264981372780} --- !u!135 &1304255910539477860 SphereCollider: m_ObjectHideFlags: 0 @@ -870,6 +835,7 @@ GameObject: - component: {fileID: 7540743326042314200} - component: {fileID: 923689649037191229} - component: {fileID: 2596048974797699402} + - component: {fileID: 4022459671801958678} m_Layer: 0 m_Name: Inventory m_TagString: Untagged @@ -943,6 +909,19 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d33b9b45f9124f6b8afdb52a10613db0, type: 3} m_Name: m_EditorClassIdentifier: + _additionalSockets: [] +--- !u!114 &4022459671801958678 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3405583761693813258} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3698197d5ce58d542a61ce69122e3160, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketContainerBridge --- !u!1 &3425223447465731592 GameObject: m_ObjectHideFlags: 0 @@ -1004,6 +983,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1025,9 +1006,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &3676950170103165385 GameObject: @@ -1043,6 +1026,7 @@ GameObject: - component: {fileID: 6457455381913810790} - component: {fileID: 4667297139685793446} - component: {fileID: 1904934727426696998} + - component: {fileID: 4386314002942822306} m_Layer: 0 m_Name: ItemSocket (4) m_TagString: Untagged @@ -1080,39 +1064,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -1124,7 +1082,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -1224,6 +1181,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &4386314002942822306 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3676950170103165385} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &3808700244132799788 GameObject: m_ObjectHideFlags: 0 @@ -1238,6 +1207,7 @@ GameObject: - component: {fileID: 2559447240399077539} - component: {fileID: 2099805584684839997} - component: {fileID: 5825525148917267618} + - component: {fileID: 5243031492779952397} m_Layer: 0 m_Name: ItemSocket (10) m_TagString: Untagged @@ -1275,39 +1245,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -1319,7 +1263,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -1419,6 +1362,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &5243031492779952397 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3808700244132799788} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &3951947908768828885 GameObject: m_ObjectHideFlags: 0 @@ -1480,6 +1435,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1501,9 +1458,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &4098042481361422127 GameObject: @@ -1566,6 +1525,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1587,9 +1548,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &4112695746748433750 GameObject: @@ -1652,6 +1615,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1673,9 +1638,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &4312441289917667731 GameObject: @@ -1820,6 +1787,7 @@ GameObject: - component: {fileID: 5785087856397484637} - component: {fileID: 2720868678405414166} - component: {fileID: 2783188317653191907} + - component: {fileID: 4313482169820223075} m_Layer: 0 m_Name: ItemSocket (6) m_TagString: Untagged @@ -1857,39 +1825,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -1901,7 +1843,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -2001,6 +1942,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &4313482169820223075 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4544068122292998800} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &5161994242912671296 GameObject: m_ObjectHideFlags: 0 @@ -2062,6 +2015,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -2083,9 +2038,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &5871940868660505720 GameObject: @@ -2148,6 +2105,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -2169,9 +2128,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &5980433150175133251 GameObject: @@ -2188,6 +2149,9 @@ GameObject: - component: {fileID: 7136319683539270999} - component: {fileID: 6573836035492029965} - component: {fileID: 6797639264981372780} + - component: {fileID: 172510743831141755} + - component: {fileID: 8269181727875358990} + - component: {fileID: 1469359342129423611} m_Layer: 11 m_Name: BIP01 CHEST_.*_1 m_TagString: Untagged @@ -2218,10 +2182,10 @@ Rigidbody: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5980433150175133251} - serializedVersion: 4 + serializedVersion: 5 m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 + m_LinearDamping: 0 + m_AngularDamping: 0.05 m_CenterOfMass: {x: 0, y: 0, z: 0} m_InertiaTensor: {x: 1, y: 1, z: 1} m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} @@ -2354,34 +2318,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 5337214664733562970} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 5337214664733562970} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -2491,6 +2431,42 @@ MonoBehaviour: _rootGo: {fileID: 6503575194566409312} _socketContainer: {fileID: 923689649037191229} _collectorCollider: {fileID: 9145350332021062103} +--- !u!114 &172510743831141755 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5980433150175133251} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &8269181727875358990 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5980433150175133251} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge +--- !u!114 &1469359342129423611 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5980433150175133251} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9fca5660b7d87044b9f6309422813386, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrHingeBridge --- !u!1 &6389233531767616918 GameObject: m_ObjectHideFlags: 0 @@ -2552,6 +2528,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -2573,9 +2551,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &6503575194566409312 GameObject: @@ -2699,6 +2679,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -2720,9 +2702,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &6719234714038604469 GameObject: @@ -2738,6 +2722,7 @@ GameObject: - component: {fileID: 158729719686616005} - component: {fileID: 7916741380795831998} - component: {fileID: 5298672618290999715} + - component: {fileID: 7297648640871248928} m_Layer: 0 m_Name: ItemSocket (0) m_TagString: Untagged @@ -2775,39 +2760,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -2819,7 +2778,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -2919,6 +2877,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &7297648640871248928 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6719234714038604469} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &6822371266024915418 GameObject: m_ObjectHideFlags: 0 @@ -2933,6 +2903,7 @@ GameObject: - component: {fileID: 4704764476294233102} - component: {fileID: 598568339332800422} - component: {fileID: 2564368200858102714} + - component: {fileID: 6827862672640001227} m_Layer: 0 m_Name: ItemSocket (7) m_TagString: Untagged @@ -2970,39 +2941,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -3014,7 +2959,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -3114,6 +3058,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &6827862672640001227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6822371266024915418} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &6842481923038689323 GameObject: m_ObjectHideFlags: 0 @@ -3175,6 +3131,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -3196,9 +3154,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &7330976607743722592 GameObject: @@ -3214,6 +3174,7 @@ GameObject: - component: {fileID: 5927022531090099218} - component: {fileID: 1469796680986704926} - component: {fileID: 2037134406786832725} + - component: {fileID: 491441172845085459} m_Layer: 0 m_Name: ItemSocket (8) m_TagString: Untagged @@ -3251,39 +3212,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -3295,7 +3230,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -3395,6 +3329,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &491441172845085459 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7330976607743722592} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &8017589019207168410 GameObject: m_ObjectHideFlags: 0 @@ -3409,6 +3355,7 @@ GameObject: - component: {fileID: 372745028345143667} - component: {fileID: 2809123207245500460} - component: {fileID: 1543325685525774575} + - component: {fileID: 6878980199702300609} m_Layer: 0 m_Name: ItemSocket (3) m_TagString: Untagged @@ -3446,39 +3393,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -3490,7 +3411,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -3590,6 +3510,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &6878980199702300609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8017589019207168410} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &8321360292962761766 GameObject: m_ObjectHideFlags: 0 @@ -3604,6 +3536,7 @@ GameObject: - component: {fileID: 3576335141605442734} - component: {fileID: 1273249311594439381} - component: {fileID: 8938383412123691392} + - component: {fileID: 4791134024498380442} m_Layer: 0 m_Name: ItemSocket (9) m_TagString: Untagged @@ -3641,39 +3574,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -3685,7 +3592,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -3785,6 +3691,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &4791134024498380442 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8321360292962761766} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &8517697476932975960 GameObject: m_ObjectHideFlags: 0 @@ -3851,7 +3769,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 3118550354282009099} GrabBags: [] - _allowGrabbing: 0 SocketContainer: {fileID: 923689649037191229} GrabbleMustBeHeld: 0 --- !u!114 &3118550354282009099 @@ -3914,6 +3831,7 @@ GameObject: - component: {fileID: 7577847198649703145} - component: {fileID: 3895740475241616462} - component: {fileID: 9057796826089372788} + - component: {fileID: 1082262625873351403} m_Layer: 0 m_Name: ItemSocket (2) m_TagString: Untagged @@ -3951,39 +3869,13 @@ MonoBehaviour: m_EditorClassIdentifier: BeforeGrabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnBeforeGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Grabbed: m_PersistentCalls: m_Calls: [] Released: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2596048974797699402} - m_TargetAssemblyTypeName: Gothic.VR.Components.VobContainer.VRVobContainerSocketInventory, - Gothic.VR - m_MethodName: OnReleased - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] BeforeHoverEnter: m_PersistentCalls: m_Calls: [] @@ -3995,7 +3887,6 @@ MonoBehaviour: m_Calls: [] _grabBag: {fileID: 0} GrabBags: [] - _allowGrabbing: 0 GrabControl: 0 GrabDetectionType: 1 CheckHandOverlap: 0 @@ -4095,6 +3986,18 @@ MonoBehaviour: Tags: {fileID: 11400000, guid: 836908d62a0d2e8489d7e21e7f774964, type: 2} _data: 3 Any: 1 +--- !u!114 &1082262625873351403 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8739208446635805306} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50fce3b6fdf41d541a8cb5f194cfd30a, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrSocketBridge --- !u!1 &8984571792552414776 GameObject: m_ObjectHideFlags: 0 @@ -4156,6 +4059,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -4177,9 +4082,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!1001 &6500207459066028785 PrefabInstance: diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobDoor.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobDoor.prefab index 538cbe85e..8d82277d7 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobDoor.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobDoor.prefab @@ -15,6 +15,9 @@ GameObject: - component: {fileID: 258546060515477993} - component: {fileID: 6106660089090848833} - component: {fileID: 2964456439257095392} + - component: {fileID: 1447025355381534221} + - component: {fileID: 7842253579892008169} + - component: {fileID: 87455771706928418} m_Layer: 6 m_Name: BIP01 DOORANGLE m_TagString: Untagged @@ -45,10 +48,10 @@ Rigidbody: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 980716176992391296} - serializedVersion: 4 + serializedVersion: 5 m_Mass: 10 - m_Drag: 0 - m_AngularDrag: 0.05 + m_LinearDamping: 0 + m_AngularDamping: 0.05 m_CenterOfMass: {x: 0, y: 0, z: 0} m_InertiaTensor: {x: 1, y: 1, z: 1} m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} @@ -181,34 +184,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2934795001242935560} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2934795001242935560} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -315,6 +294,42 @@ MonoBehaviour: PreviousClosed: 0 VerboseLogging: 0 Locked: 0 +--- !u!114 &1447025355381534221 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 980716176992391296} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &7842253579892008169 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 980716176992391296} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge +--- !u!114 &87455771706928418 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 980716176992391296} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9fca5660b7d87044b9f6309422813386, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrHingeBridge --- !u!1 &1222579370199367537 GameObject: m_ObjectHideFlags: 0 @@ -523,7 +538,6 @@ MonoBehaviour: m_EditorClassIdentifier: _rootGO: {fileID: 6503575194566409312} _audioSource: {fileID: 4670513280573296585} - _hvrPhysicsDoor: {fileID: 2964456439257095392} --- !u!135 &827370569709809547 SphereCollider: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobFire.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobFire.prefab index 792acacd9..4d5cc6937 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobFire.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobFire.prefab @@ -13,6 +13,8 @@ GameObject: - component: {fileID: 2854363553026066547} - component: {fileID: 6907302684280751333} - component: {fileID: 2520659641626351288} + - component: {fileID: 7062935307805374239} + - component: {fileID: 8587772998141430396} m_Layer: 6 m_Name: ZM_.*LIGHTER m_TagString: Untagged @@ -152,34 +154,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -224,6 +202,30 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: dc7b9870e5ee6804aa346c39e83f17c7, type: 3} m_Name: m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Vob.VRMobInteraction +--- !u!114 &7062935307805374239 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &8587772998141430396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1 &6503575194566409312 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter.prefab index f899e974e..1cf05cd15 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter.prefab @@ -13,6 +13,8 @@ GameObject: - component: {fileID: 2854363553026066547} - component: {fileID: 6907302684280751333} - component: {fileID: 3676752456108531535} + - component: {fileID: 3911890553226910476} + - component: {fileID: 3096177028477653256} m_Layer: 6 m_Name: BIP01.*|ZM.* m_TagString: Untagged @@ -152,34 +154,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -224,6 +202,30 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: dc7b9870e5ee6804aa346c39e83f17c7, type: 3} m_Name: m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Vob.VRMobInteraction +--- !u!114 &3911890553226910476 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &3096177028477653256 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1 &6503575194566409312 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter/Seat.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter/Seat.prefab index aab913851..cde097fbe 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter/Seat.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobInter/Seat.prefab @@ -56,26 +56,6 @@ PrefabInstance: propertyPath: Rigidbody value: objectReference: {fileID: 492138702362873769} - - target: {fileID: 6907302684280751333, guid: 6cbff20e63c6e794fa758a47d703f2df, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6907302684280751333, guid: 6cbff20e63c6e794fa758a47d703f2df, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 1502701034376819458} - - target: {fileID: 6907302684280751333, guid: 6cbff20e63c6e794fa758a47d703f2df, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 6907302684280751333, guid: 6cbff20e63c6e794fa758a47d703f2df, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: OnGrabbed - objectReference: {fileID: 0} - - target: {fileID: 6907302684280751333, guid: 6cbff20e63c6e794fa758a47d703f2df, type: 3} - propertyPath: Grabbed.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: Gothic.VR.Adapters.Player.VRSeat, Gothic.VR - objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -136,5 +116,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 89204bc4f3825b04bbeaa10da0266f6e, type: 3} m_Name: m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Player.VRSeat - _canvasFade: {fileID: 0} _fadeSpeed: 6 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobLadder.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobLadder.prefab index ef90fe157..68afdcac8 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobLadder.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobLadder.prefab @@ -12,6 +12,8 @@ GameObject: - component: {fileID: 2279246351159797278} - component: {fileID: 229708145539930019} - component: {fileID: 2893514479669655516} + - component: {fileID: 5158607502795523759} + - component: {fileID: 1622434811052915792} m_Layer: 0 m_Name: BIP01 LADDER m_TagString: Untagged @@ -150,34 +152,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 252428407596682482} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 252428407596682482} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -210,6 +188,30 @@ MonoBehaviour: HandGrabbers: [] Stabbers: [] Stabbable: {fileID: 0} +--- !u!114 &5158607502795523759 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3766033816963121094} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &1622434811052915792 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3766033816963121094} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1 &6503575194566409312 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobSwitch.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobSwitch.prefab index 7cfcd2362..970b6a006 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobSwitch.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobSwitch.prefab @@ -91,6 +91,8 @@ GameObject: - component: {fileID: 6429894365401520520} - component: {fileID: 2478502802283214804} - component: {fileID: 6762376611792587169} + - component: {fileID: 5867362459497893582} + - component: {fileID: 7548610693852835858} m_Layer: 6 m_Name: BIP01.* m_TagString: Untagged @@ -230,34 +232,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 6429894365401520520} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 6429894365401520520} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -302,6 +280,30 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: dc7b9870e5ee6804aa346c39e83f17c7, type: 3} m_Name: m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Vob.VRMobInteraction +--- !u!114 &5867362459497893582 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8788472130516112289} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &7548610693852835858 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8788472130516112289} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1001 &7374455095753343057 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobWheel.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobWheel.prefab index c997fdda2..86bbe44de 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobWheel.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobWheel.prefab @@ -13,6 +13,8 @@ GameObject: - component: {fileID: 2854363553026066547} - component: {fileID: 6907302684280751333} - component: {fileID: 8384191140399634538} + - component: {fileID: 5498683309141561368} + - component: {fileID: 3429509007387962835} m_Layer: 6 m_Name: .* m_TagString: Untagged @@ -152,34 +154,10 @@ MonoBehaviour: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2854363553026066547} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -224,6 +202,30 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: dc7b9870e5ee6804aa346c39e83f17c7, type: 3} m_Name: m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Adapters.Vob.VRMobInteraction +--- !u!114 &5498683309141561368 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &3429509007387962835 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5926234300762413270} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1 &6503575194566409312 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCNpc.prefab b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCNpc.prefab index 3ea4fa907..302eae8b5 100644 --- a/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCNpc.prefab +++ b/Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCNpc.prefab @@ -125,7 +125,6 @@ MonoBehaviour: DebugPauseAtPlayAnimation: 0 DebugPauseAtStopAnimation: 0 DebugPlayAnimation: - RootBone: {fileID: 8679908380237941234} --- !u!114 &7657019000195239257 MonoBehaviour: m_ObjectHideFlags: 0 @@ -311,6 +310,8 @@ GameObject: - component: {fileID: 8720130747125307888} - component: {fileID: 957202922675155714} - component: {fileID: 8095166574519349901} + - component: {fileID: 8068816277696156100} + - component: {fileID: 7853705596767096919} m_Layer: 10 m_Name: RootMotionCollider m_TagString: Untagged @@ -471,78 +472,16 @@ MonoBehaviour: m_Calls: [] Grabbed: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 4148423720954529152} - m_TargetAssemblyTypeName: Gothic.HVR.Components.HVRoCNpc, Assembly-CSharp - m_MethodName: OnGrabbed - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Released: m_PersistentCalls: m_Calls: [] HoverEnter: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 383060561904739675} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverEnter - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 3776598624381708510} - m_TargetAssemblyTypeName: Gothic.Core.Adapters.UI.StatusBars.StatusBarAdapter, - Gothic.Core - m_MethodName: EnableBar - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] HoverExit: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 383060561904739675} - m_TargetAssemblyTypeName: GVR.HVR.Components.HVRFocus, Assembly-CSharp - m_MethodName: OnHoverExit - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - - m_Target: {fileID: 3776598624381708510} - m_TargetAssemblyTypeName: Gothic.Core.Adapters.UI.StatusBars.StatusBarAdapter, - Gothic.Core - m_MethodName: DisableBar - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] Collided: m_PersistentCalls: m_Calls: [] @@ -575,6 +514,30 @@ MonoBehaviour: HandGrabbers: [] Stabbers: [] Stabbable: {fileID: 0} +--- !u!114 &8068816277696156100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3647559741746323219} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5165ad186aed3fb408c5d43079b20d34, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrInteractable +--- !u!114 &7853705596767096919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3647559741746323219} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 594f5e7857d0629419c1bef807639a86, type: 3} + m_Name: + m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrInteractableBridge --- !u!1 &3748409399599174953 GameObject: m_ObjectHideFlags: 0 @@ -877,17 +840,6 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6ce7e724ba52cae47a499f87c612cd47, type: 3} ---- !u!114 &3776598624381708510 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1174396645238234420, guid: 6ce7e724ba52cae47a499f87c612cd47, type: 3} - m_PrefabInstance: {fileID: 2604602267262121450} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e6c728d9fa1f409bad98a31897d804e1, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!224 &6204853864044937825 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 8230739814078363531, guid: 6ce7e724ba52cae47a499f87c612cd47, type: 3} 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/HVROverrides.meta b/Assets/Gothic-VR/Scripts/Adapters/HVROverrides.meta deleted file mode 100644 index 014cc8ec9..000000000 --- a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9769f62ce70e4bdbb907c1dacfc8b6b3 -timeCreated: 1730258998 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerController.cs b/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerController.cs deleted file mode 100644 index 12e790799..000000000 --- a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerController.cs +++ /dev/null @@ -1,267 +0,0 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core; -using Gothic.Core.Adapters.UI.Menus; -using Gothic.Core.Const; -using Gothic.Core.Services; -using Gothic.Core.Services.Config; -using Gothic.VR.Adapters.UI; -using HurricaneVR.Framework.Core.Player; -using MyBox; -using Reflex.Attributes; -using UnityEngine; -using UnityEngine.SceneManagement; - -namespace Gothic.VR.Adapters.HVROverrides -{ - public class VRPlayerController : HVRPlayerController - { - [Inject] private readonly ConfigService _configService; - [Inject] private readonly GameStateService _gameStateService; - - public VRPlayerInputs VrInputs => (VRPlayerInputs)Inputs; - - [Separator("Gothic - Settings")] - public MenuHandler MenuHandler; - public VRCinema Cinema; - - [SerializeField] private float _characterControllerSwimDiveStepHeight = 1f; // 1m means walking out of water in Xardas' old tower in G1. - - // For resetting values when stop swimming. - private float _defaultCharacterControllerStepHeight; - - protected override void Start() - { - base.Start(); - GlobalEventDispatcher.PlayerPrefUpdated.AddListener(OnPlayerPrefsUpdated); - - _defaultCharacterControllerStepHeight = CharacterController.stepOffset; - - // Enabled later via button press or other events - MenuHandler?.gameObject.SetActive(false); - } - - protected override void Update() - { - base.Update(); - - if (VrInputs.IsMenuActivated && IsGameScene() && (Cinema == null || !Cinema.IsBlockingInput)) - { - _gameStateService.InGameAndAlive = true; - MenuHandler.ToggleVisibility(); - } - } - - private void OnDestroy() - { - GlobalEventDispatcher.PlayerPrefUpdated.RemoveListener(OnPlayerPrefsUpdated); - } - - /// - /// Used in game scenes where you play the game (world.unity, ...) - /// - public void SetNormalControls(bool useDefaultValues = false) - { - // We have our player created before Gothic inis are loaded. We therefore need to set some default values. - if (useDefaultValues) - { - CameraRig.SetSitStandMode(HVRSitStand.PlayerHeight); - DirectionStyle = PlayerDirectionMode.Camera; - RotationType = RotationType.Snap; - SnapAmount = 45f; - SmoothTurnSpeed = 90f; - - return; - } - - var sitStandSetting = - _configService.Gothic.GetInt(VRConstants.IniNames.SitStand, (int)HVRSitStand.PlayerHeight); - CameraRig.SetSitStandMode((HVRSitStand)sitStandSetting); - - DirectionStyle = (PlayerDirectionMode)_configService.Gothic.GetInt(VRConstants.IniNames.MoveDirection, (int)PlayerDirectionMode.Camera); - RotationType = (RotationType)_configService.Gothic.GetInt(VRConstants.IniNames.RotationType, (int)RotationType.Snap); - - var snapSetting = _configService.Gothic.GetInt(VRConstants.IniNames.SnapRotationAmount, VRConstants.SnapRotationDefaultValue); - // e.g., 20° = 5° + 3*5° - SnapAmount = VRConstants.SnapRotationAmountSettingTickAmount + VRConstants.SnapRotationAmountSettingTickAmount * snapSetting; - - var smoothSetting = _configService.Gothic.GetFloat(VRConstants.IniNames.SmoothRotationSpeed, VRConstants.SmoothRotationDefaultValue); - // e.g., 50 = 5 + 90 * 0.5f - SmoothTurnSpeed = VRConstants.SmoothRotationMinSpeed + VRConstants.SmoothRotationMaxAdditionalSpeed * smoothSetting; - } - - /// - /// Disable certain actions to keep player stuck in current position. - /// - public void SetLockedControls() - { - // HINT: Disable physics - // We can't disable physics as it would prevent HVRTeleport.Teleport() from finishing (as it checks for Player.IsGrounded every frame). - // Therefore, we need to ground the player always on a plane and disable movement only. - - MovementEnabled = false; - RotationEnabled = false; - Teleporter.enabled = false; - } - - public void SetUnlockedControls() - { - MovementEnabled = true; - RotationEnabled = true; - Teleporter.enabled = true; - } - - public void SetWalkingControls() - { - ChangeGrabbing(true); - - CanCrouch = true; - CanJump = true; - Teleporter.enabled = true; - CharacterController.stepOffset = _defaultCharacterControllerStepHeight; - - // Disable vertical walking controls - } - - public void SetWaterWalkingControls() - { - ChangeGrabbing(true); - - CanCrouch = false; - CanJump = false; - Teleporter.enabled = false; - CharacterController.stepOffset = _characterControllerSwimDiveStepHeight; - } - - public void SetSwimmingControls() - { - // Disable grabbing of objects (as in G1) - ChangeGrabbing(false); - - CanCrouch = false; - CanJump = false; - Teleporter.enabled = false; - CharacterController.stepOffset = _characterControllerSwimDiveStepHeight; - - // Disable vertical walking controls - } - - public void SetDivingControls() - { - // Disable grabbing of objects (as in G1) - ChangeGrabbing(false); - - CanCrouch = false; - CanJump = false; - Teleporter.enabled = false; - CharacterController.stepOffset = _characterControllerSwimDiveStepHeight; - - // Enable vertical walking controls - } - - private void ChangeGrabbing(bool enable) - { - LeftHand.AllowGrabbing = enable; - LeftHand.ForceGrabber.AllowGrabbing = enable; - LeftHand.AllowHovering = enable; - LeftHand.ForceGrabber.AllowHovering = enable; - - RightHand.AllowGrabbing = enable; - RightHand.ForceGrabber.AllowGrabbing = enable; - RightHand.AllowHovering = enable; - RightHand.ForceGrabber.AllowHovering = enable; - - // Disable hand animations. Basically open the hand fully if disabled=true - if (LeftHand.HandAnimator && LeftHand.HandAnimator.CurrentPoser) - { - if (LeftHand.HandAnimator.CurrentPoser.PrimaryPose != null) - { - LeftHand.HandAnimator.CurrentPoser.PrimaryPose.Disabled = !enable; - } - - if (LeftHand.HandAnimator.CurrentPoser.Blends != null) - { - LeftHand.HandAnimator.CurrentPoser.Blends.ForEach(i => i.Disabled = !enable); - } - } - - if (RightHand.HandAnimator && RightHand.HandAnimator.CurrentPoser) - { - if (RightHand.HandAnimator.CurrentPoser.PrimaryPose != null) - { - RightHand.HandAnimator.CurrentPoser.PrimaryPose.Disabled = !enable; - } - - if (RightHand.HandAnimator.CurrentPoser.Blends != null) - { - RightHand.HandAnimator.CurrentPoser.Blends.ForEach(i => i.Disabled = !enable); - } - } - } - - private void OnPlayerPrefsUpdated(string preferenceKey, object value) - { - // Just update everything. - if (preferenceKey == VRConstants.IniNames.MoveDirection || - preferenceKey == VRConstants.IniNames.RotationType || - preferenceKey == VRConstants.IniNames.SnapRotationAmount || - preferenceKey == VRConstants.IniNames.SmoothRotationSpeed || - preferenceKey == VRConstants.IniNames.SitStand) - { - SetNormalControls(); - } - } - - /// - /// Game scenes are all the ones where we play. Aka !=MainMenu, !=Loadings, !=Logo videos, ... - /// - private bool IsGameScene() - { - var activeSceneName = SceneManager.GetActiveScene().name; - - return activeSceneName switch - { - Constants.SceneBootstrap => false, - Constants.ScenePlayer => false, - Constants.SceneGameVersion => false, - Constants.ScenePreCaching => false, - Constants.SceneLogo => false, - Constants.SceneMainMenu => false, - Constants.SceneLoading => false, - _ => true - }; - } - - // protected override void HandleHorizontalMovement() - // { - // if (_playerAi.WalkMode == (int)VmGothicEnums.WalkMode.Swim) - // { - // - // } - // else if (_playerAi.WalkMode == (int)VmGothicEnums.WalkMode.Dive) - // { - // - // } - // else - // { - // base.HandleHorizontalMovement(); - // } - // } - // - // protected override void HandleVerticalMovement() - // { - // if (_playerAi.WalkMode == (int)VmGothicEnums.WalkMode.Swim) - // { - // - // } - // else if (_playerAi.WalkMode == (int)VmGothicEnums.WalkMode.Dive) - // { - // - // } - // else - // { - // base.HandleVerticalMovement(); - // } - // } - } -} -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerInputs.cs b/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerInputs.cs deleted file mode 100644 index ef0d43864..000000000 --- a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerInputs.cs +++ /dev/null @@ -1,134 +0,0 @@ -#if GOTHIC_HVR_INSTALLED -using HurricaneVR.Framework.ControllerInput; -using HurricaneVR.Framework.Shared; -using MyBox; -using UnityEngine.InputSystem; - -namespace Gothic.VR.Adapters.HVROverrides -{ - public class VRPlayerInputs : HVRPlayerInputs - { - [Separator("Gothic - Settings")] - public bool IsMenuActivated; - public HVRButtonState MenuState; - public bool IsMenuButtonEnabled = true; - - // Just Pressed - public HVRButtonState BothGripsActivatedState; - public bool IsBothGripsActivated; - - // Pressed - public bool IsBothGripsActive; - public HVRButtonState BothGripsActiveState; - - - protected override void UpdateInput() - { - base.UpdateInput(); - - if (!UpdateInputs) - { - return; - } - - IsMenuActivated = GetMenuActivated(); - ResetState(ref MenuState); - SetState(ref MenuState, IsMenuActivated); - - // Just Pressed - IsBothGripsActivated = GetBothGripsActivated(); - ResetState(ref BothGripsActivatedState); - SetState(ref BothGripsActivatedState, IsBothGripsActivated); - - - // Pressed - IsBothGripsActive = GetBothGripsActive(); - ResetState(ref BothGripsActiveState); - SetState(ref BothGripsActiveState, IsBothGripsActive); - } - - private bool GetMenuActivated() - { - if (!IsMenuButtonEnabled) - { - return false; - } - // If HVRSimulator is Active - if (UseWASD) - { - return Keyboard.current[Key.Escape].wasPressedThisFrame; - } - - return HVRController.GetButtonState(HVRHandSide.Left, HVRButtons.Secondary).JustActivated; - } - - private bool GetBothGripsActivated() - { - if (UseWASD) - { - return Keyboard.current[Key.T].wasPressedThisFrame; - } - else - { - var leftButtonState = HVRController.GetButtonState(HVRHandSide.Left, HVRButtons.Grip); - var rightButtonState = HVRController.GetButtonState(HVRHandSide.Right, HVRButtons.Grip); - - return leftButtonState.JustActivated && leftButtonState.Active || - rightButtonState.JustActivated && rightButtonState.Active; - } - } - - private bool GetBothGripsActive() - { - if (UseWASD) - { - return Keyboard.current[Key.T].isPressed; - } - else - { - return HVRController.GetButtonState(HVRHandSide.Left, HVRButtons.Grip).Active - && HVRController.GetButtonState(HVRHandSide.Right, HVRButtons.Grip).Active; - } - } - - protected override bool GetIsJumpActivated() - { - // If HVRSimulator is active - if (UseWASD) - { - return Keyboard.current[Key.Space].wasPressedThisFrame; - } - - return RightController.PrimaryButtonState.JustActivated; - } - - protected override bool GetCrouch() - { - // If HVRSimulator is active - if (UseWASD) - { - return Keyboard.current[Key.Z].wasPressedThisFrame || Keyboard.current[Key.X].wasPressedThisFrame; - } - else - { - return base.GetCrouch(); - } - } - - protected override bool GetSprinting() - { - // If HVRSimulator is active - if (UseWASD) - { - return Keyboard.current[Key.LeftShift].wasPressedThisFrame; - } - else - { - return base.GetSprinting(); - } - } - - } -} -#endif - diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRShoulderSocket.cs b/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRShoulderSocket.cs deleted file mode 100644 index d102d805f..000000000 --- a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRShoulderSocket.cs +++ /dev/null @@ -1,13 +0,0 @@ -using HurricaneVR.Framework.Core.Utils; - -namespace Gothic.VR.Adapters.HVROverrides -{ - /// - /// Overwritten only to ensure, that our use "parent" as "*(Loader)" element with VobContainer. - /// Class name is used for VRBackpack.OnBackpackReleasedFromShoulder() only. - /// - public class VRShoulderSocket : VRSocket - { - - } -} 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/Marvin/VRNpcMarvinAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Marvin/VRNpcMarvinAdapter.cs index 41644acdb..c277c5173 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Marvin/VRNpcMarvinAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Marvin/VRNpcMarvinAdapter.cs @@ -3,8 +3,8 @@ using Gothic.Core.Models.Container; using Gothic.Core.Services.Player; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; using Reflex.Attributes; using UnityEngine; using ZenKit.Daedalus; @@ -17,13 +17,30 @@ public class VRNpcMarvinAdapter : MonoBehaviour [Inject] private PlayerService _playerService; private NpcContainer _npcData; + private VrInteractable _interactable; private void Awake() { _npcData = GetComponentInParent().Npc.GetUserData(); } - public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + /// + /// Subscribed in Start (not Awake), so that VRNpc (dialog/loot) always handles a grab first. + /// + private void Start() + { + _interactable = VrInteractable.Find(this); + if (_interactable != null) + _interactable.Grabbed += OnGrabbed; + } + + private void OnDestroy() + { + if (_interactable != null) + _interactable.Grabbed -= OnGrabbed; + } + + private void OnGrabbed(VrGrabArgs args) { // Safety return, until we have proper Marvin feature handling implemented (active = true/false) return; diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/Debugging/VRHandVelocityDebugger.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/Debugging/VRHandVelocityDebugger.cs index dc6af8cb8..5da6befc7 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/Debugging/VRHandVelocityDebugger.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/Debugging/VRHandVelocityDebugger.cs @@ -1,15 +1,15 @@ -using System; -using Gothic.VR.Adapters.HVROverrides; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core.Player; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using Reflex.Attributes; using UnityEngine; namespace Gothic.VR.Adapters.Player.Debugging { public class VRHandVelocityDebugger : MonoBehaviour { - [SerializeField] private VRPlayerController _playerController; - [SerializeField] private VRPlayerInputs _playerInputs; + [Inject] private readonly IVrInput _vrInput; + [SerializeField] private GameObject _leftHandModel; [SerializeField] private GameObject _rightHandModel; [SerializeField] private Rigidbody _leftHandRigidbody; @@ -20,9 +20,12 @@ public class VRHandVelocityDebugger : MonoBehaviour private LineRenderer _lineRendererRight1; private LineRenderer _lineRendererRight2; private LineRenderer _lineRendererRight3; + private IVrRig _rig; private void Start() { + _rig = GetComponent(); + // Add a LineRenderer component _lineRendererLeft = _leftHandModel.AddComponent(); _lineRendererRight1 = _rightHandModel.AddComponent(); @@ -65,16 +68,16 @@ private void Start() private void Update() { var rightPosition = _rightHandModel.transform.position; - var rawVelocity = _playerInputs.RightController.Velocity; + var rawVelocity = _vrInput.GetControllerVelocity(VrHandSide.Right); _lineRendererRight1.SetPosition(0, rightPosition); _lineRendererRight1.SetPosition(1, rightPosition + rawVelocity * 10); _lineRendererRight2.SetPosition(0, rightPosition); - _lineRendererRight2.SetPosition(1, rightPosition + _playerController.transform.TransformDirection(rawVelocity) * 10); + _lineRendererRight2.SetPosition(1, rightPosition + _rig.Root.TransformDirection(rawVelocity) * 10); _lineRendererRight3.SetPosition(0, rightPosition); - _lineRendererRight3.SetPosition(1, rightPosition + _playerController.CameraRig.transform.TransformDirection(rawVelocity) * 10); + _lineRendererRight3.SetPosition(1, rightPosition + _rig.TrackingSpace.TransformDirection(rawVelocity) * 10); } } } diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs index fc5275e31..acec0ec87 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs @@ -1,8 +1,6 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections; using System.Collections.Generic; using System.Linq; -using Assets.HurricaneVR.Framework.Shared.Utilities; using Gothic.Core; using Gothic.Core.Adapters.Vob; using Gothic.Core.Manager; @@ -13,12 +11,10 @@ using Gothic.Core.Services.Vm; using Gothic.Core.Services.Vobs; using Gothic.Core.Services.World; -using Gothic.VR.Adapters.HVROverrides; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; -using HurricaneVR.Framework.Core.Sockets; -using HurricaneVR.Framework.Core.Utils; using Reflex.Attributes; using TMPro; using UnityEngine; @@ -26,12 +22,25 @@ namespace Gothic.VR.Adapters.Player { - [RequireComponent(typeof(HVRSocketable))] + /// + /// The player's backpack (inventory pages) and holsters. The backpack itself is a VrInteractable with an + /// IVrSocketContainer for its slots. Items put into holsters or slots are added to the hero's inventory. + /// public class VRBackpack : MonoBehaviour { [SerializeField] private TMP_Text _categoryText; [SerializeField] private TMP_Text _pagerText; - [SerializeField] private HVRSocketContainer _socketContainer; + + [Tooltip("Hip and shoulder holsters (IVrSocket). Items inside count as inventory.")] + [SerializeField] private GameObject[] _holsterSockets; + + [Tooltip("Backpack slots (IVrSocket) which add/remove items to/from the inventory when used.")] + [SerializeField] private GameObject[] _inventorySockets; + + private VrInteractable _interactable; + private IVrSocketContainer _socketContainer; + private readonly List _holsters = new(); + private readonly List _slots = new(); private bool _isZenKitBootstrapped; private int _currentPage = 1; @@ -49,30 +58,87 @@ public class VRBackpack : MonoBehaviour [Inject] private readonly VRWeaponService _vrWeaponService; + private void Awake() + { + _interactable = GetComponent(); + _socketContainer = GetComponent(); + CollectSockets(_holsterSockets, _holsters); + CollectSockets(_inventorySockets, _slots); + + _interactable.Grabbed += OnBackpackGrabbedToShoulder; + _interactable.Released += OnBackpackReleasedFromShoulder; + + foreach (var holster in _holsters) + { + holster.Grabbed += OnItemPutIntoHolster; + holster.Released += OnItemPutOutOfHolster; + } + + foreach (var slot in _slots) + { + slot.Grabbed += OnItemPutIntoBackpack; + slot.Released += OnItemPutOutOfBackpack; + } + } + private void Start() { GlobalEventDispatcher.ZenKitBootstrapped.AddListener(Init); } - private void Init() + private void OnDestroy() { - var socketable = GetComponent(); + if (_interactable != null) + { + _interactable.Grabbed -= OnBackpackGrabbedToShoulder; + _interactable.Released -= OnBackpackReleasedFromShoulder; + } - socketable.UnsocketedClip = _audioService.CreateAudioClip(_audioService.InvOpen.File); - socketable.SocketedClip = _audioService.CreateAudioClip(_audioService.InvClose.File); + foreach (var holster in _holsters) + { + holster.Grabbed -= OnItemPutIntoHolster; + holster.Released -= OnItemPutOutOfHolster; + } + + foreach (var slot in _slots) + { + slot.Grabbed -= OnItemPutIntoBackpack; + slot.Released -= OnItemPutOutOfBackpack; + } + } + + private static void CollectSockets(GameObject[] socketGos, List result) + { + if (socketGos == null) + return; + + foreach (var socketGo in socketGos) + { + if (socketGo != null && socketGo.TryGetComponent(out IVrSocket socket)) + result.Add(socket); + } + } + + private void Init() + { + _interactable.SetSocketSounds( + socketed: _audioService.CreateAudioClip(_audioService.InvClose.File), + unsocketed: _audioService.CreateAudioClip(_audioService.InvOpen.File)); _isZenKitBootstrapped = true; } - public void OnBackpackGrabbedToShoulder(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnBackpackGrabbedToShoulder(VrGrabArgs args) { // Nothing to do for now. // We could potentially remove the meshes inside Backpack or simply hide it from rendering later. } - - public void OnBackpackReleasedFromShoulder(HVRGrabberBase grabber, HVRGrabbable grabbable) + + private void OnBackpackReleasedFromShoulder(VrGrabArgs args) { - if (grabber is not VRShoulderSocket && grabber is not HVRShoulderSocket) + if (args.Kind != VrGrabberKind.Socket || args.GrabberGo == null) + return; + if (!args.GrabberGo.TryGetComponent(out IVrSocket socket) || !socket.IsShoulder) return; UpdateInventoryView(); @@ -82,21 +148,21 @@ public void OnBackpackReleasedFromShoulder(HVRGrabberBase grabber, HVRGrabbable /// When putting into holster, culling is already deactivated. /// We simply need to tell the game: add inventory amount. /// - public void OnItemPutIntoHolster(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnItemPutIntoHolster(VrGrabArgs args) { - var vobLoader = grabbable.GetComponentInParent(); + var vobLoader = args.Interactable.GetComponentInParent(); var vobContainer = vobLoader.Container; _playerService.AddItem(vobContainer.Vob.Name, Mathf.Max(1, vobContainer.VobAs().Amount)); } - public void OnItemPutIntoBackpack(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnItemPutIntoBackpack(VrGrabArgs args) { if (_tempIgnoreSocketing) return; - - var vobLoader = grabbable.GetComponentInParent(true); + + var vobLoader = args.Interactable.GetComponentInParent(true); var vobContainer = vobLoader.Container; _vobMeshCullingService.RemoveCullingEntry(vobContainer); @@ -111,9 +177,9 @@ public void OnItemPutIntoBackpack(HVRGrabberBase grabber, HVRGrabbable grabbable /// When putting out of holster, culling is already deactivated. /// We simply need to tell the game: substract inventory amount. /// - public void OnItemPutOutOfHolster(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnItemPutOutOfHolster(VrGrabArgs args) { - var vobLoader = grabbable.GetComponentInParent(); + var vobLoader = args.Interactable.GetComponentInParent(); if (vobLoader == null) return; var vobContainer = vobLoader.Container; @@ -121,12 +187,12 @@ public void OnItemPutOutOfHolster(HVRGrabberBase grabber, HVRGrabbable grabbable _playerService.RemoveItem(vobContainer.Vob.Name, Mathf.Max(1, vobContainer.VobAs().Amount)); } - public void OnItemPutOutOfBackpack(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnItemPutOutOfBackpack(VrGrabArgs args) { if (_tempIgnoreSocketing) return; - var vobLoader = grabbable.GetComponentInParent(); + var vobLoader = args.Interactable.GetComponentInParent(); var vobContainer = vobLoader.Container; _vobMeshCullingService.AddCullingEntry(vobContainer); @@ -234,15 +300,15 @@ private void ClearSockets() foreach (var socket in _socketContainer.Sockets) { // Nothing inside socket - if (!socket.IsGrabbing) + if (!socket.IsOccupied) continue; // Destroy VobLoader GO after releasing it from slot (proper event handling) - var heldRoot = socket.HeldObject.transform.parent.gameObject; + var heldRoot = socket.Held.transform.parent.gameObject; socket.ForceRelease(); heldRoot.SetActive(false); // Disable it, as it would be with scale 1 in front of our camera for 1 second. - // We need to wait until next frame to ensure HVR has removed the item from socket. - this.ExecuteNextUpdate(() => Destroy(heldRoot)); + // We need to wait until next frame to ensure the socket has removed the item. + StartCoroutine(DestroyNextFrame(heldRoot)); } } @@ -263,10 +329,16 @@ private void RefillSockets(List inventory) }); vobContainer.Go.GetComponentInChildren().isKinematic = false; // Get rid of isKinematic warnings as the Grab is done "physically". - _socketContainer.TryAddGrabbable(vobContainer.Go.GetComponentInChildren()); + _socketContainer.TryAdd(vobContainer.Go.GetComponentInChildren()); } } + private static IEnumerator DestroyNextFrame(GameObject go) + { + yield return null; + Destroy(go); + } + private void SubtractItemFromHand(List inventory, GameObject handItem) { if (handItem == null) @@ -295,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 new file mode 100644 index 000000000..53cae9242 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs @@ -0,0 +1,102 @@ +using Gothic.Core.Adapters.UI.Menus; +using Gothic.Core.Const; +using Gothic.Core.Services; +using Gothic.VR.Adapters.UI; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using Reflex.Attributes; +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.SceneManagement; + +namespace Gothic.VR.Adapters.Player +{ + /// + /// Gothic side of the VR player prefab, next to the backend's IVrRig. Opens the in-game menu and provides the + /// Gothic-specific inputs derived from IVrInput. + /// + public class VRPlayer : MonoBehaviour + { + [Inject] private readonly IVrInput _vrInput; + [Inject] private readonly GameStateService _gameStateService; + + [Tooltip("In-game menu (skills, notepad, ...). Toggled with the menu button in game scenes.")] + public MenuHandler MenuHandler; + + [Tooltip("Plays videos in front of the player.")] + public VRCinema Cinema; + + [Tooltip("Step height while in water. 1m means walking out of water in Xardas' old tower in G1.")] + public float SwimDiveStepHeight = 1f; + + [Tooltip("Disabled during dialogs, videos, ...")] + public bool IsMenuButtonEnabled = true; + + /// + /// The menu button was pressed this frame (and isn't disabled). + /// + public bool IsMenuActivated + { + get + { + if (!IsMenuButtonEnabled) + return false; + + if (_vrInput.IsSimulator) + return Keyboard.current[Key.Escape].wasPressedThisFrame; + + return _vrInput.GetButton(VrHandSide.Left, VrButton.Secondary).IsJustActivated; + } + } + + /// + /// Both grips are held. + /// + public bool IsBothGripsActive + { + get + { + if (_vrInput.IsSimulator) + return Keyboard.current[Key.T].isPressed; + + return _vrInput.GetButton(VrHandSide.Left, VrButton.Grip).IsActive + && _vrInput.GetButton(VrHandSide.Right, VrButton.Grip).IsActive; + } + } + + private void Start() + { + // Enabled later via button press or other events + MenuHandler?.gameObject.SetActive(false); + } + + private void Update() + { + if (IsMenuActivated && IsGameScene() && (Cinema == null || !Cinema.IsBlockingInput)) + { + _gameStateService.InGameAndAlive = true; + MenuHandler.ToggleVisibility(); + } + } + + /// + /// Game scenes are all the ones where we play. Aka !=MainMenu, !=Loadings, !=Logo videos, ... + /// + private bool IsGameScene() + { + var activeSceneName = SceneManager.GetActiveScene().name; + + return activeSceneName switch + { + Constants.SceneBootstrap => false, + Constants.ScenePlayer => false, + Constants.SceneGameVersion => false, + Constants.ScenePreCaching => false, + Constants.SceneLogo => false, + Constants.SceneMainMenu => false, + Constants.SceneLoading => false, + _ => true + }; + } + } +} diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs.meta b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs.meta new file mode 100644 index 000000000..f4cc091f9 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ae71b0be15a534849b5249a3e671a43f \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs index 856c3113a..9e50444b2 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs @@ -1,21 +1,41 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Manager; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; using UnityEngine; namespace Gothic.VR.Adapters.Player { + /// + /// Sits on the player rig and listens to the hand and distance grabbers of both hands. + /// public class VRPlayerItemAdapter : MonoBehaviour { [Inject] private readonly MarvinService _marvinService; + private IVrRig _rig; + + + private void Awake() + { + _rig = GetComponent(); + foreach (var grabber in _rig.HandGrabbers) + grabber.BeforeGrabbed += OnBeforeGrabbed; + } + + private void OnDestroy() + { + if (_rig == null) + return; + + foreach (var grabber in _rig.HandGrabbers) + grabber.BeforeGrabbed -= OnBeforeGrabbed; + } /// /// We need to set isKinematic=false in BeforeGrabbed, otherwise we get a warning at OnGrabbed event time afterward. /// - public void OnBeforeGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnBeforeGrabbed(VrGrabArgs args) { // Ignore grabbing once, if MarvinSelectionMode is active. if (_marvinService.IsMarvinSelectionMode) @@ -23,11 +43,11 @@ public void OnBeforeGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) // OnGrabbed is normally called multiple times. Even after an object is already socketed. If so, then let's stop Grab behaviour. // If we sock an object on our hips or backpack etc. - if (grabber is HVRSocket) + if (args.Kind == VrGrabberKind.Socket || args.Interactable == null) return; // In Gothic, Items have no physics when lying around. We need to activate physics for HVR to properly move items into our hands. - if (grabbable.TryGetComponent(out var rb)) + if (args.Interactable.TryGetComponent(out var rb)) { rb.isKinematic = false; } @@ -35,4 +55,3 @@ public void OnBeforeGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs index 4bb3622e3..c210ea7ca 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayerWeaponInteraction.cs @@ -1,14 +1,13 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core.Adapters.Vob; using Gothic.Core.Extensions; using Gothic.Core.Models.Marvin; using Gothic.Core.Models.Vm; using Gothic.Core.Services; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Models.Vob; using Gothic.VR.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; using Reflex.Attributes; using UnityEngine; using ZenKit.Vobs; @@ -40,10 +39,38 @@ public class VRPlayerWeaponInteraction : MonoBehaviour, IMarvinPropertyCollector [SerializeField] private float _velocityCheckDuration = 0.5f; [SerializeField] private int _velocitySampleCount = 5; + private IVrRig _rig; - public void OnGrabbed(HVRGrabberBase hand, HVRGrabbable item) + + private void Awake() + { + _rig = GetComponent(); + foreach (var grabber in _rig.HandGrabbers) + { + // Melee weapons are handled once they're in a hand, not while being pulled by distance. + if (grabber.Kind != VrGrabberKind.Hand) + continue; + + grabber.Grabbed += OnGrabbed; + grabber.Released += OnReleased; + } + } + + private void OnDestroy() + { + if (_rig == null) + return; + + foreach (var grabber in _rig.HandGrabbers) + { + grabber.Grabbed -= OnGrabbed; + grabber.Released -= OnReleased; + } + } + + private void OnGrabbed(VrGrabArgs args) { - var vobItem = item.GetComponentInParent(); + var vobItem = args.Interactable != null ? args.Interactable.GetComponentInParent() : null; var vobContainer = vobItem?.Container; // We grab something not handled as VobItem. @@ -56,13 +83,13 @@ public void OnGrabbed(HVRGrabberBase hand, HVRGrabbable item) if (itemInstance!.MainFlag != (int)VmGothicEnums.ItemFlags.ItemKatNf) return; - _weaponService.OnGrabbed(((HVRHandGrabber)hand).HandSide, vobContainer, GetWeaponPhysicsConfig()); + _weaponService.OnGrabbed(args.HandSide, vobContainer, GetWeaponPhysicsConfig()); SyncEquippedWeaponToHero(itemInstance, equip: true); } - public void OnReleased(HVRGrabberBase hand, HVRGrabbable item) + private void OnReleased(VrGrabArgs args) { - var vobItem = item.GetComponentInParent(); + var vobItem = args.Interactable != null ? args.Interactable.GetComponentInParent() : null; var vobContainer = vobItem?.Container; // We grab something not handled as VobItem. @@ -75,7 +102,7 @@ public void OnReleased(HVRGrabberBase hand, HVRGrabbable item) if (itemInstance!.MainFlag != (int)VmGothicEnums.ItemFlags.ItemKatNf) return; - _weaponService.OnReleased(((HVRHandGrabber)hand).HandSide, GetWeaponPhysicsConfig()); + _weaponService.OnReleased(args.HandSide, GetWeaponPhysicsConfig()); SyncEquippedWeaponToHero(itemInstance, equip: false); } @@ -207,4 +234,3 @@ public IEnumerable CollectMarvinInspectorProperties() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs index 7d2da9bb7..05ab02965 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs @@ -1,14 +1,13 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections; using System.Collections.Generic; using System.Linq; using Gothic.Core.Services.Context; using Gothic.Core; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; -using HurricaneVR.Framework.Core.Player; -using HurricaneVR.Framework.Core.Utils; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using Gothic.VR.Services.Context; using Reflex.Attributes; using UnityEngine; @@ -25,10 +24,10 @@ public class VRSeat : MonoBehaviour // Fade components [Header("Vignette Settings")] - [SerializeField] private HVRCanvasFade _canvasFade; [SerializeField] private float _fadeSpeed = 6f; + private IVrRig _rig; private bool _isPlayerSeated; //when NPC sits down this should be changed to true and when NPC stands up change it back to false @@ -38,10 +37,23 @@ public class VRSeat : MonoBehaviour private Transform _currentSnapPoint; private bool _canPlayerSit = true; + private VrInteractable _interactable; + + private void Awake() + { + _interactable = VrInteractable.Find(this); + _interactable.Grabbed += OnGrabbed; + } + + private void OnDestroy() + { + if (_interactable != null) + _interactable.Grabbed -= OnGrabbed; + } private void GetSnapPoints() { - var zsPosParent = transform.FindChildRecursive("ZS_POS0").parent; + var zsPosParent = gameObject.FindChildRecursively("ZS_POS0").transform.parent; //find children that contain "ZS_POS" in object name and add to list of snap points for (var i = 0; i < zsPosParent.childCount; i++) { @@ -54,7 +66,7 @@ private void GetSnapPoints() } } - public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnGrabbed(VrGrabArgs args) { if (_snapPoints.IsEmpty()) { @@ -71,7 +83,7 @@ public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) GameObject player = _contextInteractionService.GetCurrentPlayerController(); - _canvasFade = player.FindChildRecursively("GlobalCameraFade").GetComponent(); + _rig = _contextInteractionService.GetImpl().Rig; //handle sitting/standing _isPlayerSeated = !_isPlayerSeated; @@ -98,31 +110,31 @@ private IEnumerator SitDown(GameObject player) _currentSnapPoint = GetNearestSnapPoint(player.transform.position); // Fade in - _canvasFade.Fade(1f, _fadeSpeed); - yield return new WaitUntil(() => _canvasFade.CurrentFade >= 1f); + _rig.Fade(1f, _fadeSpeed); + yield return new WaitUntil(() => _rig.FadeAlpha >= 1f); // Move player player.transform.position = _currentSnapPoint.position + _currentSnapPoint.TransformDirection(_posOffset); player.transform.eulerAngles = _currentSnapPoint.eulerAngles + _eulerOffset; // Fade out - _canvasFade.Fade(0f, _fadeSpeed); - yield return new WaitUntil(() => _canvasFade.CurrentFade <= 0f); + _rig.Fade(0f, _fadeSpeed); + yield return new WaitUntil(() => _rig.FadeAlpha <= 0f); } private IEnumerator StandUp(GameObject player) { // Fade in - _canvasFade.Fade(1f, _fadeSpeed); - yield return new WaitUntil(() => _canvasFade.CurrentFade >= 1f); + _rig.Fade(1f, _fadeSpeed); + yield return new WaitUntil(() => _rig.FadeAlpha >= 1f); // Move player player.transform.position += player.transform.TransformDirection(new Vector3(0, 0.5f, 1f)); _contextInteractionService.UnlockPlayer(); // Fade out - _canvasFade.Fade(0f, _fadeSpeed); - yield return new WaitUntil(() => _canvasFade.CurrentFade <= 0f); + _rig.Fade(0f, _fadeSpeed); + yield return new WaitUntil(() => _rig.FadeAlpha <= 0f); } private Transform GetNearestSnapPoint(Vector3 pos) @@ -134,4 +146,3 @@ private Transform GetNearestSnapPoint(Vector3 pos) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs index e597a9fc1..74098b5a4 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs @@ -1,11 +1,10 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core; using Gothic.Core.Logging; using Gothic.Core.Models.Config; using Gothic.Core.Services.Config; using Gothic.Core.Services.Context; -using Gothic.VR.Adapters.HVROverrides; +using Gothic.VR.Services.Context; using Reflex.Attributes; using UnityEngine; using Logger = Gothic.Core.Logging.Logger; @@ -67,8 +66,7 @@ private void Start() /// private void GothicStart() { - var playerController = _contextInteractionService.GetCurrentPlayerController().GetComponent(); - playerController.Teleporter.PositionUpdate.AddListener(SetTeleportPosition); + _contextInteractionService.GetImpl().Rig.Teleported += SetTeleportPosition; SetSmoothness(); SetRenderDistance(_configService.Gothic.IniVisualRange); @@ -148,4 +146,3 @@ private void SetRenderDistance(int value) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs index ba33732ad..ecf61c136 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections; using System.Collections.Generic; @@ -16,9 +15,9 @@ using Gothic.Core.Services.Context; using Gothic.Core.Services.Meshes; using Gothic.Core.Services.Player; -using Gothic.VR.Adapters.HVROverrides; using Gothic.Core.Services.Vm; -using HurricaneVR.Framework.Core.Utils; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; using UnityEngine; using ZenKit.Daedalus; @@ -27,11 +26,10 @@ namespace Gothic.VR.Adapters.Player { - [RequireComponent(typeof(VRPlayerController), typeof(VRPlayerInputs))] + [RequireComponent(typeof(VRPlayer))] public class VRSwimDive : MonoBehaviour, IMarvinPropertyCollector { - [SerializeField] private VRPlayerController _playerController; - [SerializeField] private VRPlayerInputs _playerInputs; + private IVrRig _rig; private INpc _playerVob; private IAiHuman _playerAi; @@ -89,6 +87,13 @@ public class VRSwimDive : MonoBehaviour, IMarvinPropertyCollector [Inject] private readonly MeshService _meshService; [Inject] private readonly PlayerService _playerService; [Inject] private readonly ContextGameVersionService _contextGameVersionService; + [Inject] private readonly IVrInput _vrInput; + [Inject] private readonly IVrSfxPlayer _vrSfxPlayer; + + private void Awake() + { + _rig = GetComponent(); + } private void Start() { @@ -157,10 +162,10 @@ SfxModel FindSwimSfx(string animName) _playerAi = (IAiHuman)_playerVob.Ai; }); - _initialGravity = _playerController.Gravity; - _initialMoveSpeed = _playerController.MoveSpeed; - _initialRunSpeed = _playerController.RunSpeed; - _initialFallSpeed = _playerController.MaxFallSpeed; + _initialGravity = _rig.Gravity; + _initialMoveSpeed = _rig.MoveSpeed; + _initialRunSpeed = _rig.RunSpeed; + _initialFallSpeed = _rig.MaxFallSpeed; } private void Update() @@ -220,9 +225,9 @@ private void OnValidate() { _debugStartDive = false; - if (_mode == VmGothicEnums.WalkMode.Swim) + if (_mode == VmGothicEnums.WalkMode.Swim && _rig != null) { - _playerController.CharacterController.Move(Vector3.down * 5); + _rig.CharacterController.Move(Vector3.down * 5); StartDive(); } } @@ -240,23 +245,23 @@ private void ChangeWaterBehavior() switch ((ZenGineConst.WaterLevel)_playerAi.WaterLevel) { case ZenGineConst.WaterLevel.Normal: - _playerController.Gravity = _initialGravity; - _playerController.MoveSpeed = _initialMoveSpeed; - _playerController.RunSpeed = _initialRunSpeed; - _playerController.CanSprint = true; - _playerController.MaxFallSpeed = _initialFallSpeed; + _rig.Gravity = _initialGravity; + _rig.MoveSpeed = _initialMoveSpeed; + _rig.RunSpeed = _initialRunSpeed; + _rig.CanSprint = true; + _rig.MaxFallSpeed = _initialFallSpeed; - _playerController.SetWalkingControls(); + _contextInteractionService.SetWalkingControls(); break; case ZenGineConst.WaterLevel.Knee: // Dive -> Swim (sometimes when pulling hard up, we are briefly knee deep and need to call the sound in here once) if (_mode == VmGothicEnums.WalkMode.Dive) { _playerService.StopDiving(); - _playerController.ScreenFader.Fade(0, float.MaxValue); // Immediately fade the screen back to normal (no fade) + _rig.Fade(0, float.MaxValue); // Immediately fade the screen back to normal (no fade) var clip = _audioService.CreateAudioClip(_sfxSwim2HangSound.GetRandomSound()); - SFXPlayer.Instance.PlaySFX(clip, Camera.main!.transform.position); + _vrSfxPlayer.Play(clip, Camera.main!.transform.position); // FIXME - Bubbles are too big on screen. Needs more love. // _diveBubbles.SetActive(false); @@ -266,23 +271,23 @@ private void ChangeWaterBehavior() _mode = VmGothicEnums.WalkMode.Walk; Shader.SetGlobalInt(Constants.ShaderPropertyWaterEffectToggle, 0); - _playerController.Gravity = _initialGravity; - _playerController.MoveSpeed = _initialMoveSpeed / 2; - _playerController.RunSpeed = _initialMoveSpeed / 2; // No running, but it might be, that we run into deep water, then we need to slow it down like walking. - _playerController.CanSprint = false; - _playerController.MaxFallSpeed = _initialFallSpeed; + _rig.Gravity = _initialGravity; + _rig.MoveSpeed = _initialMoveSpeed / 2; + _rig.RunSpeed = _initialMoveSpeed / 2; // No running, but it might be, that we run into deep water, then we need to slow it down like walking. + _rig.CanSprint = false; + _rig.MaxFallSpeed = _initialFallSpeed; - _playerController.SetWaterWalkingControls(); + _contextInteractionService.SetWaterWalkingControls(); break; case ZenGineConst.WaterLevel.Chest: // Dive -> Swim if (_mode == VmGothicEnums.WalkMode.Dive) { _playerService.StopDiving(); - _playerController.ScreenFader.Fade(0, float.MaxValue); // Immediately fade the screen back to normal (no fade) + _rig.Fade(0, float.MaxValue); // Immediately fade the screen back to normal (no fade) var clip = _audioService.CreateAudioClip(_sfxSwim2HangSound.GetRandomSound()); - SFXPlayer.Instance.PlaySFX(clip, Camera.main!.transform.position); + _vrSfxPlayer.Play(clip, Camera.main!.transform.position); // FIXME - Bubbles are too big on screen. Needs more love. // _diveBubbles.SetActive(false); @@ -290,10 +295,10 @@ private void ChangeWaterBehavior() Shader.SetGlobalInt(Constants.ShaderPropertyWaterEffectToggle, 0); _mode = VmGothicEnums.WalkMode.Swim; - _playerController.Gravity = 0f; - _playerController.MaxFallSpeed = 0f; + _rig.Gravity = 0f; + _rig.MaxFallSpeed = 0f; - _playerController.SetSwimmingControls(); + _contextInteractionService.SetSwimmingControls(); if (_waterBobbingCoroutine == null) _waterBobbingCoroutine = StartCoroutine(WaterBobbing()); @@ -310,7 +315,7 @@ private IEnumerator WaterBobbing() { time += Time.deltaTime; var offset = Mathf.Sin(time * _waterBobFrequency) * _waterBobAmplitude; - _playerController.CharacterController.Move(Vector3.down * offset); + _rig.CharacterController.Move(Vector3.down * offset); yield return null; } } @@ -324,15 +329,15 @@ private void StartDive() // (After "forcing" diving by moving hands down.) _currentVelocity = Vector3.zero; - _playerController.Gravity = 0; - _playerController.MaxFallSpeed = 0; + _rig.Gravity = 0; + _rig.MaxFallSpeed = 0; - _playerController.SetDivingControls(); + _contextInteractionService.SetDivingControls(); _playerService.StartDiving(); - _playerController.ScreenFader.Fade(0.8f, 1/_playerService.CurrentAir); // We fade to black based on our start level of air (in seconds) + _rig.Fade(0.8f, 1/_playerService.CurrentAir); // We fade to black based on our start level of air (in seconds) - SFXPlayer.Instance.PlaySFX(_audioService.CreateAudioClip(_sfxSwim2DiveSound.GetRandomSound()), Camera.main!.transform.position); + _vrSfxPlayer.Play(_audioService.CreateAudioClip(_sfxSwim2DiveSound.GetRandomSound()), Camera.main!.transform.position); // FIXME - Bubbles are too big on screen. Needs more love. // _diveBubbles.SetActive(true); @@ -349,7 +354,7 @@ private void StartDive() /// /// Test 2. Translation with PlayerController (where Thumbstick rotation is applied) /// var combinedVelocity = (leftHandVelocity + rightHandVelocity) * _swimHandMovementMultiplier; - /// var rotatedVelocity = _playerController.transform.TransformDirection(combinedVelocity); + /// var rotatedVelocity = _rig.Root.TransformDirection(combinedVelocity); /// _currentVelocity = Vector3.Lerp(_currentVelocity, -rotatedVelocity, Time.deltaTime); /// /// [🛑] Moving physical head @@ -370,7 +375,7 @@ private void StartDive() /// [🛑] Rigidbody velocity is only tracked at FixedUpdate(). Which makes the movement wonky and I couldn't figure out how to apply multiplier right. /// /// Test 5. Using CameraRig as TransformDirection - /// var rotatedVelocity = _playerController.CameraRig.transform.TransformDirection(combinedVelocity); + /// var rotatedVelocity = _rig.TrackingSpace.TransformDirection(combinedVelocity); /// Why? Something like: The two rotations are applied like this in HVR Player: /// PlayerController - real and synthetic rotation /// - CameraRig - inverse real rotation @@ -381,30 +386,33 @@ private void StartDive() /// private void HandleSwim() { - if (_playerInputs.IsLeftGrabActivated) + var leftGrip = _vrInput.GetButton(VrHandSide.Left, VrButton.Grip); + var rightGrip = _vrInput.GetButton(VrHandSide.Right, VrButton.Grip); + + if (leftGrip.IsJustActivated) _isSwimDiveForceLeftJustStarted = true; - if (_playerInputs.IsRightGrabActivated) + if (rightGrip.IsJustActivated) _isSwimDiveForceRightJustStarted = true; // Use force to pull yourself (per hand). Only include hands whose Grip is currently held. - if (_playerInputs.IsLeftGripHoldActive || _playerInputs.IsRightGripHoldActive) + if (leftGrip.IsActive || rightGrip.IsActive) { var desiredLocalVelocity = Vector3.zero; - if (_playerInputs.IsLeftGripHoldActive) + if (leftGrip.IsActive) { - if (IsHandBelowWater(_playerController.LeftControllerTransform)) + if (IsHandBelowWater(_rig.LeftHand)) { - var leftHandVelocity = _playerInputs.LeftController.Velocity; + var leftHandVelocity = _vrInput.GetControllerVelocity(VrHandSide.Left); desiredLocalVelocity += leftHandVelocity; } } - if (_playerInputs.IsRightGripHoldActive) + if (rightGrip.IsActive) { - if (IsHandBelowWater(_playerController.RightControllerTransform)) + if (IsHandBelowWater(_rig.RightHand)) { - var rightHandVelocity = _playerInputs.RightController.Velocity; + var rightHandVelocity = _vrInput.GetControllerVelocity(VrHandSide.Right); desiredLocalVelocity += rightHandVelocity; } } @@ -412,7 +420,7 @@ private void HandleSwim() desiredLocalVelocity *= _swimHandMovementMultiplier; // Transform velocity to world space based on player rotation - var rotatedVelocity = _playerController.CameraRig.transform.TransformDirection(desiredLocalVelocity); + var rotatedVelocity = _rig.TrackingSpace.TransformDirection(desiredLocalVelocity); // Apply opposite force for swimming - Only horizontal! _currentVelocity = Vector3.Lerp(_currentVelocity, -rotatedVelocity, Time.deltaTime); @@ -429,19 +437,19 @@ private void HandleSwim() if (_isSwimDiveForceLeftJustStarted && _currentVelocity.magnitude > 1f) { var clip = _audioService.CreateAudioClip(_sfxSwimSound.GetRandomSound())!; - SFXPlayer.Instance.PlaySFXCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, cooldownTime: clip.length); + _vrSfxPlayer.PlayWithCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, clip.length); _isSwimDiveForceLeftJustStarted = false; } if (_isSwimDiveForceRightJustStarted && _currentVelocity.magnitude > 1f) { var clip = _audioService.CreateAudioClip(_sfxSwimSound.GetRandomSound())!; - SFXPlayer.Instance.PlaySFXCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, cooldownTime: clip.length); + _vrSfxPlayer.PlayWithCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, clip.length); _isSwimDiveForceRightJustStarted = false; } // Move the character - Horizontal only var rotatedHorizontalVelocity = new Vector3(_currentVelocity.x, 0, _currentVelocity.z); - _playerController.CharacterController.Move(rotatedHorizontalVelocity * Time.deltaTime); + _rig.CharacterController.Move(rotatedHorizontalVelocity * Time.deltaTime); // We seek -y aka "down" if (_currentVelocity.y < _swimStartDiveVerticalVelocity) @@ -455,38 +463,41 @@ private bool IsHandBelowWater(Transform handTransform) RaycastHit hit; // Is there water above your hand? - return Physics.Raycast(handTransform.position, Vector3.up, out hit, _playerController.CameraHeight, + return Physics.Raycast(handTransform.position, Vector3.up, out hit, _rig.CameraHeight, 1 << Constants.WaterLayer); } private void HandleDive() { - if (_playerInputs.IsLeftGrabActivated) + var leftGrip = _vrInput.GetButton(VrHandSide.Left, VrButton.Grip); + var rightGrip = _vrInput.GetButton(VrHandSide.Right, VrButton.Grip); + + if (leftGrip.IsJustActivated) _isSwimDiveForceLeftJustStarted = true; - if (_playerInputs.IsRightGrabActivated) + if (rightGrip.IsJustActivated) _isSwimDiveForceRightJustStarted = true; // Use force to pull yourself (per hand). Only include hands whose Grip is currently held. - if (_playerInputs.IsLeftGripHoldActive || _playerInputs.IsRightGripHoldActive) + if (leftGrip.IsActive || rightGrip.IsActive) { var desiredLocalVelocity = Vector3.zero; - if (_playerInputs.IsLeftGripHoldActive) + if (leftGrip.IsActive) { - var leftHandVelocity = _playerInputs.LeftController.Velocity; + var leftHandVelocity = _vrInput.GetControllerVelocity(VrHandSide.Left); desiredLocalVelocity += leftHandVelocity; } - if (_playerInputs.IsRightGripHoldActive) + if (rightGrip.IsActive) { - var rightHandVelocity = _playerInputs.RightController.Velocity; + var rightHandVelocity = _vrInput.GetControllerVelocity(VrHandSide.Right); desiredLocalVelocity += rightHandVelocity; } desiredLocalVelocity *= _diveHandMovementMultiplier; // Transform velocity to world space based on player rotation - var rotatedVelocity = _playerController.CameraRig.transform.TransformDirection(desiredLocalVelocity); + var rotatedVelocity = _rig.TrackingSpace.TransformDirection(desiredLocalVelocity); // Apply opposite force for diving (full 3D movement) _currentVelocity = Vector3.Lerp(_currentVelocity, -rotatedVelocity, Time.deltaTime); @@ -503,18 +514,18 @@ private void HandleDive() if (_isSwimDiveForceLeftJustStarted && _currentVelocity.magnitude > 1f) { var clip = _audioService.CreateAudioClip(_sfxDiveSound.GetRandomSound())!; - SFXPlayer.Instance.PlaySFXCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, cooldownTime: clip.length); + _vrSfxPlayer.PlayWithCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, clip.length); _isSwimDiveForceLeftJustStarted = false; } if (_isSwimDiveForceRightJustStarted && _currentVelocity.magnitude > 1f) { var clip = _audioService.CreateAudioClip(_sfxDiveSound.GetRandomSound())!; - SFXPlayer.Instance.PlaySFXCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, cooldownTime: clip.length); + _vrSfxPlayer.PlayWithCooldown(clip, Camera.main!.transform.position, _swimDiveSfxUuid, clip.length); _isSwimDiveForceRightJustStarted = false; } // Move the character - _playerController.CharacterController.Move(_currentVelocity * Time.deltaTime); + _rig.CharacterController.Move(_currentVelocity * Time.deltaTime); } public IEnumerable CollectMarvinInspectorProperties() @@ -565,4 +576,3 @@ public IEnumerable CollectMarvinInspectorProperties() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs index 0a1f87bb7..6d906a8c2 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/SpeechToTextHandler.cs @@ -1,11 +1,10 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Logging; using Gothic.Core.Manager; using Gothic.Core.Services.Config; using Gothic.Core.Services.Context; using Gothic.Core.Services.Player; -using Gothic.VR.Adapters.HVROverrides; +using Gothic.VR.Adapters.Player; using Gothic.VR.Adapters.UI; using Gothic.VR.Services.Context; using Reflex.Attributes; @@ -32,7 +31,7 @@ public class SpeechToTextHandler : MonoBehaviour private const int _maxRecordingLength = 30; private const int _recordingSampleRate = 16000; - private VRPlayerInputs _playerInputs; + private VRPlayer _player; // Unity's Microphone API will always store output in an AudioClip. private AudioClip _recordedClip; @@ -63,7 +62,7 @@ private void Start() return; } - _playerInputs = _contextInteractionService.GetImpl().GetVRPlayerInputs(); + _player = _contextInteractionService.GetImpl().Player; _state = State.Idle; } @@ -79,9 +78,9 @@ private void Update() private void CheckRecordingState() { - if (_playerInputs.IsBothGripsActive && _state == State.Idle) + if (_player.IsBothGripsActive && _state == State.Idle) StartRecording(); - else if (!_playerInputs.IsBothGripsActive && _state == State.Recording) + else if (!_player.IsBothGripsActive && _state == State.Recording) StopAndProcessRecording(); } @@ -166,4 +165,3 @@ private void OnDestroy() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs index e4e592a1c..efe9bff70 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections.Generic; using System.Linq; @@ -91,4 +90,3 @@ public class MatchResult public float Score { get; set; } // 0-1, where 1 is perfect match } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs index eaed05a22..f7f2b2809 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsAccessibilityMenu.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core.Adapters.UI.Menus; @@ -42,4 +41,3 @@ protected override void ExecuteCommand(string itemName, string commandName) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs index 2d25a8b86..08e35f253 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/Settings/VRSettingsImmersionMenu.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core.Adapters.UI.Menus; @@ -42,4 +41,3 @@ protected override void ExecuteCommand(string itemName, string commandName) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs index 70e87eaef..05456a6c9 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Services.Meshes; using Gothic.Core.Services.Vm; using Gothic.Core; @@ -38,4 +37,3 @@ private void Start() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs index 9d140326f..8647dfafb 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using UnityEngine; namespace Gothic.VR.Adapters.UI @@ -30,4 +29,3 @@ private void Update() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs index 83d1dafca..44881378e 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs @@ -1,12 +1,11 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using Gothic.Core.Adapters.Video; using Gothic.Core.Const; using Gothic.Core.Logging; -using Gothic.VR.Adapters.HVROverrides; -using HurricaneVR.Framework.ControllerInput; -using HurricaneVR.Framework.Shared; +using Gothic.VR.Adapters.Player; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using UnityEngine; using UnityEngine.InputSystem; using Logger = Gothic.Core.Logging.Logger; @@ -52,7 +51,9 @@ public class VRCinema : MonoBehaviour private Color _savedBackground; private float _savedTimeScale = 1f; - private VRPlayerController _playerController; + private VRPlayer _player; + private IVrRig _rig; + private IVrInput _vrInput; private bool _savedMovementEnabled; private bool _savedRotationEnabled; private bool _savedCanCrouch; @@ -171,16 +172,17 @@ private void Update() } } - private static bool IsSkipPressed() + private bool IsSkipPressed() { var keyboard = Keyboard.current; if (keyboard != null && (keyboard.spaceKey.wasPressedThisFrame || keyboard.escapeKey.wasPressedThisFrame)) return true; - foreach (var side in new[] { HVRHandSide.Left, HVRHandSide.Right }) + _vrInput ??= ReflexProjectInstaller.DIContainer.Resolve(); + foreach (var side in new[] { VrHandSide.Left, VrHandSide.Right }) { - if (HVRController.GetButtonState(side, HVRButtons.Trigger).JustActivated || - HVRController.GetButtonState(side, HVRButtons.Primary).JustActivated) + if (_vrInput.GetButton(side, VrButton.Trigger).IsJustActivated || + _vrInput.GetButton(side, VrButton.Primary).IsJustActivated) return true; } @@ -235,38 +237,40 @@ private void RestoreCamera() private void LockPlayer() { // The cinema is inactive until the first video - no Awake to cache it in before. - if (_playerController == null) - _playerController = GetComponentInParent(true); - if (_playerController == null) + if (_player == null) + { + _player = GetComponentInParent(true); + _rig = _player == null ? null : _player.GetComponent(); + } + if (_player == null || _rig == null) return; - _savedMovementEnabled = _playerController.MovementEnabled; - _savedRotationEnabled = _playerController.RotationEnabled; - _savedCanCrouch = _playerController.CanCrouch; - _savedCanJump = _playerController.CanJump; - _savedTeleporterEnabled = _playerController.Teleporter.enabled; - _savedMenuButtonEnabled = _playerController.VrInputs.IsMenuButtonEnabled; - - _playerController.MovementEnabled = false; - _playerController.RotationEnabled = false; - _playerController.CanCrouch = false; - _playerController.CanJump = false; - _playerController.Teleporter.enabled = false; - _playerController.VrInputs.IsMenuButtonEnabled = false; + _savedMovementEnabled = _rig.MovementEnabled; + _savedRotationEnabled = _rig.TurnEnabled; + _savedCanCrouch = _rig.CanCrouch; + _savedCanJump = _rig.CanJump; + _savedTeleporterEnabled = _rig.TeleportEnabled; + _savedMenuButtonEnabled = _player.IsMenuButtonEnabled; + + _rig.MovementEnabled = false; + _rig.TurnEnabled = false; + _rig.CanCrouch = false; + _rig.CanJump = false; + _rig.TeleportEnabled = false; + _player.IsMenuButtonEnabled = false; } private void UnlockPlayer() { - if (_playerController == null) + if (_player == null || _rig == null) return; - _playerController.MovementEnabled = _savedMovementEnabled; - _playerController.RotationEnabled = _savedRotationEnabled; - _playerController.CanCrouch = _savedCanCrouch; - _playerController.CanJump = _savedCanJump; - _playerController.Teleporter.enabled = _savedTeleporterEnabled; - _playerController.VrInputs.IsMenuButtonEnabled = _savedMenuButtonEnabled; + _rig.MovementEnabled = _savedMovementEnabled; + _rig.TurnEnabled = _savedRotationEnabled; + _rig.CanCrouch = _savedCanCrouch; + _rig.CanJump = _savedCanJump; + _rig.TeleportEnabled = _savedTeleporterEnabled; + _player.IsMenuButtonEnabled = _savedMenuButtonEnabled; } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs index ec2aaaaa3..df921e7e8 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRDialog.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -194,4 +193,3 @@ private void OnDialogClicked(NpcInstance instance, int informationId) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs index 0c17dedab..fd04440cb 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRFollowCamera.cs @@ -1,6 +1,5 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Services.Context; -using Gothic.VR.Adapters.HVROverrides; +using Gothic.VR.Services.Context; using Reflex.Attributes; using UnityEngine; @@ -115,13 +114,12 @@ private bool TryResolveCamera() if (_cameraTransform != null) return true; - var playerController = _contextInteractionService?.GetCurrentPlayerController(); - if (playerController == null) + var rig = _contextInteractionService?.GetImpl().Rig; + if (rig == null) return false; - _cameraTransform = playerController.GetComponent().Camera; + _cameraTransform = rig.Head; return _cameraTransform != null; } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs index 8e1586746..d16667f46 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPlaceInFrontOfCamera.cs @@ -1,6 +1,5 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Services.Context; -using Gothic.VR.Adapters.HVROverrides; +using Gothic.VR.Services.Context; using Reflex.Attributes; using UnityEngine; @@ -73,13 +72,12 @@ private bool TryResolveCamera() if (_cameraTransform != null) return true; - var playerController = _contextInteractionService?.GetCurrentPlayerController(); - if (playerController == null) + var rig = _contextInteractionService?.GetImpl().Rig; + if (rig == null) return false; - _cameraTransform = playerController.GetComponent().Camera; + _cameraTransform = rig.Head; return _cameraTransform != null; } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs index cd967f194..204d4669b 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRPrintScreen.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using Gothic.Core.Adapters.UI; @@ -126,4 +125,3 @@ private void HideExpiredMessages() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs index 744fa7f4c..dd73c2ecf 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRSubtitles.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Npc; +using Gothic.Core.Adapters.Npc; using Gothic.Core.Services.Config; using Gothic.Core.Services.UI; using Gothic.Core; @@ -76,4 +75,3 @@ public void ScheduleHide(float delay) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs index d0294810a..9901f9805 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VRUiOnTop.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using TMPro; @@ -265,4 +264,3 @@ private static Material CreateCopy(Material onTopAsset, int renderQueue, Materia } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/UI/VirtualKeyboard.cs b/Assets/Gothic-VR/Scripts/Adapters/UI/VirtualKeyboard.cs index b91b16d77..68939db1d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/UI/VirtualKeyboard.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/UI/VirtualKeyboard.cs @@ -5,10 +5,8 @@ using Gothic.Core.Logging; using Gothic.Core.Models.Caches; using Gothic.Core.Services.Caches; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Models.UI; -#if GOTHIC_HVR_INSTALLED -using HurricaneVR.Framework.Core.UI; -#endif using TMPro; using UnityEngine; using UnityEngine.UI; @@ -150,11 +148,8 @@ private void Init(VirtualKeyboardOptions options) LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)transform); RefreshDisplay(); -#if GOTHIC_HVR_INSTALLED - // A canvas created at runtime: the UI laser only hits canvases HVRInputModule knows. - if (HVRInputModule.Instance != null) - HVRInputModule.Instance.AddCanvas(GetComponent()); -#endif + // A canvas created at runtime: the UI laser only hits registered canvases. + ReflexProjectInstaller.DIContainer.Resolve().RegisterCanvas(GetComponent()); Logger.Log("[VirtualKeyboard] Shown", LogCat.Ui); } @@ -367,10 +362,7 @@ public void Close() return; _isClosed = true; -#if GOTHIC_HVR_INSTALLED - if (HVRInputModule.Instance != null) - HVRInputModule.Instance.RemoveCanvas(GetComponent()); -#endif + ReflexProjectInstaller.DIContainer.Resolve().UnregisterCanvas(GetComponent()); if (_current == this) _current = null; _onSubmit = null; diff --git a/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs b/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs index 328c2aac3..fe981c37e 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/VRFocus.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Adapters.Npc; using Gothic.Core.Adapters.Vob; using Gothic.Core.Const; @@ -8,8 +7,8 @@ using Gothic.Core.Extensions; using Gothic.Core.Manager; using Gothic.Core.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; using Reflex.Attributes; using TMPro; using UnityEngine; @@ -18,7 +17,8 @@ namespace Gothic.VR.Adapters { /// /// Handles focus brightness and name visibility for VOBs and NPCs. - /// We leverage HVRGrabbable's events to show canvas of object name and alter brightness on all objects' mesh renderers. + /// We leverage VrInteractable's events to show canvas of object name and alter brightness on all objects' + /// mesh renderers. /// /// Order of use is always: /// 1. HoverEnter -> We hover from far or near (e.g. grab distance without pulling towards us) @@ -40,11 +40,16 @@ public class VRFocus : MonoBehaviour private bool _isHovered; private Renderer _cachedObjectRenderer; private bool _isNpc; + private VrInteractable _interactable; private void Awake() { _isNpc = GetComponent() != null; + _interactable = VrInteractable.Find(this); + _interactable.HoverEntered += OnHoverEnter; + _interactable.HoverExited += OnHoverExit; + // DEBUG - Use this to enable brightening up all rendered objects if you want to check the attack window. { // GlobalEventDispatcher.FightWindowInitial.AddListener(_ => OnHoverEnter(1f)); @@ -60,7 +65,16 @@ private void Start() _nameCanvas.SetActive(false); } - public void OnHoverEnter(HVRGrabberBase _, HVRGrabbable __) + private void OnDestroy() + { + if (_interactable == null) + return; + + _interactable.HoverEntered -= OnHoverEnter; + _interactable.HoverExited -= OnHoverExit; + } + + private void OnHoverEnter(VrGrabArgs _) { OnHoverEnter(_isNpc ? Constants.ShaderPropertyFocusBrightnessNpcValue @@ -93,7 +107,7 @@ public void OnHoverEnter(float shaderPropertyFocusBrightnessValue) _isHovered = true; } - public void OnHoverExit(HVRGrabberBase _, HVRGrabbable __) + private void OnHoverExit(VrGrabArgs _) { if (_featureBrightenUp) { @@ -155,4 +169,3 @@ private void SetFocusName() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs b/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs index 825aa5003..4fc4df670 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/VRNpc.cs @@ -1,5 +1,5 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Npc; +using Gothic.Core.Adapters.Npc; +using Gothic.Core.Adapters.UI.StatusBars; using Gothic.Core.Manager; using Gothic.Core.Models.Container; using Gothic.Core.Models.Vm; @@ -9,8 +9,8 @@ using Gothic.Core.Services.World; using Gothic.Core; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; using Reflex.Attributes; using UnityEngine; using ZenKit.Daedalus; @@ -27,22 +27,55 @@ public class VRNpc : MonoBehaviour private NpcContainer _npcData; private VRNpcLoot _npcLoot; + private VrInteractable _interactable; + private StatusBarAdapter _healthBar; private void Awake() { _npcData = GetComponentInParent().Npc.GetUserData(); _npcLoot = GetComponent(); + _healthBar = GetComponentInChildren(true); + + _interactable = VrInteractable.Find(this); + _interactable.Grabbed += OnGrabbed; + _interactable.HoverEntered += OnHoverEnter; + _interactable.HoverExited += OnHoverExit; + } + + private void OnDestroy() + { + if (_interactable == null) + return; + + _interactable.Grabbed -= OnGrabbed; + _interactable.HoverEntered -= OnHoverEnter; + _interactable.HoverExited -= OnHoverExit; + } + + /// + /// The NPC's health bar is only visible while a hand hovers over the NPC. + /// + private void OnHoverEnter(VrGrabArgs _) + { + if (_healthBar != null) + _healthBar.EnableBar(); + } + + private void OnHoverExit(VrGrabArgs _) + { + if (_healthBar != null) + _healthBar.DisableBar(); } - public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnGrabbed(VrGrabArgs args) { var isDead = _npcData.Props.BodyState == VmGothicEnums.BodyState.BsDead; if (isDead && _configService.Dev.EnableNpcLooting && _npcLoot != null) { _npcLoot.Toggle(_npcData); - // HVR sets isKinematic=false during grab; release immediately and freeze the corpse - grabber.ForceRelease(); + // Grabbing turns physics on (VRPlayerItemAdapter); release immediately and freeze the corpse + args.Interactable.ForceRelease(); _physicsService.DisablePhysicsForNpc(_npcData.PrefabProps); return; } @@ -57,11 +90,10 @@ public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) _npcAiService.ExecutePerception(VmGothicEnums.PerceptionType.AssessTalk, _npcData.Props, _npcData.Instance, null, (NpcInstance)_gameStateService.GothicVm.GlobalHero); } - // Talking is a click, not a grab: release (HVR's grab turns physics on) and keep a seated NPC kinematic. - grabber.ForceRelease(); + // Talking is a click, not a grab: release (grabbing turns physics on) and keep a seated NPC kinematic. + args.Interactable.ForceRelease(); if (_npcData.IsUsingMob()) _physicsService.DisablePhysicsForNpc(_npcData.PrefabProps); } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs b/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs index 8181fe115..9f62cb045 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/VRNpcLoot.cs @@ -1,9 +1,7 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using Assets.HurricaneVR.Framework.Shared.Utilities; using Gothic.Core; using Gothic.Core.Adapters.Npc; using Gothic.Core.Adapters.Vob; @@ -16,10 +14,10 @@ using Gothic.Core.Services.Caches; using Gothic.Core.Services.Npc; using Gothic.Core.Services.Vobs; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; -using HurricaneVR.Framework.Core.Sockets; using Reflex.Attributes; using TMPro; using UnityEngine; @@ -46,7 +44,7 @@ public class VRNpcLoot : MonoBehaviour private NpcContainer _npcContainer; private NpcLoader _npcLoader; - private readonly List _sockets = new(); + private readonly List _sockets = new(); private readonly List _socketRoots = new(); private bool _isOpen; private bool _tempIgnoreSocketing; @@ -119,8 +117,8 @@ private void CreateSockets() socketGo.transform.localRotation = Quaternion.identity; socketGo.transform.localScale = Vector3.one * 1.6f; - var socket = socketGo.GetComponentInChildren(); - socket.Released.AddListener(OnItemTakenFromLoot); + var socket = socketGo.GetComponentInChildren(); + socket.Released += OnItemTakenFromLoot; _socketRoots.Add(socketGo); _sockets.Add(socket); @@ -129,6 +127,9 @@ private void CreateSockets() private void DestroySockets() { + foreach (var socket in _sockets) + socket.Released -= OnItemTakenFromLoot; + foreach (var root in _socketRoots) { if (root != null) @@ -213,11 +214,11 @@ private IEnumerator PopulateSockets(bool clearFirst) yield return null; - var grabbable = vobContainer.Go.GetComponentInChildren(true); - var freeSocket = _sockets.FirstOrDefault(s => !s.IsGrabbing); + var interactable = vobContainer.Go.GetComponentInChildren(true); + var freeSocket = _sockets.FirstOrDefault(s => !s.IsOccupied); if (freeSocket != null) { - freeSocket.TryGrab(grabbable, true, true); + freeSocket.TryPlace(interactable, true); if (entry.IsEquipped) AddEquippedLabel(GetSocketRoot(freeSocket)); } @@ -240,13 +241,13 @@ private void ClearSocketContents() foreach (var socket in _sockets) { - if (!socket.IsGrabbing) + if (!socket.IsOccupied) continue; - var heldRoot = socket.HeldObject.transform.parent.gameObject; + var heldRoot = socket.Held.transform.parent.gameObject; socket.ForceRelease(); heldRoot.SetActive(false); - this.ExecuteNextUpdate(() => Destroy(heldRoot)); + StartCoroutine(DestroyNextFrame(heldRoot)); } } @@ -263,12 +264,18 @@ private IEnumerator CloseSockets() _vrWeaponService.DrawSoundsActive = true; } - public void OnItemTakenFromLoot(HVRGrabberBase grabber, HVRGrabbable grabbable) + private static IEnumerator DestroyNextFrame(GameObject go) + { + yield return null; + Destroy(go); + } + + private void OnItemTakenFromLoot(VrGrabArgs args) { - if (_tempIgnoreSocketing) + if (_tempIgnoreSocketing || args.Interactable == null) return; - var vobLoader = grabbable.GetComponentInParent(); + var vobLoader = args.Interactable.GetComponentInParent(); if (vobLoader?.Container == null) return; @@ -355,7 +362,7 @@ private GameObject FindEquippedWeaponGo(ItemInstance equipped) return null; } - private GameObject GetSocketRoot(HVRSocket socket) + private GameObject GetSocketRoot(IVrSocket socket) { var idx = _sockets.IndexOf(socket); return idx >= 0 && idx < _socketRoots.Count ? _socketRoots[idx] : null; @@ -385,4 +392,3 @@ private static void AddEquippedLabel(GameObject socketRoot) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs index 5c43a6669..5b021549f 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerSocketInventory.cs @@ -1,10 +1,10 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Vob; +using Gothic.Core.Adapters.Vob; using Gothic.Core.Models.Container; +using System.Collections.Generic; using Gothic.Core.Models.Vm; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; using Reflex.Attributes; using UnityEngine; @@ -12,22 +12,60 @@ namespace Gothic.VR.Adapters.Vob.Container { /// /// Handle Socket-events for a whole Container (e.g., chest) and its corresponding sockets (rings where we put items into). + /// Plays the weapon (un)draw sound when a weapon is put into or taken out of a socket. /// public class VRVobContainerSocketInventory : MonoBehaviour { [Inject] private VRWeaponService _vrWeaponService; - public void OnBeforeGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + [Tooltip("Sockets outside of this GameObject's hierarchy (e.g. the player's holsters). " + + "Sockets below this GameObject are found automatically.")] + [SerializeField] private GameObject[] _additionalSockets; + + private readonly List _sockets = new(); + + private void Awake() { - var container = grabbable.GetComponentInParent()?.Container; + _sockets.AddRange(GetComponentsInChildren(true)); + foreach (var socketGo in _additionalSockets) + { + if (socketGo != null && socketGo.TryGetComponent(out IVrSocket socket)) + _sockets.Add(socket); + } + + foreach (var socket in _sockets) + { + socket.BeforeGrabbed += OnBeforeGrabbed; + socket.Released += OnReleased; + } + } + + private void OnDestroy() + { + foreach (var socket in _sockets) + { + socket.BeforeGrabbed -= OnBeforeGrabbed; + socket.Released -= OnReleased; + } + } + + private void OnBeforeGrabbed(VrGrabArgs args) + { + if (args.Interactable == null) + return; + + var container = args.Interactable.GetComponentInParent()?.Container; if (!IsWeapon(container)) return; _vrWeaponService.PlayUndrawSound(container); } - public void OnReleased(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnReleased(VrGrabArgs args) { - var container = grabbable.GetComponentInParent()?.Container; + if (args.Interactable == null) + return; + + var container = args.Interactable.GetComponentInParent()?.Container; if (!IsWeapon(container)) return; _vrWeaponService.PlayDrawSound(container); @@ -42,4 +80,3 @@ private bool IsWeapon(VobContainer container) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs index 7d7c94e22..495250201 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections; +using System.Collections; using Gothic.Core; using Gothic.Core.Adapters.Vob; using Gothic.Core.Extensions; @@ -9,8 +8,8 @@ using Gothic.Core.Services.Vm; using Gothic.VR.Services; using Gothic.VR.Adapters.Vob.VobItem; -using HurricaneVR.Framework.Components; -using HurricaneVR.Framework.Shared; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; using UnityEngine; using ZenKit.Vobs; @@ -23,7 +22,6 @@ public class VRContainerDoorPickingInteraction : MonoBehaviour [SerializeField] private GameObject _rootGO; [SerializeField] private AudioSource _audioSource; - [SerializeField] private HVRPhysicsDoor _hvrPhysicsDoor; [Inject] private readonly VRPlayerService _vrPlayerService; [Inject] private readonly AudioService _audioService; @@ -33,9 +31,10 @@ public class VRContainerDoorPickingInteraction : MonoBehaviour private bool _isLocked; private string _combination; private string _keyInstance; - private HVRHandSide _handSide; + private VrHandSide _handSide; private VobContainer _lockPick; private VobContainer _lockable; + private IVrHinge _hinge; private const string _lockInteractionColliderName = "LockPickInteraction"; @@ -51,7 +50,10 @@ public enum DoorLockStatus private void Start() { - _lockable = GetComponentInParent().Container; + var vobLoader = GetComponentInParent(); + _lockable = vobLoader.Container; + // Every door and chest has exactly one hinge (the door wing or the chest lid). + _hinge = vobLoader.GetComponentInChildren(true); switch (_lockable.Vob) { case IDoor door: @@ -84,7 +86,7 @@ private IEnumerator StartDelayed() yield return null; // Deactivate rotation - _hvrPhysicsDoor.Lock(); + _hinge.Lock(); } private void OnTriggerEnter(Collider other) @@ -101,12 +103,12 @@ private void OnTriggerEnter(Collider other) if (IsHeldItem(_vrPlayerService.GrabbedItemLeft, other.gameObject)) { holdingHand = _vrPlayerService.GrabbedItemLeft.transform; - _handSide = HVRHandSide.Left; + _handSide = VrHandSide.Left; } else if (IsHeldItem(_vrPlayerService.GrabbedItemRight, other.gameObject)) { holdingHand = _vrPlayerService.GrabbedItemRight.transform; - _handSide = HVRHandSide.Right; + _handSide = VrHandSide.Right; } else { @@ -115,7 +117,7 @@ private void OnTriggerEnter(Collider other) _combinationPos = 0; PlaySound(_vmService.DoorLockSoundName); - _hapticsService.Vibrate(_handSide, VrHapticsService.VibrationType.Info); + _hapticsService.Vibrate(_handSide, VrHapticPreset.Info); // For later event usage. _lockPick = other.gameObject.GetComponentInParent().Container; @@ -213,13 +215,13 @@ private void TryUnlockWithKey(Collider other) return; // The player must actively hold the key (not just a dropped/flying item). - HVRHandSide hand; + VrHandSide hand; var leftRoot = _vrPlayerService.GrabbedItemLeft; var rightRoot = _vrPlayerService.GrabbedItemRight; if (leftRoot != null && leftRoot.GetComponentInParent() == vobLoader) - hand = HVRHandSide.Left; + hand = VrHandSide.Left; else if (rightRoot != null && rightRoot.GetComponentInParent() == vobLoader) - hand = HVRHandSide.Right; + hand = VrHandSide.Right; else return; @@ -233,12 +235,12 @@ private void TryUnlockWithKey(Collider other) private void UnlockAndPushOpen() { // Reactivate rotation - _hvrPhysicsDoor.Unlock(); + _hinge.Unlock(); // Apply force in the door's forward direction (world space) - var pushDirection = _hvrPhysicsDoor.transform.forward; + var pushDirection = _hinge.Transform.forward; var pushForce = 10f; - _hvrPhysicsDoor.GetComponent().AddForce(pushDirection * pushForce, ForceMode.Impulse); + _hinge.Rigidbody.AddForce(pushDirection * pushForce, ForceMode.Impulse); gameObject.SetActive(false); } @@ -259,5 +261,3 @@ private void PlaySound(string soundName, string fallback = null) } } } -#endif - diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs index d9a74ce93..6af192e7d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickInteraction.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using UnityEngine; namespace Gothic.VR.Adapters.Vob.LockPicking @@ -111,4 +110,3 @@ private void UpdateStatus(RotationState state) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs index e51c96eb1..5009b0c8d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/LockPicking/VRLockPickProperties.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using UnityEngine; +using UnityEngine; namespace Gothic.VR.Adapters.Vob.LockPicking { @@ -10,4 +9,3 @@ public class VRLockPickProperties : VRVobItemProperties public Transform HoldingHand; } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs index 7c57c2b9b..fb36a5595 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRDigSpot.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using Gothic.Core.Adapters.Vob; using Gothic.Core.Extensions; @@ -6,8 +5,7 @@ using Gothic.Core.Models.Container; using Gothic.Core.Models.Vm; using Gothic.Core.Services.Vm; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; +using Gothic.VR.Services; using Reflex.Attributes; using UnityEngine; using ZenKit.Vobs; @@ -38,22 +36,22 @@ public class VRDigSpot : MonoBehaviour private const string _stateOneSuffix = "_S1"; [Inject] private readonly VmService _vmService; + [Inject] private readonly VRPlayerService _vrPlayerService; private IInteractiveObject _mob; private Renderer[] _renderers; - private HVRHandGrabber[] _hands; private int _hits; private float _lastHitTime = float.NegativeInfinity; - private HVRGrabbable _lastWeapon; + private GameObject _lastWeapon; private bool? _isLastWeaponAllowed; private Collider[] _lastWeaponColliders; + private Rigidbody _lastWeaponRigidbody; private void Start() { var loader = GetComponentInParent(); _mob = loader?.Container?.Vob as IInteractiveObject; _renderers = loader != null ? loader.GetComponentsInChildren(true) : Array.Empty(); - _hands = FindObjectsByType(FindObjectsSortMode.None); // Also tells whether the mob is visible at all (G2 X marks were invisible in an older playtest). Logger.Log($"[VRDigSpot] '{loader?.name}' ready: func={_mob?.OnStateChangeFunction}{_stateOneSuffix}, " + @@ -69,31 +67,38 @@ private void FixedUpdate() if (!TryGetBounds(out var spotBounds)) return; - foreach (var hand in _hands) - { - var weapon = hand != null ? hand.GrabbedTarget : null; - if (weapon == null) - continue; + if (TryRegisterHit(_vrPlayerService.GrabbedItemLeft, spotBounds)) + return; - CacheWeapon(weapon); + TryRegisterHit(_vrPlayerService.GrabbedItemRight, spotBounds); + } - var rb = weapon.Rigidbody; - if (rb == null || rb.linearVelocity.magnitude < _minSwingSpeed) - continue; + /// + /// Checks the item in one hand (null if the hand is empty). + /// + private bool TryRegisterHit(GameObject weapon, Bounds spotBounds) + { + if (weapon == null) + return false; - if (!IntersectsWeapon(spotBounds)) - continue; + CacheWeapon(weapon); - // Cheapest checks first: the tool lookup only runs for a fast weapon touching the spot. - if (!IsAllowedTool(weapon)) - continue; + var rb = _lastWeaponRigidbody; + if (rb == null || rb.linearVelocity.magnitude < _minSwingSpeed) + return false; - RegisterHit(weapon); - return; - } + if (!IntersectsWeapon(spotBounds)) + return false; + + // Cheapest checks first: the tool lookup only runs for a fast weapon touching the spot. + if (!IsAllowedTool(weapon)) + return false; + + RegisterHit(weapon); + return true; } - private void CacheWeapon(HVRGrabbable weapon) + private void CacheWeapon(GameObject weapon) { if (weapon == _lastWeapon) return; @@ -101,15 +106,16 @@ private void CacheWeapon(HVRGrabbable weapon) _lastWeapon = weapon; _isLastWeaponAllowed = null; _lastWeaponColliders = weapon.GetComponentsInChildren(); + _lastWeaponRigidbody = weapon.GetComponent(); } - private bool IsAllowedTool(HVRGrabbable weapon) + private bool IsAllowedTool(GameObject weapon) { _isLastWeaponAllowed ??= CheckAllowedTool(weapon); return _isLastWeaponAllowed.Value; } - private bool CheckAllowedTool(HVRGrabbable weapon) + private bool CheckAllowedTool(GameObject weapon) { var container = weapon.GetComponentInParent()?.Container; var item = container?.GetItemInstance(); @@ -157,7 +163,7 @@ private bool IntersectsWeapon(Bounds spotBounds) return false; } - private void RegisterHit(HVRGrabbable weapon) + private void RegisterHit(GameObject weapon) { _lastHitTime = Time.time; _hits++; @@ -184,4 +190,3 @@ private void Dig() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs index 202b7b594..df115c243 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRMobInteraction.cs @@ -1,10 +1,9 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core.Adapters.Vob; using Gothic.Core.Logging; using Gothic.Core.Services.Vobs; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; using Gothic.VR.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; using Reflex.Attributes; using UnityEngine; using Logger = Gothic.Core.Logging.Logger; @@ -12,7 +11,7 @@ namespace Gothic.VR.Adapters.Vob { /// - /// Uses a mob (wheel, lever, shrine, bed, ...) when the hero grabs it. Sits next to the mob's HVRGrabbable. + /// Uses a mob (wheel, lever, shrine, bed, ...) when the hero grabs it. Sits next to the mob's VrInteractable. /// The logic itself is platform neutral (MobInteractionService). /// public class VRMobInteraction : MonoBehaviour @@ -21,17 +20,30 @@ public class VRMobInteraction : MonoBehaviour [Inject] private readonly MobInteractionService _mobInteractionService; private bool _mobActivated; + private VrInteractable _interactable; + /// + /// Subscribed in Start (not Awake), so that e.g. VRSeat handles a grab first (as before). + /// private void Start() { - if (TryGetComponent(out HVRGrabbable grabbable)) - { - grabbable.Grabbed.AddListener(OnGrabbed); - grabbable.Released.AddListener(OnReleased); - } + if (!TryGetComponent(out _interactable)) + return; + + _interactable.Grabbed += OnGrabbed; + _interactable.Released += OnReleased; + } + + private void OnDestroy() + { + if (_interactable == null) + return; + + _interactable.Grabbed -= OnGrabbed; + _interactable.Released -= OnReleased; } - private void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnGrabbed(VrGrabArgs args) { if (_mobActivated) return; @@ -46,10 +58,9 @@ private void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) _vrPlayerService.HandleMobGrab(vobLoader); } - private void OnReleased(HVRGrabberBase _, HVRGrabbable __) + private void OnReleased(VrGrabArgs _) { _mobActivated = false; } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs index 7273766c1..e617d160d 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobContainer.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Gothic.Core.Adapters.Vob; using Gothic.Core.Const; @@ -8,7 +7,7 @@ using Gothic.Core.Logging; using Gothic.Core.Manager; using Gothic.Core.Services.Caches; -using HurricaneVR.Framework.Components; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; using UnityEngine; using UnityEngine.SceneManagement; @@ -44,8 +43,8 @@ private void Start() } /// - /// Add opening and closing sound to the containers HVR settings. - /// The logic about when to play them is provided by HVR itself. + /// Add opening and closing sound to the container's hinge (lid). + /// The hinge itself decides when to play them. /// private void PrepareSounds(IContainer vobContainer) { @@ -75,10 +74,8 @@ private void PrepareSounds(IContainer vobContainer) } // We leverage the same "door" script for containers (As it's also just an object to be rotated. - var hvrDoor = GetComponentInChildren(); - hvrDoor.SFXOpened = _containerOpenedClips[mdsName.ToLower()]; - hvrDoor.SFXClosed = _containerClosedClips[mdsName.ToLower()]; + var hinge = GetComponentInChildren(); + hinge.SetSounds(_containerOpenedClips[mdsName.ToLower()], _containerClosedClips[mdsName.ToLower()]); } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs index 249f6a260..a7a33f233 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobDoor.cs @@ -1,12 +1,11 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Gothic.Core.Adapters.Vob; using Gothic.Core.Manager; using Gothic.Core.Services.Caches; using Gothic.Core; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Components; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; using UnityEngine; using ZenKit.Vobs; @@ -29,8 +28,8 @@ private void Start() } /// - /// Add opening and closing sound to the containers HVR settings. - /// The logic about when to play them is provided by HVR itself. + /// Add opening and closing sound to the door's hinge. + /// The hinge itself decides when to play them. /// private void PrepareSounds(IDoor props) { @@ -65,10 +64,8 @@ private void PrepareSounds(IDoor props) _doorClosedClips.Add(mdsName.ToLower(), _audioService.GetRandomSoundClip(closeSoundEffect)); } - var hvrDoor = GetComponentInChildren(); - hvrDoor.SFXOpened = _doorOpenedClips[mdsName.ToLower()]; - hvrDoor.SFXClosed = _doorClosedClips[mdsName.ToLower()]; + var hinge = GetComponentInChildren(); + hinge.SetSounds(_doorOpenedClips[mdsName.ToLower()], _doorClosedClips[mdsName.ToLower()]); } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs index e61472ae7..6dc29d1bd 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VRVobItem.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections; +using System.Collections; using Gothic.Core.Const; using Gothic.Core.Manager; using Gothic.Core.Services.Config; @@ -8,8 +7,8 @@ using Gothic.VR.Services; using Gothic.Core; using Gothic.Core.Services; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; using Reflex.Attributes; using UnityEngine; using UnityEngine.Animations; @@ -32,6 +31,8 @@ public class VRVobItem : MonoBehaviour private readonly Collider[] _overlapColliders = new Collider[1]; private static int _ignoreLayerCollisionCheck; + private VrInteractable _interactable; + private struct OverlapCheckData { @@ -54,11 +55,24 @@ private void Awake() { _ignoreLayerCollisionCheck = Constants.VobItemNoWorldCollision | Constants.HandLayer; } + + _interactable = GetComponent(); + _interactable.Grabbed += OnGrabbed; + _interactable.Released += OnReleased; } private void Start() { - GetComponent().SetupColliders(); + _interactable.SetupColliders(); + } + + private void OnDestroy() + { + if (_interactable == null) + return; + + _interactable.Grabbed -= OnGrabbed; + _interactable.Released -= OnReleased; } /// @@ -66,21 +80,21 @@ private void Start() /// 2. Grabbed via HandGrabber (direct grabbing into hand) /// 3. Grabbed via Socket (e.g., backpack) /// - public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnGrabbed(VrGrabArgs args) { // Ignore grabbing once, if MarvinSelectionMode is active. if (_marvinService.IsMarvinSelectionMode) { - _marvinService.MarvinSelectionGO = grabbable.gameObject; + _marvinService.MarvinSelectionGO = args.Interactable.gameObject; return; } // Held and socketed items must not push our own CharacterController. - _vrPlayerService.IgnorePlayerCollision(grabbable, true); + _vrPlayerService.IgnorePlayerCollision(args.Interactable, true); // OnGrabbed is normally called multiple times. Even after an object is already socketed. If so, then let's stop Grab behaviour. // If we sock an object on our hips or backpack etc. - if (grabber is HVRSocket) + if (args.Kind == VrGrabberKind.Socket) return; // Stop collisions while being dragged around (at least shortly; otherwise e.g. items might stick inside chests when pulled out). @@ -94,7 +108,7 @@ public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) StartCoroutine(ReEnableCollisionRoutine()); _vobMeshCullingService?.StartTrackVobPositionUpdates(gameObject); - _vrPlayerService.SetGrab(grabber, grabbable); + _vrPlayerService.SetGrab(args); } /// @@ -102,25 +116,25 @@ public void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) /// 2. Grabbed via HandGrabber (direct grabbing into hand) /// 3. Grabbed via Socket (e.g., backpack) /// - public void OnReleased(HVRGrabberBase grabber, HVRGrabbable grabbable) + private void OnReleased(VrGrabArgs args) { // If we release an object from our hips or backpack etc. // We then assume, that the item is already with correct values as it was grabbed before (shader, layer, ...) - if (grabber is HVRSocket) + if (args.Kind == VrGrabberKind.Socket) return; gameObject.layer = Constants.VobItemLayer; // Back to default // Dropped into the world (and not still in the other hand): we get stuck at it again. - if (!grabbable.IsBeingHeld) - _vrPlayerService.IgnorePlayerCollision(grabbable, false); + if (!args.Interactable.IsHeld) + _vrPlayerService.IgnorePlayerCollision(args.Interactable, false); // Disable "ghostification" of object. _dynamicMaterialService.ResetDynamicValue(gameObject, Constants.ShaderPropertyTransparency, Constants.ShaderPropertyTransparencyDefault); _vobMeshCullingService?.StopTrackVobPositionUpdates(gameObject); - _vrPlayerService.UnsetGrab(grabber, grabbable); + _vrPlayerService.UnsetGrab(args); } /// @@ -301,4 +315,3 @@ private void OnDisable() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs b/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs index 62d6ef39f..475bdf68c 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs +++ b/Assets/Gothic-VR/Scripts/Adapters/Vob/VobItem/VRWeaponAttackAdapter.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Adapters.Npc; using Gothic.Core.Adapters.Vob; @@ -116,4 +115,3 @@ private bool TryFireHitViaVRWeaponService(NpcContainer targetNpcContainer) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs b/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs index 926e79758..539ea6cd1 100644 --- a/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs +++ b/Assets/Gothic-VR/Scripts/Domain/Player/VrWeaponAttackDomain.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System; using System.Collections.Generic; using System.Linq; @@ -13,9 +12,9 @@ using Gothic.Core.Models.Vm; using Gothic.Core.Services.Caches; using Gothic.VR.Models.Vob; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Services; -using HurricaneVR.Framework.Core.Utils; -using HurricaneVR.Framework.Shared; using Reflex.Attributes; using UnityEngine; using ZenKit; @@ -29,9 +28,10 @@ public class VrWeaponAttackDomain [Inject] private readonly VmCacheService _vmCacheService; [Inject] private readonly VRPlayerService _vrPlayerService; [Inject] private readonly AudioService _audioService; + [Inject] private readonly IVrSfxPlayer _vrSfxPlayer; [Inject] private readonly ResourceCacheService _resourceCacheService; - private CharacterController _characterController => _vrPlayerService.VRContextInteractionService.GetVRPlayerController().CharacterController; + private CharacterController _characterController => _vrPlayerService.VRContextInteractionService.Rig.CharacterController; private const int _twoHandedFlags = (int)VmGothicEnums.ItemFlags.Item2HdAxe | (int)VmGothicEnums.ItemFlags.Item2HdSwd; @@ -87,7 +87,7 @@ private static readonly (float attackWindowTime, float comboWindowStart, float c /// FALSE, when: /// 1. Already handling one weapon, but another one is provided. /// - public bool TryHandle(VobContainer vobContainer, WeaponPhysicsConfig weaponConfig, HVRHandSide handSide, NpcContainer playerNpcContainer) + public bool TryHandle(VobContainer vobContainer, WeaponPhysicsConfig weaponConfig, VrHandSide handSide, NpcContainer playerNpcContainer) { if (!CanHandle(vobContainer)) return false; @@ -135,9 +135,9 @@ public bool TryHandle(VobContainer vobContainer, WeaponPhysicsConfig weaponConfi windowTimes.comboWindowStart, windowTimes.comboWindowTime); } - if (handSide == HVRHandSide.Left) + if (handSide == VrHandSide.Left) _handlesLeftHand = true; - else if (handSide == HVRHandSide.Right) + else if (handSide == VrHandSide.Right) _handlesRightHand = true; AlterWeaponWeights(weaponConfig); @@ -168,14 +168,14 @@ private bool CanHandle(VobContainer newWeapon) return false; } - public bool TryUnHandle(WeaponPhysicsConfig weaponConfig, HVRHandSide handSide) + public bool TryUnHandle(WeaponPhysicsConfig weaponConfig, VrHandSide handSide) { if (!CanUnHandle(handSide)) return false; - if (handSide == HVRHandSide.Left) + if (handSide == VrHandSide.Left) _handlesLeftHand = false; - else if (handSide == HVRHandSide.Right) + else if (handSide == VrHandSide.Right) _handlesRightHand = false; // Alter weight now, before we potentially unset VobContainer and Rigidbody. @@ -191,9 +191,9 @@ public bool TryUnHandle(WeaponPhysicsConfig weaponConfig, HVRHandSide handSide) /// Unhandle means: Do we released item in hand which we handled? /// Hint: We can only have one item in a hand at a time. Therefore, we don't need to check for the rigidbody itself. /// - private bool CanUnHandle(HVRHandSide releasedHandSide) + private bool CanUnHandle(VrHandSide releasedHandSide) { - if (releasedHandSide == HVRHandSide.Left) + if (releasedHandSide == VrHandSide.Left) return _handlesLeftHand; else return _handlesRightHand; @@ -423,7 +423,7 @@ private void HandleSound() if (_swingSwordSound == null) return; - SFXPlayer.Instance.PlaySFX(_audioService.CreateAudioClip(_swingSwordSound.GetRandomSound()), _weaponRigidbody.position); + _vrSfxPlayer.Play(_audioService.CreateAudioClip(_swingSwordSound.GetRandomSound()), _weaponRigidbody.position); } private void HandleInitialWindow() @@ -585,4 +585,3 @@ public void CalculateCapsuleOverlap(CapsuleCollider capsuleCollider, out Vector3 } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction.meta b/Assets/Gothic-VR/Scripts/Interaction.meta new file mode 100644 index 000000000..a5ce655ce --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c17fb20ae6868424d94ea9dc7d7e3465 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends.meta new file mode 100644 index 000000000..92a4f1536 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c7c846aa1d858e40893acb91583324c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr.meta new file mode 100644 index 000000000..8e0147cd7 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0091983ca36e5ee43bf1d30f0b009682 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs new file mode 100644 index 000000000..52f621bab --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs @@ -0,0 +1,20 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.VR.Interaction.Ports; +using Reflex.Core; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + public class HvrBackend : IVrBackend + { + public string Name => "HurricaneVR"; + + public void InstallBindings(ContainerBuilder containerBuilder) + { + containerBuilder.AddSingleton(typeof(HvrInput), typeof(IVrInput)); + containerBuilder.AddSingleton(typeof(HvrHaptics), typeof(IVrHaptics)); + containerBuilder.AddSingleton(typeof(HvrUiPointers), typeof(IVrUiPointers)); + containerBuilder.AddSingleton(typeof(HvrSfxPlayer), typeof(IVrSfxPlayer)); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs.meta new file mode 100644 index 000000000..a04af0d7c --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrBackend.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 40aa78a38329bf048a068cc514c6e5bb \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrEnumExtensions.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrEnumExtensions.cs new file mode 100644 index 000000000..adafcfa07 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrEnumExtensions.cs @@ -0,0 +1,94 @@ +#if GOTHIC_HVR_INSTALLED +using System; +using Gothic.VR.Interaction.Models; +using HurricaneVR.Framework.Core.Grabbers; +using HurricaneVR.Framework.Core.Player; +using HurricaneVR.Framework.Shared; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Maps our VR models to HVR types and back. Only used inside the HVR backend. + /// + public static class HvrEnumExtensions + { + public static HVRHandSide ToHvr(this VrHandSide side) + { + return side == VrHandSide.Left ? HVRHandSide.Left : HVRHandSide.Right; + } + + public static VrHandSide ToVr(this HVRHandSide side) + { + return side == HVRHandSide.Left ? VrHandSide.Left : VrHandSide.Right; + } + + public static VrGrabberKind ToVrKind(this HVRGrabberBase grabber) + { + return grabber switch + { + HVRHandGrabber => VrGrabberKind.Hand, + HVRForceGrabber => VrGrabberKind.Distance, + HVRSocket => VrGrabberKind.Socket, + _ => VrGrabberKind.Other + }; + } + + /// + /// Hand of a hand or distance grabber. Left for all other grabbers. + /// + public static VrHandSide ToVrHandSide(this HVRGrabberBase grabber) + { + return grabber switch + { + HVRHandGrabber hand => hand.HandSide.ToVr(), + HVRForceGrabber force when force.HandGrabber != null => force.HandGrabber.HandSide.ToVr(), + _ => VrHandSide.Left + }; + } + + public static HVRButtons ToHvr(this VrButton button) + { + return button switch + { + VrButton.Grip => HVRButtons.Grip, + VrButton.Trigger => HVRButtons.Trigger, + VrButton.Primary => HVRButtons.Primary, + VrButton.Secondary => HVRButtons.Secondary, + VrButton.Menu => HVRButtons.Menu, + VrButton.JoystickButton => HVRButtons.JoystickButton, + _ => throw new ArgumentOutOfRangeException(nameof(button), button, null) + }; + } + + public static VrButtonState ToVr(this HVRButtonState state) + { + return new VrButtonState(state.Active, state.JustActivated, state.JustDeactivated); + } + + public static HVRSitStand ToHvr(this VrSitStand sitStand) + { + return sitStand switch + { + VrSitStand.Sitting => HVRSitStand.Sitting, + VrSitStand.Standing => HVRSitStand.Standing, + _ => HVRSitStand.PlayerHeight + }; + } + + public static PlayerDirectionMode ToHvr(this VrMoveDirection direction) + { + return direction switch + { + VrMoveDirection.LeftController => PlayerDirectionMode.LeftController, + VrMoveDirection.RightController => PlayerDirectionMode.RightController, + _ => PlayerDirectionMode.Camera + }; + } + + public static RotationType ToHvr(this VrTurnType turnType) + { + return turnType == VrTurnType.Smooth ? RotationType.Smooth : RotationType.Snap; + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrEnumExtensions.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrEnumExtensions.cs.meta new file mode 100644 index 000000000..a54b1c782 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrEnumExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b30f5f87f90ba3b4690126ff005a8a5c \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabArgsFactory.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabArgsFactory.cs new file mode 100644 index 000000000..ba754a132 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabArgsFactory.cs @@ -0,0 +1,45 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.Core.Logging; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; +using HurricaneVR.Framework.Core; +using HurricaneVR.Framework.Core.Grabbers; +using Logger = Gothic.Core.Logging.Logger; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Translates HVR's (grabber, grabbable) event parameters into our VrGrabArgs. + /// + public static class HvrGrabArgsFactory + { + public static VrGrabArgs Create(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + return new VrGrabArgs( + grabber.ToVrKind(), + grabber.ToVrHandSide(), + GetInteractable(grabbable), + grabber != null ? grabber.gameObject : null); + } + + /// + /// Our prefabs have a VrInteractable next to every HVRGrabbable. Grabbables from elsewhere (e.g. HVR's own + /// prefabs) get one on first use, so game code never receives null. + /// + public static VrInteractable GetInteractable(HVRGrabbable grabbable) + { + if (grabbable == null) + return null; + + var interactable = grabbable.GetComponent(); + if (interactable != null) + return interactable; + + Logger.LogWarning($"[HVR] {grabbable.name} has no VrInteractable. Adding it at runtime.", LogCat.VR); + interactable = grabbable.gameObject.AddComponent(); + grabbable.gameObject.AddComponent(); + return interactable; + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabArgsFactory.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabArgsFactory.cs.meta new file mode 100644 index 000000000..03cd04605 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabArgsFactory.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 292ed7e3ea9db914f80f7be3bda8d853 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabberBridge.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabberBridge.cs new file mode 100644 index 000000000..d3e7dd6c1 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabberBridge.cs @@ -0,0 +1,87 @@ +#if GOTHIC_HVR_INSTALLED +using System; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core; +using HurricaneVR.Framework.Core.Grabbers; +using UnityEngine; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Sits next to an HVR grabber (hand or force grabber) and forwards its events synchronously as IVrGrabber events. + /// BeforeGrabbed is also forwarded to the grabbed VrInteractable (HVRGrabbable has no such event). + /// + public class HvrGrabberBridge : MonoBehaviour, IVrGrabber + { + public event Action BeforeGrabbed; + public event Action Grabbed; + public event Action Released; + + private HVRGrabberBase _grabber; + private bool _isSubscribed; + + protected HVRGrabberBase Grabber + { + get + { + if (_grabber == null) + _grabber = GetComponent(); + return _grabber; + } + } + + public VrGrabberKind Kind => Grabber.ToVrKind(); + public VrHandSide HandSide => Grabber.ToVrHandSide(); + + public VrInteractable Held => Grabber.IsGrabbing + ? HvrGrabArgsFactory.GetInteractable(Grabber.GrabbedTarget) + : null; + + protected virtual void Awake() + { + if (Grabber == null) + return; + + Grabber.BeforeGrabbed.AddListener(OnBeforeGrabbed); + Grabber.Grabbed.AddListener(OnGrabbed); + Grabber.Released.AddListener(OnReleased); + _isSubscribed = true; + } + + protected virtual void OnDestroy() + { + if (!_isSubscribed || _grabber == null) + return; + + _grabber.BeforeGrabbed.RemoveListener(OnBeforeGrabbed); + _grabber.Grabbed.RemoveListener(OnGrabbed); + _grabber.Released.RemoveListener(OnReleased); + } + + public void ForceRelease() + { + Grabber.ForceRelease(); + } + + private void OnBeforeGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + var args = HvrGrabArgsFactory.Create(grabber, grabbable); + BeforeGrabbed?.Invoke(args); + if (args.Interactable != null) + args.Interactable.RaiseBeforeGrabbed(args); + } + + private void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + Grabbed?.Invoke(HvrGrabArgsFactory.Create(grabber, grabbable)); + } + + private void OnReleased(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + Released?.Invoke(HvrGrabArgsFactory.Create(grabber, grabbable)); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabberBridge.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabberBridge.cs.meta new file mode 100644 index 000000000..deda76c4b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrGrabberBridge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4fc5f324acfcbc3428010a9db3c9422e \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHaptics.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHaptics.cs new file mode 100644 index 000000000..290625856 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHaptics.cs @@ -0,0 +1,33 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.ControllerInput; +using HurricaneVR.Framework.Shared; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + public class HvrHaptics : IVrHaptics + { + // Indexed by VrHapticPreset: amplitude, duration, frequency. + private readonly HapticData[] _presets = + { + // Info + new (0.15f, 0.25f, 30f), + + // Warning + new (0.25f, 0.5f, 100f), + + // Error + new (0.4f, 0.8f, 175f), + + // Success + new (0.5f, 0.6f, 80f) + }; + + public void Vibrate(VrHandSide side, VrHapticPreset preset) + { + HVRInputManager.Instance.GetController(side.ToHvr()).Vibrate(_presets[(int)preset]); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHaptics.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHaptics.cs.meta new file mode 100644 index 000000000..0ca40e56e --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHaptics.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9e7b3630924d8a04b85c1e313b643d64 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHingeBridge.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHingeBridge.cs new file mode 100644 index 000000000..e0d4d3c87 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHingeBridge.cs @@ -0,0 +1,45 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Components; +using UnityEngine; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Sits next to an HVRPhysicsDoor (doors, and chest lids via HvrPhysicsChest). + /// + public class HvrHingeBridge : MonoBehaviour, IVrHinge + { + private HVRPhysicsDoor _door; + + private HVRPhysicsDoor Door + { + get + { + if (_door == null) + _door = GetComponent(); + return _door; + } + } + + public Transform Transform => transform; + public Rigidbody Rigidbody => GetComponent(); + + public void Lock() + { + Door.Lock(); + } + + public void Unlock() + { + Door.Unlock(); + } + + public void SetSounds(AudioClip opened, AudioClip closed) + { + Door.SFXOpened = opened; + Door.SFXClosed = closed; + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHingeBridge.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHingeBridge.cs.meta new file mode 100644 index 000000000..7a15f7d05 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrHingeBridge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9fca5660b7d87044b9f6309422813386 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInput.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInput.cs new file mode 100644 index 000000000..70af90ea2 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInput.cs @@ -0,0 +1,45 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.Core.Extensions; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.ControllerInput; +using HurricaneVR.Framework.Shared; +using HurricaneVRExtensions.Simulator; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + public class HvrInput : IVrInput + { + private HVRPlayerInputs _playerInputs; + + public bool IsSimulator + { + get + { + if (_playerInputs == null) + _playerInputs = Object.FindFirstObjectByType(FindObjectsInactive.Include); + + return _playerInputs != null && _playerInputs.UseWASD; + } + } + + public VrButtonState GetButton(VrHandSide side, VrButton button) + { + return HVRController.GetButtonState(side.ToHvr(), button.ToHvr()).ToVr(); + } + + public Vector3 GetControllerVelocity(VrHandSide side) + { + return HVRInputManager.Instance.GetController(side.ToHvr()).Velocity; + } + + public void SetDeviceSimulatorActive(bool isActive) + { + var simulator = SceneManager.GetActiveScene().GetComponentInChildren(true)!; + simulator.gameObject.SetActive(isActive); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInput.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInput.cs.meta new file mode 100644 index 000000000..d38863b03 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInput.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0b477ad7f9e80aa418281fd0568ae459 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInteractableBridge.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInteractableBridge.cs new file mode 100644 index 000000000..bf6e3f25b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInteractableBridge.cs @@ -0,0 +1,99 @@ +#if GOTHIC_HVR_INSTALLED +using System.Collections.Generic; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core; +using HurricaneVR.Framework.Core.Grabbers; +using HurricaneVR.Framework.Core.Sockets; +using UnityEngine; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Sits next to an HVRGrabbable and its VrInteractable. Forwards HVR's grabbable events synchronously to the + /// VrInteractable and executes its commands on the HVRGrabbable. + /// + public class HvrInteractableBridge : MonoBehaviour, IVrInteractableBackend + { + private HVRGrabbable _grabbable; + private VrInteractable _interactable; + private bool _isSubscribed; + + private HVRGrabbable Grabbable + { + get + { + if (_grabbable == null) + _grabbable = GetComponent(); + return _grabbable; + } + } + + public bool IsHeld => Grabbable.IsBeingHeld; + public IReadOnlyList Colliders => Grabbable.Colliders; + + private void Awake() + { + _interactable = GetComponent(); + if (Grabbable == null || _interactable == null) + return; + + Grabbable.HoverEnter.AddListener(OnHoverEnter); + Grabbable.HoverExit.AddListener(OnHoverExit); + Grabbable.Grabbed.AddListener(OnGrabbed); + Grabbable.Released.AddListener(OnReleased); + _isSubscribed = true; + } + + private void OnDestroy() + { + if (!_isSubscribed || _grabbable == null) + return; + + _grabbable.HoverEnter.RemoveListener(OnHoverEnter); + _grabbable.HoverExit.RemoveListener(OnHoverExit); + _grabbable.Grabbed.RemoveListener(OnGrabbed); + _grabbable.Released.RemoveListener(OnReleased); + } + + public void ForceRelease() + { + Grabbable.ForceRelease(); + } + + public void SetupColliders() + { + Grabbable.SetupColliders(); + } + + public void SetSocketSounds(AudioClip socketed, AudioClip unsocketed) + { + if (!TryGetComponent(out HVRSocketable socketable)) + return; + + socketable.SocketedClip = socketed; + socketable.UnsocketedClip = unsocketed; + } + + private void OnHoverEnter(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + _interactable.RaiseHoverEntered(HvrGrabArgsFactory.Create(grabber, grabbable)); + } + + private void OnHoverExit(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + _interactable.RaiseHoverExited(HvrGrabArgsFactory.Create(grabber, grabbable)); + } + + private void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + _interactable.RaiseGrabbed(HvrGrabArgsFactory.Create(grabber, grabbable)); + } + + private void OnReleased(HVRGrabberBase grabber, HVRGrabbable grabbable) + { + _interactable.RaiseReleased(HvrGrabArgsFactory.Create(grabber, grabbable)); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInteractableBridge.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInteractableBridge.cs.meta new file mode 100644 index 000000000..ce3703878 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrInteractableBridge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 594f5e7857d0629419c1bef807639a86 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerPhysicsChest.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPhysicsChest.cs similarity index 89% rename from Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerPhysicsChest.cs rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPhysicsChest.cs index ba001a482..183b9f351 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerPhysicsChest.cs +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPhysicsChest.cs @@ -12,6 +12,8 @@ using Gothic.Core.Services.Caches; using Gothic.Core.Services.Meshes; using Gothic.Core.Services.Vobs; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Ports; using HurricaneVR.Framework.Components; using HurricaneVR.Framework.Core; using HurricaneVR.Framework.Core.Sockets; @@ -22,9 +24,13 @@ using ZenKit.Vobs; using Logger = Gothic.Core.Logging.Logger; -namespace Gothic.VR.Adapters.Vob.Container +namespace Gothic.VR.Interaction.Backends.Hvr { - public class VRVobContainerPhysicsChest : HVRPhysicsDoor + /// + /// Chest lid (HVR physics door) which fills the chest's sockets with its content when opened for the first time. + /// Temporarily in the HVR backend as it subclasses HVRPhysicsDoor. The sockets are used via IVrSocketContainer. + /// + public class HvrPhysicsChest : HVRPhysicsDoor { [Inject] private readonly MeshService _meshService; [Inject] private readonly VobService _vobService; @@ -45,6 +51,7 @@ public class VRVobContainerPhysicsChest : HVRPhysicsDoor [SerializeField] private HVRSocketContainer _socketContainer; [SerializeField] private BoxCollider _collectorCollider; private IContainer _vobContainer; + private IVrSocketContainer _sockets; // Flags to ensure we always call On*() once, everytime open/close status changes. private bool _openingForTheFirstTime = true; @@ -64,7 +71,8 @@ public struct ContentItem public override void Start() { base.Start(); - + + _sockets = _socketContainer.GetComponent(); _socketContainer.gameObject.SetActive(false); _vobContainer = _rootGo.GetComponentInParent().Container.VobAs(); @@ -114,7 +122,7 @@ private void OnClosed() /// private void AlignSockets() { - var sockets = _socketContainer.Sockets; + var sockets = _sockets.Sockets; // We need to dynamically fetch the bounding box of main mesh as some chests have the correct one inside BIP01 "CHEST_*_0" and others inside "ZM_CHEST*" var meshFilters = _rootGo @@ -172,7 +180,7 @@ private void AlignSockets() // _socketRadius - Location is based on a 50% shift into the desired area as the drawing of a circle starts centered // middleAlignment* - Centered location within a grid for an element // min.x - Start point to calculate from left top - socket.transform.localPosition = new ( + socket.Transform.localPosition = new ( _socketCollectionMargin + _socketRadius + middleAlignmentX + centeredMainBound.min.x + rowWidth * currentColumn, 0, _socketCollectionMargin + _socketRadius + middleAlignmentZ + centeredMainBound.min.z + rowDepth * currentRow @@ -237,20 +245,20 @@ private List ParseContent(string contents) private void PreSpawnContent(out AudioClip grabAudio, out AudioClip releaseAudio) { // We assume that all Slots have the same sound. Therefore fetching first only. - var firstSocket = _socketContainer.Sockets.First(); - grabAudio = firstSocket.AudioGrabbedFallback; - releaseAudio = firstSocket.AudioReleasedFallback; + var firstSocket = _sockets.Sockets.First(); + grabAudio = firstSocket.PlacedSoundFallback; + releaseAudio = firstSocket.RemovedSoundFallback; - foreach (var socket in _socketContainer.Sockets) + foreach (var socket in _sockets.Sockets) { - socket.AudioGrabbedFallback = null; - socket.AudioReleasedFallback = null; + socket.PlacedSoundFallback = null; + socket.RemovedSoundFallback = null; } } private IEnumerator SpawnContent(List contentItems) { - var sockets = _socketContainer.Sockets; + var sockets = _sockets.Sockets; if (contentItems.Count > sockets.Count) { @@ -282,10 +290,10 @@ private IEnumerator SpawnContent(List contentItems) private void PlaceObjectIntoContainer(VobContainer vobContainer) { - var grabbable = vobContainer.Go.GetComponentInChildren(true); - if (_socketContainer.TryFindAvailableSocket(grabbable, out var socket)) + var interactable = vobContainer.Go.GetComponentInChildren(true); + if (_sockets.TryFindFree(interactable, out var socket)) { - socket.TryGrab(grabbable, true, true); + socket.TryPlace(interactable, true); // We need to reset position as the element won't be placed inside it's parent in the chest. vobContainer.Go.transform.localPosition = Vector3.zero; } @@ -296,10 +304,10 @@ private IEnumerator PostSpawnContent(AudioClip grabAudio, AudioClip releaseAudio // We wait for some time to ensure the objects are automatically snapped into place. yield return new WaitForSeconds(1f); - foreach (var socket in _socketContainer.Sockets) + foreach (var socket in _sockets.Sockets) { - socket.AudioGrabbedFallback = grabAudio; - socket.AudioReleasedFallback = releaseAudio; + socket.PlacedSoundFallback = grabAudio; + socket.RemovedSoundFallback = releaseAudio; } } diff --git a/Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerPhysicsChest.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPhysicsChest.cs.meta similarity index 100% rename from Assets/Gothic-VR/Scripts/Adapters/Vob/Container/VRVobContainerPhysicsChest.cs.meta rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPhysicsChest.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPlayerInputs.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPlayerInputs.cs new file mode 100644 index 000000000..3d0965274 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPlayerInputs.cs @@ -0,0 +1,38 @@ +#if GOTHIC_HVR_INSTALLED +using HurricaneVR.Framework.ControllerInput; +using UnityEngine.InputSystem; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Keyboard bindings of HVR's locomotion inputs while UseWASD is set. Gothic inputs (menu, both grips) are in + /// VRPlayer. + /// + public class HvrPlayerInputs : HVRPlayerInputs + { + protected override bool GetIsJumpActivated() + { + if (UseWASD) + return Keyboard.current[Key.Space].wasPressedThisFrame; + + return RightController.PrimaryButtonState.JustActivated; + } + + protected override bool GetCrouch() + { + if (UseWASD) + return Keyboard.current[Key.Z].wasPressedThisFrame || Keyboard.current[Key.X].wasPressedThisFrame; + + return base.GetCrouch(); + } + + protected override bool GetSprinting() + { + if (UseWASD) + return Keyboard.current[Key.LeftShift].wasPressedThisFrame; + + return base.GetSprinting(); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerInputs.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPlayerInputs.cs.meta similarity index 100% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerInputs.cs.meta rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrPlayerInputs.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrRig.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrRig.cs new file mode 100644 index 000000000..80fafa37e --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrRig.cs @@ -0,0 +1,193 @@ +#if GOTHIC_HVR_INSTALLED +using System; +using System.Collections.Generic; +using Gothic.Core.Logging; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core.Grabbers; +using HurricaneVR.Framework.Core.Player; +using UnityEngine; +using Logger = Gothic.Core.Logging.Logger; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// IVrRig on top of HVR's player controller. Gothic logic (menu, control modes, ini settings) lives in VRPlayer + /// and VRContextInteractionService, not here. + /// + public class HvrRig : HVRPlayerController, IVrRig + { + private Camera _cameraComponent; + private List _handGrabbers; + + public event Action Teleported; + + Transform IVrRig.Root => transform; + Transform IVrRig.TrackingSpace => CameraRig.transform; + Transform IVrRig.Head => Camera; + Transform IVrRig.LeftHand => LeftControllerTransform; + Transform IVrRig.RightHand => RightControllerTransform; + Camera IVrRig.Camera => _cameraComponent ??= Camera.GetComponent(); + CharacterController IVrRig.CharacterController => CharacterController; + float IVrRig.CameraHeight => CameraHeight; + bool IVrRig.IsGrounded => IsGrounded; + bool IVrRig.IsClimbing => IsClimbing; + + bool IVrRig.MovementEnabled + { + get => MovementEnabled; + set => MovementEnabled = value; + } + + bool IVrRig.TurnEnabled + { + get => RotationEnabled; + set => RotationEnabled = value; + } + + bool IVrRig.TeleportEnabled + { + get => Teleporter.enabled; + set => Teleporter.enabled = value; + } + + bool IVrRig.CanJump + { + get => CanJump; + set => CanJump = value; + } + + bool IVrRig.CanCrouch + { + get => CanCrouch; + set => CanCrouch = value; + } + + bool IVrRig.CanSprint + { + get => CanSprint; + set => CanSprint = value; + } + + float IVrRig.Gravity + { + get => Gravity; + set => Gravity = value; + } + + float IVrRig.MaxFallSpeed + { + get => MaxFallSpeed; + set => MaxFallSpeed = value; + } + + float IVrRig.MoveSpeed + { + get => MoveSpeed; + set => MoveSpeed = value; + } + + float IVrRig.RunSpeed + { + get => RunSpeed; + set => RunSpeed = value; + } + + float IVrRig.StepOffset + { + get => CharacterController.stepOffset; + set => CharacterController.stepOffset = value; + } + + float IVrRig.FadeAlpha => ScreenFader ? ScreenFader.CurrentFade : 0f; + + IReadOnlyList IVrRig.HandGrabbers + { + get + { + if (_handGrabbers != null) + return _handGrabbers; + + _handGrabbers = new List(); + AddGrabber(LeftHand); + AddGrabber(LeftHand ? LeftHand.ForceGrabber : null); + AddGrabber(RightHand); + AddGrabber(RightHand ? RightHand.ForceGrabber : null); + return _handGrabbers; + } + } + + protected override void Awake() + { + base.Awake(); + + if (Teleporter) + Teleporter.PositionUpdate.AddListener(OnTeleporterPositionUpdate); + } + + private void OnTeleporterPositionUpdate(Vector3 feetPosition) + { + Teleported?.Invoke(feetPosition); + } + + public void ApplyComfortSettings(VrSitStand sitStand, VrMoveDirection direction, VrTurnType turn, + float snapDegrees, float smoothSpeed) + { + CameraRig.SetSitStandMode(sitStand.ToHvr()); + DirectionStyle = direction.ToHvr(); + RotationType = turn.ToHvr(); + SnapAmount = snapDegrees; + SmoothTurnSpeed = smoothSpeed; + } + + public void Teleport(Vector3 position, Quaternion rotation) + { + Teleporter.Teleport(position); + + // Changing the rotation inside HVRTeleporter didn't work for y-axis. Therefore, setting it now. + transform.rotation = rotation; + } + + public void Fade(float alpha, float speed) + { + if (ScreenFader) + ScreenFader.Fade(alpha, speed); + } + + public void SetGrabbingEnabled(bool isEnabled) + { + SetGrabbingEnabled(LeftHand, isEnabled); + SetGrabbingEnabled(RightHand, isEnabled); + } + + private void AddGrabber(HVRGrabberBase grabber) + { + if (grabber == null) + return; + + if (grabber.TryGetComponent(out IVrGrabber bridge)) + _handGrabbers.Add(bridge); + else + Logger.LogError($"[HVR] {grabber.name} has no HvrGrabberBridge. Its grab events are lost.", LogCat.VR); + } + + private static void SetGrabbingEnabled(HVRHandGrabber hand, bool isEnabled) + { + hand.AllowGrabbing = isEnabled; + hand.ForceGrabber.AllowGrabbing = isEnabled; + hand.AllowHovering = isEnabled; + hand.ForceGrabber.AllowHovering = isEnabled; + + // Disable hand animations. Basically open the hand fully if disabled. + if (!hand.HandAnimator || !hand.HandAnimator.CurrentPoser) + return; + + var poser = hand.HandAnimator.CurrentPoser; + if (poser.PrimaryPose != null) + poser.PrimaryPose.Disabled = !isEnabled; + + poser.Blends?.ForEach(i => i.Disabled = !isEnabled); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerController.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrRig.cs.meta similarity index 100% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRPlayerController.cs.meta rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrRig.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSfxPlayer.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSfxPlayer.cs new file mode 100644 index 000000000..7b7de6572 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSfxPlayer.cs @@ -0,0 +1,25 @@ +#if GOTHIC_HVR_INSTALLED +using System; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core.Utils; +using UnityEngine; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Uses HVR's SFXPlayer pool (HVRGlobal.prefab) until we have our own. + /// + public class HvrSfxPlayer : IVrSfxPlayer + { + public void Play(AudioClip clip, Vector3 position) + { + SFXPlayer.Instance.PlaySFX(clip, position); + } + + public void PlayWithCooldown(AudioClip clip, Vector3 position, Guid sourceId, float cooldownTime) + { + SFXPlayer.Instance.PlaySFXCooldown(clip, position, sourceId, cooldownTime: cooldownTime); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSfxPlayer.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSfxPlayer.cs.meta new file mode 100644 index 000000000..efb468b27 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSfxPlayer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7fefbe22b0814024f82d162925d76765 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrShoulderSocket.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrShoulderSocket.cs new file mode 100644 index 000000000..9a40be023 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrShoulderSocket.cs @@ -0,0 +1,12 @@ +#if GOTHIC_HVR_INSTALLED +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Shoulder holster with the same VobLoader re-parenting as HvrSocket. + /// HvrSocketBridge.IsShoulder detects it (VRBackpack refreshes its inventory when it's taken from a shoulder). + /// + public class HvrShoulderSocket : HvrSocket + { + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRShoulderSocket.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrShoulderSocket.cs.meta similarity index 100% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRShoulderSocket.cs.meta rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrShoulderSocket.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSimulatorControlsGUI.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSimulatorControlsGUI.cs similarity index 97% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSimulatorControlsGUI.cs rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSimulatorControlsGUI.cs index 623400d2d..a8cfcda4c 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSimulatorControlsGUI.cs +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSimulatorControlsGUI.cs @@ -2,13 +2,13 @@ using HurricaneVRExtensions.Simulator; using UnityEngine; -namespace Gothic.VR.Adapters.HVROverrides +namespace Gothic.VR.Interaction.Backends.Hvr { /// /// Overwritten to update some GUI elements. /// Unfortunately every method and property was private inside. We therefore need to overwrite everything. /// - public class VRSimulatorControlsGUI : HVRSimulatorControlsGUI + public class HvrSimulatorControlsGUI : HVRSimulatorControlsGUI { private HVRBodySimulator _vrBodySimulator; private HVRHandsSimulator _vrHandsSimulator; diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSimulatorControlsGUI.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSimulatorControlsGUI.cs.meta similarity index 100% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSimulatorControlsGUI.cs.meta rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSimulatorControlsGUI.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSocket.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocket.cs similarity index 98% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSocket.cs rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocket.cs index fa22e5deb..6a3566ffd 100644 --- a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSocket.cs +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocket.cs @@ -8,7 +8,7 @@ using UnityEngine; using ZenKit.Daedalus; -namespace Gothic.VR.Adapters.HVROverrides +namespace Gothic.VR.Interaction.Backends.Hvr { /// /// Our VobItems have the following structure: @@ -18,7 +18,7 @@ namespace Gothic.VR.Adapters.HVROverrides /// Problem is that HVR assumes the root of an object to be moved is the Grabbable GO. But on our end it's one level higher. /// This class therefore overwrites some logic to ensure, that our root with VobLoader (which will be used by e.g. Cullung) is the root. /// - public class VRSocket : HVRSocket + public class HvrSocket : HVRSocket { protected override void OnGrabbed(HVRGrabArgs args) { diff --git a/Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSocket.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocket.cs.meta similarity index 100% rename from Assets/Gothic-VR/Scripts/Adapters/HVROverrides/VRSocket.cs.meta rename to Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocket.cs.meta diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketBridge.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketBridge.cs new file mode 100644 index 000000000..b8cc44b2b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketBridge.cs @@ -0,0 +1,43 @@ +#if GOTHIC_HVR_INSTALLED +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core; +using HurricaneVR.Framework.Core.Grabbers; +using HurricaneVR.Framework.Core.Utils; +using UnityEngine; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Sits next to an HVRSocket (or a subclass like HvrSocket). Grabbed/Released are the "placed"/"removed" events. + /// + public class HvrSocketBridge : HvrGrabberBridge, IVrSocket + { + private HVRSocket Socket => (HVRSocket)Grabber; + + public Transform Transform => transform; + public bool IsOccupied => Socket.IsGrabbing; + public bool IsShoulder => Socket is HVRShoulderSocket or HvrShoulderSocket; + + public AudioClip PlacedSoundFallback + { + get => Socket.AudioGrabbedFallback; + set => Socket.AudioGrabbedFallback = value; + } + + public AudioClip RemovedSoundFallback + { + get => Socket.AudioReleasedFallback; + set => Socket.AudioReleasedFallback = value; + } + + public bool TryPlace(VrInteractable interactable, bool silent) + { + if (interactable == null || !interactable.TryGetComponent(out HVRGrabbable grabbable)) + return false; + + return Socket.TryGrab(grabbable, true, silent); + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketBridge.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketBridge.cs.meta new file mode 100644 index 000000000..be53bda43 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketBridge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 50fce3b6fdf41d541a8cb5f194cfd30a \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketContainerBridge.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketContainerBridge.cs new file mode 100644 index 000000000..dbcce81a4 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketContainerBridge.cs @@ -0,0 +1,78 @@ +#if GOTHIC_HVR_INSTALLED +using System.Collections.Generic; +using Gothic.Core.Logging; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core; +using HurricaneVR.Framework.Core.Sockets; +using UnityEngine; +using Logger = Gothic.Core.Logging.Logger; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + /// + /// Sits next to an HVRSocketContainer. Every socket of the container needs an HvrSocketBridge. + /// + public class HvrSocketContainerBridge : MonoBehaviour, IVrSocketContainer + { + private HVRSocketContainer _container; + + private HVRSocketContainer Container + { + get + { + if (_container == null) + _container = GetComponent(); + return _container; + } + } + + public IReadOnlyList Sockets + { + get + { + var result = new List(Container.Sockets.Count); + foreach (var hvrSocket in Container.Sockets) + { + var socket = GetSocket(hvrSocket); + if (socket != null) + result.Add(socket); + } + + return result; + } + } + + public bool TryFindFree(VrInteractable interactable, out IVrSocket socket) + { + socket = null; + if (interactable == null || !interactable.TryGetComponent(out HVRGrabbable grabbable)) + return false; + if (!Container.TryFindAvailableSocket(grabbable, out var hvrSocket)) + return false; + + socket = GetSocket(hvrSocket); + return socket != null; + } + + public bool TryAdd(VrInteractable interactable) + { + if (interactable == null || !interactable.TryGetComponent(out HVRGrabbable grabbable)) + return false; + + return Container.TryAddGrabbable(grabbable); + } + + private static IVrSocket GetSocket(Component hvrSocket) + { + if (hvrSocket == null) + return null; + + var socket = hvrSocket.GetComponent(); + if (socket == null) + Logger.LogError($"[HVR] Socket {hvrSocket.name} has no HvrSocketBridge.", LogCat.VR); + return socket; + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketContainerBridge.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketContainerBridge.cs.meta new file mode 100644 index 000000000..490fa9571 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrSocketContainerBridge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3698197d5ce58d542a61ce69122e3160 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrUiPointers.cs b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrUiPointers.cs new file mode 100644 index 000000000..c97cf8c7e --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrUiPointers.cs @@ -0,0 +1,41 @@ +#if GOTHIC_HVR_INSTALLED +using System.Linq; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using HurricaneVR.Framework.Core.UI; +using UnityEngine; +using UnityEngine.EventSystems; + +namespace Gothic.VR.Interaction.Backends.Hvr +{ + public class HvrUiPointers : IVrUiPointers + { + public void RegisterCanvas(Canvas canvas) + { + if (HVRInputModule.Instance != null) + HVRInputModule.Instance.AddCanvas(canvas); + } + + public void UnregisterCanvas(Canvas canvas) + { + if (HVRInputModule.Instance != null) + HVRInputModule.Instance.RemoveCanvas(canvas); + } + + public void RegisterAllCanvases() + { + // WARNING: FindObjectsByType looks through all opened scene trees, this can become quite slow. + var allCanvases = + Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.InstanceID); + HVRInputModule.Instance.UICanvases = allCanvases.ToList(); + } + + public bool TryGetHandSide(PointerEventData eventData, out VrHandSide side) + { + var pointer = HVRInputModule.Instance.Pointers.FirstOrDefault(i => i.PointerEventData == eventData); + side = pointer == null ? default : pointer.HandSide.ToVr(); + return pointer != null; + } + } +} +#endif diff --git a/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrUiPointers.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrUiPointers.cs.meta new file mode 100644 index 000000000..d4a14a043 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Backends/Hvr/HvrUiPointers.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: da83d5fb40f0a004ab1fd72648a45e9c \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Components.meta b/Assets/Gothic-VR/Scripts/Interaction/Components.meta new file mode 100644 index 000000000..b8f4465c7 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Components.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 16f7052a8ff00494ea3eb30e85ff472a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Scripts/Interaction/Components/VrInteractable.cs b/Assets/Gothic-VR/Scripts/Interaction/Components/VrInteractable.cs new file mode 100644 index 000000000..908a55e21 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Components/VrInteractable.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; +using UnityEngine; + +namespace Gothic.VR.Interaction.Components +{ + /// + /// Game-facing side of everything the player can grab or hover (items, mobs, NPCs, doors, backpack). + /// Adapters subscribe to its C# events instead of the VR backend's events. + /// A backend bridge (IVrInteractableBackend) on the same GameObject raises the events and does the work. + /// + /// Events are raised synchronously in the backend's order: HoverEntered, BeforeGrabbed, Grabbed, HoverExited, + /// Released. BeforeGrabbed is only raised for grabbers with a bridge (player hands and sockets). + /// + public class VrInteractable : MonoBehaviour + { + public event Action HoverEntered; + public event Action HoverExited; + public event Action BeforeGrabbed; + public event Action Grabbed; + public event Action Released; + + private IVrInteractableBackend _backend; + + /// + /// Held by any grabber (hand, distance grabber, socket). + /// + public bool IsHeld => Backend != null && Backend.IsHeld; + + public IReadOnlyList Colliders => Backend != null ? Backend.Colliders : Array.Empty(); + + private IVrInteractableBackend Backend + { + get + { + if (_backend == null) + _backend = GetComponent(); + return _backend; + } + } + + /// + /// The VrInteractable on this GameObject or (if none) the first one below it. + /// + public static VrInteractable Find(Component component) + { + var interactable = component.GetComponent(); + if (interactable == null) + interactable = component.GetComponentInChildren(true); + return interactable; + } + + /// + /// Releases the interactable from all grabbers. + /// + public void ForceRelease() + { + Backend?.ForceRelease(); + } + + /// + /// Re-collects the colliders (call after meshes/colliders were added at runtime). + /// + public void SetupColliders() + { + Backend?.SetupColliders(); + } + + /// + /// Sounds played when this interactable is put into or taken out of a socket. + /// + public void SetSocketSounds(AudioClip socketed, AudioClip unsocketed) + { + Backend?.SetSocketSounds(socketed, unsocketed); + } + + internal void RaiseHoverEntered(VrGrabArgs args) + { + HoverEntered?.Invoke(args); + } + + internal void RaiseHoverExited(VrGrabArgs args) + { + HoverExited?.Invoke(args); + } + + internal void RaiseBeforeGrabbed(VrGrabArgs args) + { + BeforeGrabbed?.Invoke(args); + } + + internal void RaiseGrabbed(VrGrabArgs args) + { + Grabbed?.Invoke(args); + } + + internal void RaiseReleased(VrGrabArgs args) + { + Released?.Invoke(args); + } + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Components/VrInteractable.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Components/VrInteractable.cs.meta new file mode 100644 index 000000000..2c12beb72 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Components/VrInteractable.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5165ad186aed3fb408c5d43079b20d34 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models.meta b/Assets/Gothic-VR/Scripts/Interaction/Models.meta new file mode 100644 index 000000000..ca85f8718 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b880831f62bf2d447adb6325ed4ec0e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrButton.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButton.cs new file mode 100644 index 000000000..7cf606c86 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButton.cs @@ -0,0 +1,15 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// Controller buttons we read in game code. The active VR backend maps them to the device buttons. + /// + public enum VrButton + { + Grip, + Trigger, + Primary, + Secondary, + Menu, + JoystickButton + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrButton.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButton.cs.meta new file mode 100644 index 000000000..96d07cc2c --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButton.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8c026c8910e7f494bbb5de7a3557734d \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrButtonState.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButtonState.cs new file mode 100644 index 000000000..738d661fd --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButtonState.cs @@ -0,0 +1,30 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// State of a controller button in the current frame. + /// + public readonly struct VrButtonState + { + /// + /// The button is held down. + /// + public readonly bool IsActive; + + /// + /// The button went down this frame. + /// + public readonly bool IsJustActivated; + + /// + /// The button went up this frame. + /// + public readonly bool IsJustDeactivated; + + public VrButtonState(bool isActive, bool isJustActivated, bool isJustDeactivated) + { + IsActive = isActive; + IsJustActivated = isJustActivated; + IsJustDeactivated = isJustDeactivated; + } + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrButtonState.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButtonState.cs.meta new file mode 100644 index 000000000..3d2310c1b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrButtonState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c88e863b76ceab849857f40deb620293 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabArgs.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabArgs.cs new file mode 100644 index 000000000..1fcec850b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabArgs.cs @@ -0,0 +1,41 @@ +using Gothic.VR.Interaction.Components; +using UnityEngine; + +namespace Gothic.VR.Interaction.Models +{ + /// + /// Payload of all grab, release and hover events (VrInteractable, IVrGrabber, IVrSocket). + /// + public readonly struct VrGrabArgs + { + /// + /// What grabbed (or released) the interactable. + /// + public readonly VrGrabberKind Kind; + + /// + /// The hand of the grabber. Only meaningful for Kind Hand and Distance; Left otherwise. + /// + public readonly VrHandSide HandSide; + + /// + /// The object that is grabbed, released or hovered. + /// + public readonly VrInteractable Interactable; + + /// + /// GameObject of the grabber (hand, socket, ...). Use GetComponent<IVrSocket>() for socket details. + /// + public readonly GameObject GrabberGo; + + public VrGrabArgs(VrGrabberKind kind, VrHandSide handSide, VrInteractable interactable, GameObject grabberGo) + { + Kind = kind; + HandSide = handSide; + Interactable = interactable; + GrabberGo = grabberGo; + } + + public bool IsHandOrDistance => Kind is VrGrabberKind.Hand or VrGrabberKind.Distance; + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabArgs.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabArgs.cs.meta new file mode 100644 index 000000000..6929f2466 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabArgs.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a47fcdb489238664a904c9a88c3297ca \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabberKind.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabberKind.cs new file mode 100644 index 000000000..43bd2b592 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabberKind.cs @@ -0,0 +1,28 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// What grabbed (or released) an interactable. + /// + public enum VrGrabberKind + { + /// + /// A hand grabbing directly. + /// + Hand, + + /// + /// A hand pulling an object from a distance (remote grab). The same object is grabbed by the Hand afterwards. + /// + Distance, + + /// + /// A socket: holster, backpack slot, chest slot, ... + /// + Socket, + + /// + /// Any other grabber of the backend, e.g. a collector that forwards items into a socket container. + /// + Other + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabberKind.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabberKind.cs.meta new file mode 100644 index 000000000..8b603377f --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrGrabberKind.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fafd204bff1d1d14191c07bfd3fb9b62 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSide.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSide.cs new file mode 100644 index 000000000..b8b18c21e --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSide.cs @@ -0,0 +1,14 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// A hand/controller of the VR player. + /// HINT: The lock picking events (GlobalEventDispatcher.LockPickCombo*) pass these values as int. + /// They differ from GlobalEventDispatcher.HandSide (None=0, Left=1, Right=2, Both=3). Use + /// VrHandSideExtensions to map between both. + /// + public enum VrHandSide + { + Left = 0, + Right = 1 + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSide.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSide.cs.meta new file mode 100644 index 000000000..3342049a2 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSide.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 246dfc7049342c34392fdb668551b85c \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSideExtensions.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSideExtensions.cs new file mode 100644 index 000000000..685dd51b3 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSideExtensions.cs @@ -0,0 +1,36 @@ +using Gothic.Core; + +namespace Gothic.VR.Interaction.Models +{ + /// + /// The only place where GlobalEventDispatcher.HandSide (fight events) and VrHandSide are mapped. + /// + public static class VrHandSideExtensions + { + /// + /// false for HandSide.None and HandSide.Both, as they have no single VR hand. + /// + public static bool TryToVrHandSide(this GlobalEventDispatcher.HandSide handSide, out VrHandSide vrHandSide) + { + switch (handSide) + { + case GlobalEventDispatcher.HandSide.Left: + vrHandSide = VrHandSide.Left; + return true; + case GlobalEventDispatcher.HandSide.Right: + vrHandSide = VrHandSide.Right; + return true; + default: + vrHandSide = default; + return false; + } + } + + public static GlobalEventDispatcher.HandSide ToHandSide(this VrHandSide vrHandSide) + { + return vrHandSide == VrHandSide.Left + ? GlobalEventDispatcher.HandSide.Left + : GlobalEventDispatcher.HandSide.Right; + } + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSideExtensions.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSideExtensions.cs.meta new file mode 100644 index 000000000..0ef669772 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHandSideExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 21fcabfad52958848a59f168ec14d816 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrHapticPreset.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHapticPreset.cs new file mode 100644 index 000000000..f9c2e8aba --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHapticPreset.cs @@ -0,0 +1,28 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// Vibration patterns. The VR backend defines amplitude, duration and frequency of each. + /// + public enum VrHapticPreset + { + /// + /// e.g., you are inside an interaction collider + /// + Info, + + /// + /// e.g., your lock pick rotation is invalid + /// + Warning, + + /// + /// e.g., your key is broken + /// + Error, + + /// + /// e.g., you opened a chest + /// + Success + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrHapticPreset.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHapticPreset.cs.meta new file mode 100644 index 000000000..4ef1cfb86 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrHapticPreset.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cd4d994077c26ea49a904516edc12339 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrMoveDirection.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrMoveDirection.cs new file mode 100644 index 000000000..2eef267e2 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrMoveDirection.cs @@ -0,0 +1,13 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// Which device defines "forward" for thumbstick movement. + /// HINT: Stored as int in Gothic.ini (VRConstants.IniNames.MoveDirection). Never change the values. + /// + public enum VrMoveDirection + { + Camera = 0, + LeftController = 1, + RightController = 2 + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrMoveDirection.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrMoveDirection.cs.meta new file mode 100644 index 000000000..1f3279a37 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrMoveDirection.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: aae46023bc545074093e3691112278b0 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrSitStand.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrSitStand.cs new file mode 100644 index 000000000..96e6ec9dc --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrSitStand.cs @@ -0,0 +1,13 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// How the camera height is calculated. + /// HINT: Stored as int in Gothic.ini (VRConstants.IniNames.SitStand). Never change the values. + /// + public enum VrSitStand + { + Sitting = 0, + Standing = 1, + PlayerHeight = 2 + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrSitStand.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrSitStand.cs.meta new file mode 100644 index 000000000..a79f7c1b7 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrSitStand.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5d8c6e1091c15294294f29ae420a7520 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrTurnType.cs b/Assets/Gothic-VR/Scripts/Interaction/Models/VrTurnType.cs new file mode 100644 index 000000000..8b35fa5fe --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrTurnType.cs @@ -0,0 +1,12 @@ +namespace Gothic.VR.Interaction.Models +{ + /// + /// Thumbstick turning. + /// HINT: Stored as int in Gothic.ini (VRConstants.IniNames.RotationType). Never change the values. + /// + public enum VrTurnType + { + Smooth = 0, + Snap = 1 + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Models/VrTurnType.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Models/VrTurnType.cs.meta new file mode 100644 index 000000000..e816770a0 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Models/VrTurnType.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a5df2400195474f4e8e30c2e737120cc \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports.meta new file mode 100644 index 000000000..4df4df9b0 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48501c38adb0d3f4aa48d8e8bf608c6e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs new file mode 100644 index 000000000..db7f50f42 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs @@ -0,0 +1,19 @@ +using Reflex.Core; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// A VR interaction framework that provides the implementations of our VR ports. + /// The active backend is selected by VRContextBootstrap. + /// + public interface IVrBackend + { + string Name { get; } + + /// + /// Registers the backend's implementations of IVrInput, IVrHaptics, IVrUiPointers and IVrSfxPlayer. + /// IVrRig isn't registered here, as it lives on the player prefab. + /// + void InstallBindings(ContainerBuilder containerBuilder); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs.meta new file mode 100644 index 000000000..9d6233c4b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrBackend.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 669e6e07f5d4e6f4b960ca635362a5da \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrGrabber.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrGrabber.cs new file mode 100644 index 000000000..895a353e0 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrGrabber.cs @@ -0,0 +1,35 @@ +using System; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// Something that grabs interactables: a hand, a distance grabber or a socket (see IVrSocket). + /// Implemented by a backend bridge next to the backend's grabber. + /// + public interface IVrGrabber + { + VrGrabberKind Kind { get; } + + /// + /// Only meaningful for Kind Hand and Distance. + /// + VrHandSide HandSide { get; } + + /// + /// The currently held interactable or null. + /// + VrInteractable Held { get; } + + /// + /// Raised before the backend moves the interactable (e.g. to turn its physics on). + /// + event Action BeforeGrabbed; + + event Action Grabbed; + event Action Released; + + void ForceRelease(); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrGrabber.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrGrabber.cs.meta new file mode 100644 index 000000000..045b46277 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrGrabber.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fb91eb2372e3e9a4494d7e1570d2bdfb \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHaptics.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHaptics.cs new file mode 100644 index 000000000..8404bf633 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHaptics.cs @@ -0,0 +1,12 @@ +using Gothic.VR.Interaction.Models; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// Controller vibration. Which game event uses which preset is decided by VrHapticsService. + /// + public interface IVrHaptics + { + void Vibrate(VrHandSide side, VrHapticPreset preset); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHaptics.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHaptics.cs.meta new file mode 100644 index 000000000..7b5e6ab62 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHaptics.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e89cb44f9439393478432e31ba5143ae \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHinge.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHinge.cs new file mode 100644 index 000000000..db138b212 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHinge.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// A physically rotating door or chest lid. + /// + public interface IVrHinge + { + Transform Transform { get; } + Rigidbody Rigidbody { get; } + + /// + /// Stops the hinge from rotating (locked door/chest). + /// + void Lock(); + + void Unlock(); + + /// + /// Sounds played by the hinge when it reaches its opened or closed position. + /// + void SetSounds(AudioClip opened, AudioClip closed); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHinge.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHinge.cs.meta new file mode 100644 index 000000000..900bb5e4e --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrHinge.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 23c023ef2afcd3e46b320519c47df4f1 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInput.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInput.cs new file mode 100644 index 000000000..89ceab4aa --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInput.cs @@ -0,0 +1,29 @@ +using Gothic.VR.Interaction.Models; +using UnityEngine; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// Raw controller input of the VR player. Gothic-specific inputs (menu, both grips) are derived from it in + /// VRPlayer. + /// + public interface IVrInput + { + /// + /// The player is controlled by keyboard and mouse instead of controllers. + /// + bool IsSimulator { get; } + + VrButtonState GetButton(VrHandSide side, VrButton button); + + /// + /// Velocity of the tracked controller, relative to IVrRig.TrackingSpace. + /// + Vector3 GetControllerVelocity(VrHandSide side); + + /// + /// Activates the desktop device simulator (DeveloperConfig.EnableVRDeviceSimulator). + /// + void SetDeviceSimulatorActive(bool isActive); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInput.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInput.cs.meta new file mode 100644 index 000000000..26cb8bb61 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInput.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 12b04bb49dbca634da470d5ce5f7f4e1 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInteractableBackend.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInteractableBackend.cs new file mode 100644 index 000000000..b842a3684 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInteractableBackend.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// Implemented by the backend bridge next to a VrInteractable. Game code uses VrInteractable instead. + /// The bridge also raises the VrInteractable events. + /// + public interface IVrInteractableBackend + { + bool IsHeld { get; } + IReadOnlyList Colliders { get; } + void ForceRelease(); + void SetupColliders(); + void SetSocketSounds(AudioClip socketed, AudioClip unsocketed); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInteractableBackend.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInteractableBackend.cs.meta new file mode 100644 index 000000000..26ad4fca1 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrInteractableBackend.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3fb0750b3fe7c2543a407b5765e78c03 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrRig.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrRig.cs new file mode 100644 index 000000000..cb7dd7524 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrRig.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using Gothic.VR.Interaction.Models; +using UnityEngine; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// The VR player body: tracked head/controllers, character controller, locomotion and screen fade. + /// Implemented by the active VR backend, which lives on the player prefab root. + /// + public interface IVrRig + { + /// + /// Root of the player. Moved by locomotion and teleports, rotated by thumbstick turning. + /// + Transform Root { get; } + + /// + /// Origin of the tracked devices. Controller velocities (IVrInput) are relative to it. + /// + Transform TrackingSpace { get; } + + Transform Head { get; } + + /// + /// Tracked controller pose (not the physics hand, which can be blocked by colliders). + /// + Transform LeftHand { get; } + + /// + /// Tracked controller pose (not the physics hand, which can be blocked by colliders). + /// + Transform RightHand { get; } + + Camera Camera { get; } + CharacterController CharacterController { get; } + float CameraHeight { get; } + bool IsGrounded { get; } + bool IsClimbing { get; } + + bool MovementEnabled { get; set; } + bool TurnEnabled { get; set; } + bool TeleportEnabled { get; set; } + bool CanJump { get; set; } + bool CanCrouch { get; set; } + bool CanSprint { get; set; } + float Gravity { get; set; } + float MaxFallSpeed { get; set; } + float MoveSpeed { get; set; } + float RunSpeed { get; set; } + float StepOffset { get; set; } + + /// + /// Current screen fade. 0 = clear, 1 = black. + /// + float FadeAlpha { get; } + + /// + /// Direct (Hand) and distance grabbers of both hands. + /// + IReadOnlyList HandGrabbers { get; } + + /// + /// Raised with the new feet position whenever the player is teleported. + /// + event Action Teleported; + + void ApplyComfortSettings(VrSitStand sitStand, VrMoveDirection direction, VrTurnType turn, float snapDegrees, + float smoothSpeed); + + void Teleport(Vector3 position, Quaternion rotation); + + /// + /// Grabbing and hovering of both hands (direct and distance). Disabled hands are fully opened. + /// + void SetGrabbingEnabled(bool isEnabled); + + /// + /// Fades the screen towards alpha (0 = clear, 1 = black) with speed alpha per second. + /// + void Fade(float alpha, float speed); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrRig.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrRig.cs.meta new file mode 100644 index 000000000..f825eb8ad --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrRig.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9c7861897b60cc14ba5ca42daef209ab \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSfxPlayer.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSfxPlayer.cs new file mode 100644 index 000000000..321bf89a9 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSfxPlayer.cs @@ -0,0 +1,18 @@ +using System; +using UnityEngine; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// Fire-and-forget 3D sounds of the VR player (weapon swings, swimming) from a pool of audio sources. + /// + public interface IVrSfxPlayer + { + void Play(AudioClip clip, Vector3 position); + + /// + /// Plays only if no sound with the same sourceId was started within the last cooldownTime seconds. + /// + void PlayWithCooldown(AudioClip clip, Vector3 position, Guid sourceId, float cooldownTime); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSfxPlayer.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSfxPlayer.cs.meta new file mode 100644 index 000000000..e939dcd53 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSfxPlayer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cfadb32e026120749b24a865f85c11a8 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocket.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocket.cs new file mode 100644 index 000000000..4455dd125 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocket.cs @@ -0,0 +1,36 @@ +using Gothic.VR.Interaction.Components; +using UnityEngine; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// A slot that holds one interactable: hip holster, shoulder, backpack slot, chest slot, NPC loot slot. + /// Grabbed/Released (IVrGrabber) are raised when an interactable is placed into or taken out of it. + /// + public interface IVrSocket : IVrGrabber + { + Transform Transform { get; } + bool IsOccupied { get; } + + /// + /// True for over-the-shoulder sockets (the backpack and the right shoulder holster). + /// + bool IsShoulder { get; } + + /// + /// Places the interactable into this socket, ignoring the socket's filters. + /// + /// If true, no "placed" sound is played. + bool TryPlace(VrInteractable interactable, bool silent); + + /// + /// Played when an interactable without own socket sounds is placed. + /// + AudioClip PlacedSoundFallback { get; set; } + + /// + /// Played when an interactable without own socket sounds is removed. + /// + AudioClip RemovedSoundFallback { get; set; } + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocket.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocket.cs.meta new file mode 100644 index 000000000..31adbb96b --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocket.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0bd9577d17152d741a3534bc69986541 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocketContainer.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocketContainer.cs new file mode 100644 index 000000000..f390f511a --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocketContainer.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Gothic.VR.Interaction.Components; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// A group of sockets (backpack inventory, chest content). + /// + public interface IVrSocketContainer + { + IReadOnlyList Sockets { get; } + + /// + /// Finds the first free socket which accepts the interactable. + /// + bool TryFindFree(VrInteractable interactable, out IVrSocket socket); + + /// + /// Places the interactable into the first free socket which accepts it (with sound). + /// + bool TryAdd(VrInteractable interactable); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocketContainer.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocketContainer.cs.meta new file mode 100644 index 000000000..6b13c90bb --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrSocketContainer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cc17349213c5e6b4a8214b45d95b5bc8 \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrUiPointers.cs b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrUiPointers.cs new file mode 100644 index 000000000..e55ad58ef --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrUiPointers.cs @@ -0,0 +1,25 @@ +using Gothic.VR.Interaction.Models; +using UnityEngine; +using UnityEngine.EventSystems; + +namespace Gothic.VR.Interaction.Ports +{ + /// + /// The UI laser pointers of both controllers. They only hit registered canvases. + /// + public interface IVrUiPointers + { + void RegisterCanvas(Canvas canvas); + void UnregisterCanvas(Canvas canvas); + + /// + /// Registers every canvas of all loaded scenes (also inactive ones). Slow, call it on scene changes only. + /// + void RegisterAllCanvases(); + + /// + /// Which hand's pointer raised the UI event. false if it came from no VR pointer. + /// + bool TryGetHandSide(PointerEventData eventData, out VrHandSide side); + } +} diff --git a/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrUiPointers.cs.meta b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrUiPointers.cs.meta new file mode 100644 index 000000000..74cd47ee8 --- /dev/null +++ b/Assets/Gothic-VR/Scripts/Interaction/Ports/IVrUiPointers.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 12b93e4e3dc831f45a3bbff9e0c2e7cb \ No newline at end of file diff --git a/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs b/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs index 049283d4b..766db0e4f 100644 --- a/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs +++ b/Assets/Gothic-VR/Scripts/ReflexVRSceneInstaller.cs @@ -1,8 +1,10 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; +using Gothic.Core.Logging; +using Gothic.VR.Adapters.Context; using Gothic.VR.Services; using Reflex.Core; using UnityEngine; +using Logger = Gothic.Core.Logging.Logger; namespace Gothic.VR { @@ -15,6 +17,14 @@ public void InstallBindings(ContainerBuilder containerBuilder) { containerBuilder.OnContainerBuilt += (container) => ReflexProjectInstaller.DIContainer = container; + // VR ports (IVrInput, IVrHaptics, ...) come from the active backend. + // Without a backend, nothing is registered and VRContextBootstrap fails the boot with a clear error. + var backend = VRContextBootstrap.SelectBackend(); + if (backend == null) + Logger.LogError("No VR backend available. VR ports aren't registered.", LogCat.VR); + else + backend.InstallBindings(containerBuilder); + containerBuilder.AddSingleton(typeof(VRPlayerService)); containerBuilder.AddSingleton(typeof(VRWeaponService)); containerBuilder.AddSingleton(typeof(VrHapticsService)); @@ -23,4 +33,3 @@ public void InstallBindings(ContainerBuilder containerBuilder) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs b/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs index 52a96c02b..710d1985b 100644 --- a/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs +++ b/Assets/Gothic-VR/Scripts/Services/Context/VRContextDialogService.cs @@ -1,5 +1,4 @@ -#if GOTHIC_HVR_INSTALLED -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Gothic.Core.Const; using Gothic.Core.Models.Dialog; @@ -28,7 +27,7 @@ private VRDialog GetDialog() scene = SceneManager.GetActiveScene(); } - // We need to look through all RootGOs and fetch the first matching HVRDialog Component. + // We need to look through all RootGOs and fetch the first matching VRDialog Component. _dialogComponent = scene.GetRootGameObjects() .Select(i => i.GetComponentInChildren(true)) .First(i => i != null); @@ -69,4 +68,3 @@ public void FillDialog(NpcInstance instance, List dialogOptions) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs b/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs index a2473cca4..f04cb3bef 100644 --- a/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs +++ b/Assets/Gothic-VR/Scripts/Services/Context/VRContextInteractionService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Linq; using Gothic.Core; using Gothic.Core.Const; @@ -10,12 +9,11 @@ using Gothic.Core.Services.Caches; using Gothic.Core.Services.Config; using Gothic.Core.Services.Context; -using Gothic.VR.Adapters.HVROverrides; using Gothic.VR.Adapters.Marvin; using Gothic.VR.Adapters.Player; using Gothic.VR.Adapters.UI; -using HurricaneVR.Framework.Core.UI; -using HurricaneVRExtensions.Simulator; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; using UnityEngine; using UnityEngine.EventSystems; @@ -33,18 +31,35 @@ public class VRContextInteractionService : IContextInteractionService [Inject] private readonly VRWeaponService _vrWeaponService; [Inject] private readonly VRCinemaService _vrCinemaService; [Inject] private readonly MarvinService _marvinService; + [Inject] private readonly IVrInput _vrInput; + [Inject] private readonly IVrUiPointers _vrUiPointers; + [Inject] private readonly IVrHaptics _vrHaptics; private const string _contextName = "VR"; + // Meters per second the player is pulled back when they ended up beyond KeepPlayerWithin's radius. private const float _keepWithinPullBackSpeed = 1f; + // Share of the normal speed left at KeepPlayerWithin's radius for walking back in or sideways. private const float _keepWithinMinSpeed = 0.25f; - private VRPlayerController _playerController; + private IVrRig _rig; + private VRPlayer _player; + private float _defaultStepOffset; private GameObject _marvinRoot; private int _keepWithinLastFrame = -1; private Vector3 _keepWithinLastPosition; + /// + /// The player body of the active VR backend. null before SetupPlayerController(). + /// + public IVrRig Rig => _rig; + + /// + /// Gothic side of the player prefab (menu, Gothic inputs). null before SetupPlayerController(). + /// + public VRPlayer Player => _player; + public VRContextInteractionService() { this.Inject(); @@ -56,7 +71,7 @@ public VRContextInteractionService() GlobalEventDispatcher.GothicInisInitialized.AddListener(() => { SetRenderDistance(_configService.Gothic.IniVisualRange); - _playerController.SetNormalControls(); + ApplyComfortSettings(); }); GlobalEventDispatcher.PlayerPrefUpdated.AddListener(PlayerPrefsUpdated); GlobalEventDispatcher.MarvinModeChanged.AddListener(OnMarvinModeChanged); @@ -71,7 +86,7 @@ public string GetContextName() private void OnLoadingSceneLoaded() { // Needed for: World -> Open MainMenu -> Hit "Load"/"New Game" - _playerController.MenuHandler.gameObject.SetActive(false); + _player.MenuHandler.gameObject.SetActive(false); } public float GetFrameRate() @@ -93,14 +108,15 @@ public void SetupPlayerController(DeveloperConfig developerConfig) // We call this method once at the very beginning of game start. We can safely assume we are in the Player.unity scene. var activeScene = SceneManager.GetActiveScene(); - // HVR Player - _playerController = activeScene.GetComponentInChildren(true)!; - _playerController.transform.parent.parent.gameObject.SetActive(true); - _playerController.SetNormalControls(true); + // VR Player: Gothic part and the backend's rig live on the same GameObject. + _player = activeScene.GetComponentInChildren(true)!; + _rig = _player.GetComponent(); + _player.transform.parent.parent.gameObject.SetActive(true); + _defaultStepOffset = _rig.StepOffset; + ApplyComfortSettings(true); // XRDeviceSimulator - var simulatorGO = activeScene.GetComponentInChildren(true)!; - simulatorGO.gameObject.SetActive(developerConfig.EnableVRDeviceSimulator); + _vrInput.SetDeviceSimulatorActive(developerConfig.EnableVRDeviceSimulator); // Marvin Mode _marvinRoot = activeScene.GetComponentInChildren(true)!.gameObject; @@ -124,94 +140,149 @@ private void OnMarvinLogoPoked(PointerEventData eventData) if (!_marvinService.IsActivationInputActive) return; - var pointer = HVRInputModule.Instance.Pointers.FirstOrDefault(i => i.PointerEventData == eventData); - if (pointer == null) + if (!_vrUiPointers.TryGetHandSide(eventData, out var handSide)) { Logger.LogWarning("[VRContextInteractionService] No VR pointer found for the Marvin logo click.", LogCat.Ui); return; } - ReflexProjectInstaller.DIContainer.Resolve() - .Vibrate(pointer.HandSide, VrHapticsService.VibrationType.Info); + _vrHaptics.Vibrate(handSide, VrHapticPreset.Info); } - + private void PlayerPrefsUpdated(string key, object value) { if (key == GothicIniConfig.IniKeyVisualRange) { SetRenderDistance(int.Parse((string)value)); } + else if (key == VRConstants.IniNames.MoveDirection || + key == VRConstants.IniNames.RotationType || + key == VRConstants.IniNames.SnapRotationAmount || + key == VRConstants.IniNames.SmoothRotationSpeed || + key == VRConstants.IniNames.SitStand) + { + // Just update everything. + ApplyComfortSettings(); + } } - private void SetRenderDistance(int value) + /// + /// Sit/stand, move direction and turning from Gothic.ini. + /// + /// Our player is created before Gothic inis are loaded. We therefore need + /// to set some default values. + private void ApplyComfortSettings(bool useDefaultValues = false) { - // Starting with value=0 (20%) and ending with value=14 (300%) - _playerController.Camera.GetComponent().farClipPlane = GothicIniConfig.IniVisualRangeFactor * (value + 1); - } + if (useDefaultValues) + { + _rig.ApplyComfortSettings(VrSitStand.PlayerHeight, VrMoveDirection.Camera, VrTurnType.Snap, 45f, 90f); + return; + } - public GameObject GetCurrentPlayerController() - { - return _playerController.gameObject; + var gothicIni = _configService.Gothic; + var sitStand = (VrSitStand)gothicIni.GetInt(VRConstants.IniNames.SitStand, (int)VrSitStand.PlayerHeight); + var moveDirection = + (VrMoveDirection)gothicIni.GetInt(VRConstants.IniNames.MoveDirection, (int)VrMoveDirection.Camera); + var turnType = (VrTurnType)gothicIni.GetInt(VRConstants.IniNames.RotationType, (int)VrTurnType.Snap); + + var snapSetting = gothicIni.GetInt(VRConstants.IniNames.SnapRotationAmount, + VRConstants.SnapRotationDefaultValue); + // e.g., 20° = 5° + 3*5° + var snapDegrees = VRConstants.SnapRotationAmountSettingTickAmount + + VRConstants.SnapRotationAmountSettingTickAmount * snapSetting; + + var smoothSetting = gothicIni.GetFloat(VRConstants.IniNames.SmoothRotationSpeed, + VRConstants.SmoothRotationDefaultValue); + // e.g., 50 = 5 + 90 * 0.5f + var smoothSpeed = VRConstants.SmoothRotationMinSpeed + + VRConstants.SmoothRotationMaxAdditionalSpeed * smoothSetting; + + _rig.ApplyComfortSettings(sitStand, moveDirection, turnType, snapDegrees, smoothSpeed); } - public VRPlayerController GetVRPlayerController() + private void SetRenderDistance(int value) { - return _playerController; + // Starting with value=0 (20%) and ending with value=14 (300%) + _rig.Camera.farClipPlane = GothicIniConfig.IniVisualRangeFactor * (value + 1); } - public VRPlayerInputs GetVRPlayerInputs() + public GameObject GetCurrentPlayerController() { - return _playerController.VrInputs; + return _player.gameObject; } + /// + /// Disable certain actions to keep player stuck in current position. + /// public void LockPlayerInPlace() { - _playerController.SetLockedControls(); + // HINT: Disable physics + // We can't disable physics as it would prevent the teleport from finishing (HVR checks for IsGrounded + // every frame). Therefore, we need to ground the player always on a plane and disable movement only. + _rig.MovementEnabled = false; + _rig.TurnEnabled = false; + _rig.TeleportEnabled = false; } public void UnlockPlayer() { - _playerController.SetUnlockedControls(); + _rig.MovementEnabled = true; + _rig.TurnEnabled = true; + _rig.TeleportEnabled = true; } public void SetWalkingControls() { - _playerController.SetWalkingControls(); + _rig.SetGrabbingEnabled(true); + + _rig.CanCrouch = true; + _rig.CanJump = true; + _rig.TeleportEnabled = true; + _rig.StepOffset = _defaultStepOffset; } public void SetWaterWalkingControls() { - _playerController.SetWaterWalkingControls(); + _rig.SetGrabbingEnabled(true); + + _rig.CanCrouch = false; + _rig.CanJump = false; + _rig.TeleportEnabled = false; + _rig.StepOffset = _player.SwimDiveStepHeight; } public void SetSwimmingControls() { - _playerController.SetSwimmingControls(); + // Disable grabbing of objects (as in G1) + _rig.SetGrabbingEnabled(false); + + _rig.CanCrouch = false; + _rig.CanJump = false; + _rig.TeleportEnabled = false; + _rig.StepOffset = _player.SwimDiveStepHeight; } public void SetDivingControls() { - _playerController.SetDivingControls(); + // Same as swimming. Vertical movement is done by VRSwimDive. + SetSwimmingControls(); } public void TeleportPlayerTo(Vector3 position, Quaternion rotation = default) { - _playerController.Teleporter.Teleport(position); - - // Changing the rotation inside HVRTeleporter didn't work for y-axis. Therefore, setting it now. - _playerController.transform.rotation = rotation; + _rig.Teleport(position, rotation); } public void KeepPlayerWithin(Vector3 center, float softRadius, float radius) { - var controller = _playerController != null ? _playerController.CharacterController : null; + var controller = _rig?.CharacterController; if (controller == null) return; // The frame's movement is read from the position of the previous call. After a gap (new dialog, a frame // without a call) there is nothing to compare against. - var position = _playerController.transform.position; + var position = _rig.Root.position; var frameMovement = _keepWithinLastFrame == Time.frameCount - 1 ? position - _keepWithinLastPosition : Vector3.zero; @@ -219,7 +290,7 @@ public void KeepPlayerWithin(Vector3 center, float softRadius, float radius) _keepWithinLastPosition = position; // Falling or on a ladder: a sideways push would fight gravity/the climbing hands. - if (!_playerController.IsGrounded || _playerController.IsClimbing) + if (!_rig.IsGrounded || _rig.IsClimbing) return; var offset = position - center; @@ -253,43 +324,41 @@ public void KeepPlayerWithin(Vector3 center, float softRadius, float radius) return; controller.Move(correction); - _keepWithinLastPosition = _playerController.transform.position; + _keepWithinLastPosition = _rig.Root.position; } public void InitUIInteraction() { - // Find all ui canvases and add to HVR Input module (To activate red laser pointer for clicking/grabbing) - // WARNING: As it leverages FindObjectsOfType which looks through all opened scenes trees, this can become quite slow. Execute very carefully! - var allCanvases = Object.FindObjectsOfType(true); - HVRInputModule.Instance.UICanvases = allCanvases.ToList(); + // Find all ui canvases and add them to the laser pointers (to activate the red laser for clicking/grabbing) + // WARNING: This looks through all opened scene trees and can become quite slow. Execute very carefully! + _vrUiPointers.RegisterAllCanvases(); } public void IntroduceChapter(string chapter, string text, string texture, string wav, int time) { var playerScene = SceneManager.GetSceneByName(Constants.ScenePlayer); - + // Check if we already loaded the Chapter change prefab var chapterPrefab = playerScene.GetRootGameObjects() .FirstOrDefault(i => i.GetComponentInChildren()); - + if (chapterPrefab == null) { chapterPrefab = _resourceCacheService.TryGetPrefabObject(PrefabType.StoryIntroduceChapter); SceneManager.MoveGameObjectToScene(chapterPrefab, playerScene); } - + chapterPrefab.GetComponent().DisplayIntroduction(chapter, text, texture, wav, time); } public void DisableMenus() { - _playerController.VrInputs.IsMenuButtonEnabled = false; + _player.IsMenuButtonEnabled = false; } public void EnableMenus() { - _playerController.VrInputs.IsMenuButtonEnabled = true; + _player.IsMenuButtonEnabled = true; } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs b/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs index c1af0a34c..4b8c4b730 100644 --- a/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs +++ b/Assets/Gothic-VR/Scripts/Services/Context/VRContextMenuService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using System.Linq; using Gothic.Core.Model.UI.Menu; @@ -9,7 +8,7 @@ using Gothic.Core; using Gothic.Core.Const; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core.Player; +using Gothic.VR.Interaction.Models; using Reflex.Attributes; using UnityEngine; using ZenKit.Daedalus; @@ -112,7 +111,7 @@ private AbstractMenuItemInstance CreateSitStandLabel(AbstractMenuInstance gameMe var sitStandSetting = new MutableMenuItemInstance("MENUITEM_GOTHIC_OPT_VR_ACCESSIBILITY_SIT_STAND_CHOICE", subtitlesChoice); sitStandSetting.PosY = posY; - sitStandSetting.SetUserFloat(3, (int)HVRSitStand.PlayerHeight); // Default value if no INI value exists. + sitStandSetting.SetUserFloat(3, (int)VrSitStand.PlayerHeight); // Default value if no INI value exists. sitStandSetting.SetText(0, _localizationService.GetText("menuitem.sitStand.value")); sitStandSetting.OnChgSetOption = VRConstants.IniNames.SitStand; @@ -167,7 +166,7 @@ private AbstractMenuItemInstance CreateRotationTypeChoicebox(AbstractMenuInstanc var rotationTypeSetting = new MutableMenuItemInstance("MENUITEM_GOTHIC_OPT_VR_ACCESSIBILITY_ROTATION_TYPE_CHOICE", subtitlesChoice); rotationTypeSetting.PosY = posY; - rotationTypeSetting.SetUserFloat(3, (int)RotationType.Snap); // Default value if no INI value exists. + rotationTypeSetting.SetUserFloat(3, (int)VrTurnType.Snap); // Default value if no INI value exists. rotationTypeSetting.SetText(0, _localizationService.GetText("menuitem.rotationType.value")); rotationTypeSetting.OnChgSetOption = VRConstants.IniNames.RotationType; @@ -382,4 +381,3 @@ private MutableMenuItemInstance CreateImmersionBackButton(AbstractMenuInstance m } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs b/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs index 8755918d7..aeb08c265 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRCinemaService.cs @@ -1,9 +1,8 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Logging; using Gothic.Core.Services.Context; using Gothic.Core.Services.Player; -using Gothic.VR.Adapters.HVROverrides; +using Gothic.VR.Adapters.Player; using Reflex.Attributes; using Logger = Gothic.Core.Logging.Logger; @@ -35,7 +34,7 @@ public void Play(string fileName) } var playerController = _contextInteractionService.GetCurrentPlayerController(); - var cinema = playerController == null ? null : playerController.GetComponent().Cinema; + var cinema = playerController == null ? null : playerController.GetComponent().Cinema; if (cinema == null) { Logger.LogWarning($"[VRCinema] No cinema on the player - '{fileName}' skipped.", LogCat.VR); @@ -48,4 +47,3 @@ public void Play(string fileName) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs b/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs index 4959d1865..6ffd16d19 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRPlayerService.cs @@ -1,10 +1,8 @@ -#if GOTHIC_HVR_INSTALLED -using Gothic.Core.Adapters.Vob; +using Gothic.Core.Adapters.Vob; using Gothic.Core.Logging; using Gothic.Core.Services.Context; using Gothic.Core.Services.Player; using Gothic.Core.Services.Vobs; -using Gothic.VR.Adapters.HVROverrides; using Gothic.VR.Services.Context; using Gothic.Core; using Gothic.Core.Services; @@ -13,9 +11,8 @@ using Gothic.Core.Models.Container; using Gothic.Core.Services.Caches; using Gothic.Core.Services.Npc; -using HurricaneVR.Framework.Core; -using HurricaneVR.Framework.Core.Grabbers; -using HurricaneVR.Framework.Shared; +using Gothic.VR.Interaction.Components; +using Gothic.VR.Interaction.Models; using Reflex.Attributes; using UnityEngine; using ZenKit.Vobs; @@ -24,7 +21,7 @@ namespace Gothic.VR.Services { /// - /// Contains global states about Hurricane VR player. + /// Contains global states about the VR player (items in hands). /// public class VRPlayerService { @@ -35,8 +32,6 @@ public class VRPlayerService public VRContextInteractionService VRContextInteractionService => _contextInteractionService.GetImpl(); - public VRPlayerInputs VRPlayerInputs => VRContextInteractionService.GetVRPlayerInputs(); - public GameObject GrabbedItemLeft; public GameObject GrabbedItemRight; @@ -48,18 +43,16 @@ public enum HandType public bool IsDualGrabbed => GrabbedItemLeft != null && GrabbedItemLeft == GrabbedItemRight; - public void SetGrab(HVRGrabberBase grabber, HVRGrabbable grabbable) + /// + /// An item was grabbed by a hand (directly or by distance). Sockets and other grabbers are ignored. + /// + public void SetGrab(VrGrabArgs args) { - HVRHandGrabber handGrabber; - if (grabber is HVRForceGrabber forceGrabber) - handGrabber = forceGrabber.HandGrabber; - else - handGrabber = grabber as HVRHandGrabber; - - if (handGrabber == null) + if (!args.IsHandOrDistance) return; - if (handGrabber.IsLeftHand) + var grabbable = args.Interactable; + if (args.HandSide == VrHandSide.Left) { // If we did remote grabbing, this function is called twice (remote grabber+hand grabber). // As we already count remote grabbing as "in inventory", we skip it the second time. @@ -88,20 +81,17 @@ public void SetGrab(HVRGrabberBase grabber, HVRGrabbable grabbable) _playerService.AddItem(instanceName, vobItem.Amount); } - public void UnsetGrab(HVRGrabberBase grabber, HVRGrabbable grabbable) + /// + /// An item was released by a hand (directly or by distance). Sockets and other grabbers are ignored. + /// + public void UnsetGrab(VrGrabArgs args) { - var dualGrabPrev = IsDualGrabbed; - - HVRHandGrabber handGrabber; - if (grabber is HVRForceGrabber forceGrabber) - handGrabber = forceGrabber.HandGrabber; - else - handGrabber = grabber as HVRHandGrabber; - - if (handGrabber == null) + if (!args.IsHandOrDistance) return; - if (handGrabber.IsLeftHand) + var dualGrabPrev = IsDualGrabbed; + var grabbable = args.Interactable; + if (args.HandSide == VrHandSide.Left) { // If we did remote grabbing, this function is called twice (remote grabber+hand grabber). // As we already count remote grabbing as "in inventory", we skip it the second time. @@ -134,13 +124,12 @@ public void UnsetGrab(HVRGrabberBase grabber, HVRGrabbable grabbable) /// The player collides with VobItems (stuck at a sword in the ground like in Gothic). Items in our hands or /// sockets (hips, back) would push our own CharacterController, so they ignore it while being held. /// - public void IgnorePlayerCollision(HVRGrabbable grabbable, bool ignore) + public void IgnorePlayerCollision(VrInteractable grabbable, bool ignore) { - var playerController = _contextInteractionService.GetCurrentPlayerController(); - if (playerController == null) + var characterController = VRContextInteractionService.Rig?.CharacterController; + if (characterController == null) return; - var characterController = playerController.GetComponent().CharacterController; foreach (var itemCollider in grabbable.Colliders) { if (itemCollider != null) @@ -148,16 +137,6 @@ public void IgnorePlayerCollision(HVRGrabbable grabbable, bool ignore) } } - public HVRController GetHand(HVRHandSide side) - { - if (side == HVRHandSide.Left) - return _contextInteractionService.GetCurrentPlayerController().GetComponent() - .LeftHand.Controller; - else - return _contextInteractionService.GetCurrentPlayerController().GetComponent() - .RightHand.Controller; - } - /// /// The hero grabbed a mob (wheel, lever, ...). The logic is platform neutral (MobInteractionService), /// only the dialog anchor next to the mob is VR specific. @@ -200,4 +179,3 @@ private static GameObject CreateMobDialogAnchor(VobLoader loader) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs b/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs index edafd4800..5d607fecf 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRUiOnTopService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using System.Collections.Generic; using Gothic.Core; using Gothic.VR.Adapters.Player; @@ -56,4 +55,3 @@ private void UpdateHands() } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs b/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs index 38e9d54aa..751f9e153 100644 --- a/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VRWeaponService.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Adapters.Vob.Item; using Gothic.Core.Const; @@ -7,10 +6,10 @@ using Gothic.Core.Models.Vm; using Gothic.Core.Services.Player; using Gothic.VR.Domain.Player; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Gothic.VR.Models.Vob; using Gothic.Core.Extensions; -using HurricaneVR.Framework.Core.Utils; -using HurricaneVR.Framework.Shared; using Reflex.Attributes; using UnityEngine; @@ -28,6 +27,7 @@ public class VRWeaponService [Inject] private AudioService _audioService; [Inject] private PlayerService _playerService; + [Inject] private IVrSfxPlayer _vrSfxPlayer; private readonly VrWeaponAttackDomain _firstAttackDomain = new VrWeaponAttackDomain().Inject(); private readonly VrWeaponAttackDomain _secondAttackDomain = new VrWeaponAttackDomain().Inject(); @@ -45,7 +45,7 @@ public void FixedUpdate() _secondAttackDomain.FixedUpdate(); } - public void OnGrabbed(HVRHandSide handSide, VobContainer vobContainer, WeaponPhysicsConfig weaponConfig) + public void OnGrabbed(VrHandSide handSide, VobContainer vobContainer, WeaponPhysicsConfig weaponConfig) { var heroContainer = _playerService.HeroContainer; @@ -56,7 +56,7 @@ public void OnGrabbed(HVRHandSide handSide, VobContainer vobContainer, WeaponPhy } } - public void OnReleased(HVRHandSide handSide, WeaponPhysicsConfig weaponConfig) + public void OnReleased(VrHandSide handSide, WeaponPhysicsConfig weaponConfig) { if (!_firstAttackDomain.TryUnHandle(weaponConfig, handSide)) { @@ -74,11 +74,11 @@ public void PlayDrawSound(VobContainer weapon) { case VmGothicEnums.ItemMaterial.Metal: var clipMetal = _audioService.CreateAudioClip(DaedalusConst.SoundDrawMetal); - SFXPlayer.Instance.PlaySFX(clipMetal, weapon.Go.transform.position); + _vrSfxPlayer.Play(clipMetal, weapon.Go.transform.position); break; case VmGothicEnums.ItemMaterial.Wood: var clipWood = _audioService.CreateAudioClip(DaedalusConst.SoundDrawWood); - SFXPlayer.Instance.PlaySFX(clipWood, weapon.Go.transform.position); + _vrSfxPlayer.Play(clipWood, weapon.Go.transform.position); break; // All others will be ignored as they're e.g., a bow. default: @@ -95,11 +95,11 @@ public void PlayUndrawSound(VobContainer weapon) { case VmGothicEnums.ItemMaterial.Metal: var clipMetal = _audioService.CreateAudioClip(DaedalusConst.SoundUndrawMetal); - SFXPlayer.Instance.PlaySFX(clipMetal, weapon.Go.transform.position); + _vrSfxPlayer.Play(clipMetal, weapon.Go.transform.position); break; case VmGothicEnums.ItemMaterial.Wood: var clipWood = _audioService.CreateAudioClip(DaedalusConst.SoundUndrawWood); - SFXPlayer.Instance.PlaySFX(clipWood, weapon.Go.transform.position); + _vrSfxPlayer.Play(clipWood, weapon.Go.transform.position); break; // All others will be ignored as they're e.g., a bow. default: @@ -187,4 +187,3 @@ private void OnHit(NpcContainer _, NpcContainer __, Vector3 ___) } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs b/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs index d54dddb7b..dfb565ece 100644 --- a/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs +++ b/Assets/Gothic-VR/Scripts/Services/VrHapticsService.cs @@ -1,79 +1,60 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.Core; using Gothic.Core.Models.Container; -using HurricaneVR.Framework.Shared; +using Gothic.VR.Interaction.Models; +using Gothic.VR.Interaction.Ports; using Reflex.Attributes; namespace Gothic.VR.Services { + /// + /// Decides which game event vibrates which hand with which preset. The vibration itself is done by IVrHaptics. + /// public class VrHapticsService { - public enum VibrationType - { - Info, - Warning, - Error, - Success - } - - [Inject] private readonly VRPlayerService _vrPlayerService; + [Inject] private readonly IVrHaptics _vrHaptics; [Inject] private readonly VRWeaponService _vrWeaponService; - private readonly HapticData[] _vibrationData = - { - // Info - e.g., you are inside an interaction collider - new (0.15f, 0.25f, 30f), - - // Warning - e.g., your lock pick rotation is invalid - new (0.25f, 0.5f, 100f), - - // Error - e.g., your key is broken - new (0.4f, 0.8f, 175f), - - // Success - e.g., you opened a chest - new (0.5f, 0.6f, 80f) - }; - public VrHapticsService() { // Fight - GlobalEventDispatcher.FightWindowAttack.AddListener(combatant => AttackVibration(combatant, VibrationType.Success)); // Attack can happen now - GlobalEventDispatcher.FightWindowCombo.AddListener(combatant => AttackVibration(combatant, VibrationType.Info)); // Now you can start another attack - GlobalEventDispatcher.FightWindowComboFailed.AddListener(combatant => AttackVibration(combatant, VibrationType.Error)); // Attack window passed + GlobalEventDispatcher.FightWindowAttack.AddListener(combatant => + AttackVibration(combatant, VrHapticPreset.Success)); // Attack can happen now + GlobalEventDispatcher.FightWindowCombo.AddListener(combatant => + AttackVibration(combatant, VrHapticPreset.Info)); // Now you can start another attack + GlobalEventDispatcher.FightWindowComboFailed.AddListener(combatant => + AttackVibration(combatant, VrHapticPreset.Error)); // Attack window passed // Lock picking - GlobalEventDispatcher.LockPickComboWrong.AddListener((_, _, handSide) => Vibrate((HVRHandSide)handSide, VibrationType.Warning)); - GlobalEventDispatcher.LockPickComboBroken.AddListener((_, _, handSide) => Vibrate((HVRHandSide)handSide, VibrationType.Error)); - GlobalEventDispatcher.LockPickComboCorrect.AddListener((_, _, handSide) => Vibrate((HVRHandSide)handSide, VibrationType.Success)); - GlobalEventDispatcher.LockPickComboFinished.AddListener((_, _, handSide) => Vibrate((HVRHandSide)handSide, VibrationType.Success)); + GlobalEventDispatcher.LockPickComboWrong.AddListener((_, _, handSide) => + Vibrate((VrHandSide)handSide, VrHapticPreset.Warning)); + GlobalEventDispatcher.LockPickComboBroken.AddListener((_, _, handSide) => + Vibrate((VrHandSide)handSide, VrHapticPreset.Error)); + GlobalEventDispatcher.LockPickComboCorrect.AddListener((_, _, handSide) => + Vibrate((VrHandSide)handSide, VrHapticPreset.Success)); + GlobalEventDispatcher.LockPickComboFinished.AddListener((_, _, handSide) => + Vibrate((VrHandSide)handSide, VrHapticPreset.Success)); } - private void AttackVibration(NpcContainer combatant, VibrationType vibrationType) + private void AttackVibration(NpcContainer combatant, VrHapticPreset preset) { // Resolve which hand holds the weapon for this combatant. // For NPCs attacking the player, we don't vibrate — only when it's the player's own attack. var handSide = _vrWeaponService.GetHandSideForCombatant(combatant); - switch (handSide) + if (handSide == GlobalEventDispatcher.HandSide.Both) { - case GlobalEventDispatcher.HandSide.Both: - Vibrate(HVRHandSide.Left, vibrationType); - Vibrate(HVRHandSide.Right, vibrationType); - break; - case GlobalEventDispatcher.HandSide.Left: - Vibrate(HVRHandSide.Left, vibrationType); - break; - case GlobalEventDispatcher.HandSide.Right: - Vibrate(HVRHandSide.Right, vibrationType); - break; + Vibrate(VrHandSide.Left, preset); + Vibrate(VrHandSide.Right, preset); + } + else if (handSide.TryToVrHandSide(out var vrHandSide)) + { + Vibrate(vrHandSide, preset); } } - - public void Vibrate(HVRHandSide handSide, VibrationType type) + public void Vibrate(VrHandSide handSide, VrHapticPreset preset) { - _vrPlayerService.GetHand(handSide).Vibrate(_vibrationData[(int)type]); + _vrHaptics.Vibrate(handSide, preset); } } } -#endif diff --git a/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs b/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs index 986cad9e6..0fa73cc11 100644 --- a/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs +++ b/Assets/Gothic-VR/Scripts/VRUnityLifecycleEvents.cs @@ -1,4 +1,3 @@ -#if GOTHIC_HVR_INSTALLED using Gothic.VR.Services; using Reflex.Attributes; using UnityEngine; @@ -19,4 +18,3 @@ private void FixedUpdate() } } } -#endif diff --git a/Docs/HVR-replacement/01-hvr-capabilities.md b/Docs/HVR-replacement/01-hvr-capabilities.md new file mode 100644 index 000000000..993ec1b1e --- /dev/null +++ b/Docs/HVR-replacement/01-hvr-capabilities.md @@ -0,0 +1,55 @@ +# 01 - HurricaneVR capability catalog + +Source: `Assets/HurricaneVR/` (HVR **2.9.3**, `Framework/Editor/HVREditorManager.cs:12`). +294 C# files, ~43k LoC in `Framework/`, plus a `TechDemo/` with demo scripts, prefabs, art and SFX. +License: Unity Asset Store EULA (paid, per-seat, no redistribution) - the reason contributors can't build the VR target. + +Legend for the "Gothic" column (details in [02-gothic-hvr-usage.md](02-gothic-hvr-usage.md)): +**✅ used** · **◐ used indirectly** (part of the rig/prefab we inherit, not touched by our code) · **– unused** + +## High-level capabilities + +| # | Capability | What HVR provides | Gothic | +|---|------------|-------------------|--------| +| H1 | **Physics hands** | Hands are rigidbodies driven by `ConfigurableJoint`s towards the tracked controller (`HVRJointHand`, `HVRHandPhysics`, `HVRHandStrengthHandler`, `PDStrength`). Hands collide with the world, can't pass through walls, have strength limits; `HVRGhostHand` shows the tracked pose when the physics hand lags. | ✅ | +| H2 | **Physics grabbing** | Grabbed objects stay dynamic rigidbodies, joined to the hand (`HVRGrabTracking`: ConfigurableJoint / FixedJoint / None). Weight, two-hand strength (`HVRTwoHandStrength`), collisions while held, throwing with velocity history (`HVRThrowingCenterOfMass`). | ✅ (weapon velocity drives combat) | +| H3 | **Procedural hand posing** | `HVRPhysicsPoser` closes each finger by sweeping until it touches the collider - works on **any** mesh without authored poses. Fallback when no authored pose exists (`PhysicsPoserFallback`). | ✅ (all Gothic items use `PoseType: PhysicPoser`) | +| H4 | **Authored hand posing** | `HVRHandPoser`, `HVRHandPose(Data)`, `HVRPosableHand/Finger/Bone`, blend poses, pose masks, mirroring, in-editor pose editor + recorder, grab points (`HVRGrabPoints`, `HVRPosableGrabPoint`), pose zones. | ✅ (backpack only) | +| H5 | **Finger animation from input** | `HVRHandAnimator` + `HVRFingerSettings` map grip/trigger/capacitive touches to finger curls; on Index (Knuckles) under OpenXR, `HVROpenXRFingerCurls` reads `XRHandSubsystem` for middle/ring/pinky. | ✅ (Index/Steam Frame finger tracking) | +| H6 | **Distance / force grab** | `HVRForceGrabber` (pull or gravity-gun style), `HVRForceGrabberLaser`, `HVRForcePullSettings`, line-of-sight checks, force-grab indicators. | ✅ | +| H7 | **Sockets (inventory/holsters)** | `HVRSocket`, `HVRSocketContainer`, `HVRSocketable`, filters (tag/string/enum/grabbable), hover feedback (scale/material), socket links, shoulder socket, socket bags, `HVRSocketContainerGrabber` (fill a box by dropping items into it). | ✅ heavy | +| H8 | **Physics mechanics** | `HVRPhysicsDoor` (hinge + lock + open/close SFX), `HVRPhysicsDrawer`, `HVRPhysicsLever`, `HVRPhysicsDial`, `HVRPhysicsButton`, `HVRRotationTracker`, `HVRRotationLimiter`, `HVRRotationSFX`. | ✅ doors + chest lids | +| H9 | **Climbing** | `HVRClimbable` - grab and pull the player rig. | ✅ ladders | +| H10 | **Player controller** | `HVRPlayerController` on a `CharacterController`: smooth move (camera/hand direction), snap/smooth turn, sprint, jump, crouch, gravity, fall speed, `HVRCameraRig` sit/stand/height calibration, `HVRHeadCollision` (fade when head clips walls), `HVRPlayerWaist`. | ✅ heavy | +| H11 | **Teleport** | `HVRTeleporter` (arc, validation, collision handler, marker, `PositionUpdate` event). | ✅ | +| H12 | **Input abstraction** | `HVRInputManager` auto-detects SDK (XRInput / InputSystem / Oculus OVR / SteamVR) and controller type (Touch, Knuckles, Vive, WMR, Cosmos…), per-controller `HVRInputSettings` maps, deadzones; `HVRController.GetButtonState(side, button)` with `JustActivated/Active/JustDeactivated`; `HVRPlayerInputs` (overridable). | ✅ heavy | +| H13 | **Haptics** | `HVRController.Vibrate(HapticData)`, grab haptics, impact haptics (hand/object), gun haptics. | ✅ | +| H14 | **World-space UI** | `HVRInputModule` + `HVRUIPointer` (laser per hand) + `HVRGraphicRaycaster`; canvases must be registered. | ✅ | +| H15 | **Fades** | `HVRScreenFade`, `HVRCanvasFade`, `HVRGlobalFadeFinder`. | ✅ | +| H16 | **Stabbing** | `HVRStabber/Stabbable` (knife penetration). | – | +| H17 | **Weapons** | Guns, magazines, bolts, shotgun, recoil, bow & arrow (`HVRPhysicsBow`), ballistic solver. | – | +| H18 | **Damage helpers** | `HVRDamageProvider/Handler`, `HVRDestructible`. | – | +| H19 | **Highlights** | `HVRMeshRendererHighlight`, glow, ring, scale highlight (hover feedback). | ◐ (part of hand prefab; we do our own `VRFocus`) | +| H20 | **Platform integrations** | SteamVR/OpenVR, Oculus OVR (incl. Oculus hand animator + gesture detector), FinalIK, HexaBody, EmeraldAI packages. | – (we are OpenXR-only) | +| H21 | **Editor tooling** | Setup window, layer setup, gun creator, lever creator, pose editor, socketable tag editor. | ◐ | +| H22 | **Device simulator** | Not in HVR itself - we use the `com.hurricanevrextensions.simulator` package (`HVRBodySimulator`, `HVRHandsSimulator`) which **depends on HVR**. | ✅ | + +## Low-level building blocks + +| Area | Classes | Notes | +|------|---------|-------| +| Grab core | `HVRGrabberBase`, `HVRHandGrabber` (3.1k LoC), `HVRGrabbable`, `HVRGrabbableChild`, `HVRGrabArgs`, `HVRGrabberManager`, `HVRGrabbableBag/TriggerGrabbableBag/SocketBag/ForceGrabberBag` | Hover/grab/release lifecycle with UnityEvents. Grabbable: `Activated/Deactivated`, `HoverEnter/Exit`, `Grabbed`, `Released`, `Collided`, `Destroyed`, `Socketed/UnSocketed`, `DistanceGrabbed/Released`. Grabber (hand/socket/force): `BeforeGrabbed`, `Grabbed`, `Released`, `BeforeHoverEnter`, `HoverEnter/Exit`. Bags = trigger-volume candidate collectors. | +| Grab options | `HVRHoldType` (OneHand/Swap/TwoHanded/ManyHands), `PoseType` (HandPoser/PhysicPoser/Offset), `HVRGrabTracking`, `HVRGrabControl`, `HVRGrabTrigger` (active/toggle/manual release), `RequireLineOfSight`, `ParentHandModel`, `Stationary`, `LinkedGrabbables`, `RequireOtherGrabbable`. | | +| Joints | `HVRJointSettings` (ScriptableObject), `HVRJointUtilities`, `ConfigurableJointExtensions`, `HVRRigidBodyOverrides`, `HVRRigidbodyLocker` | Tuned joint drives - the "feel" of HVR. | +| Collision | `HVRObjectCollisionDisabler`, `HVRHandColliderController`, layers `Player/DynamicPose/Grabbable/Hand` | Our `Constants.cs:113-117` layers are HVR-suggested. | +| Input | `HVRController` (XR `InputDevice` based), `HVRInputSystemController`, `HVRXRInputController`, `HVRTrackedController`, `HVRControllerOffset(s)` (per-device pose offsets), `HVRGlobalInputs`, `HVRControllerEvents` + 17 `*ButtonEvents` components | | +| Managers | `HVRManager`, `HVRInputManager`, `HVRTimeManager`, `HVRSettings` (global ScriptableObject), `HVRDontDestroy`, `SFXPlayer` | Live in `HVRGlobal.prefab`. | +| Pose data | `HVRHandPoseData`, `HVRPosableBoneData`, `HVRPosableFingerData`, `HVRRuntimePosesData`, `HVRHandMirrorSettings` | | + +## Tech stack facts + +- Input: legacy `UnityEngine.XR.InputDevice` *and* Input System (`HVR_INPUT_SYSTEM`); we run with `USE_INPUT_SYSTEM_POSE_CONTROL`. +- Tracking backends via asmdef versionDefines: OpenXR, OpenVR, Oculus, XR Hands (`USING_XRHANDS`), XR Management. +- Rendering: shipped Built-in materials → we run `Gothic > Build > HVR - Convert Materials to URP` (`Gothic-VR/Editor/HurricaneActions.cs`). +- Physics-first design: everything assumes `FixedUpdate`-driven rigidbodies and joints. +- Extension model: inheritance (`protected virtual`), UnityEvents in the inspector. diff --git a/Docs/HVR-replacement/02-gothic-hvr-usage.md b/Docs/HVR-replacement/02-gothic-hvr-usage.md new file mode 100644 index 000000000..e366e4ae2 --- /dev/null +++ b/Docs/HVR-replacement/02-gothic-hvr-usage.md @@ -0,0 +1,101 @@ +# 02 - What Gothic-Unity uses from HVR + +Snapshot: `main` @ `084e5e95` (2026-10-22). Measured by grepping C# and by resolving script/asset GUIDs in our +prefabs, scenes and ScriptableObjects against `Assets/HurricaneVR/**/*.meta`. + +## 1. Coupling in numbers + +| Metric | Value | +|--------|-------| +| C# files in `Gothic-VR` + `Gothic-Lab` behind `GOTHIC_HVR_INSTALLED` or referencing HVR | **62** | +| … using HVR types directly (`using HurricaneVR…` / subclassing) | **32** | +| … using HVR only through our own wrappers (`VRPlayerController`, `VRPlayerInputs`) | **8** | +| … gated by the define but **not using HVR at all** | **22** (see §6) | +| Distinct HVR types referenced in our code | 28 | +| HVR classes we **subclass** | 6: `HVRPlayerController`, `HVRPlayerInputs`, `HVRSocket`, `HVRPhysicsDoor`, `HVRSimulatorControlsGUI`, (`HVRShoulderSocket` via `VRShoulderSocket`) | +| Our prefabs/assets with HVR components | 18 (11 prefabs in `Gothic-VR/Resources/VR/Prefabs/**`, 7 assets) | +| HVR prefabs we nest | `TechDemo/Prefabs/TechDemoXRRigOpenXR` (the whole player!), `UIManager`, `HVRGlobal`, `LargeInventorySlot`, `SocketOval` | + +Most-used HVR types in our code: `HVRGrabbable` (39), `HVRHandSide` (34), `HVRGrabberBase` (24), `HVRSocket` (8), +`HVRHandGrabber` (8), `HVRController` (8), `HVRInputModule` (7), `HVRButtons` (7), `HVRPhysicsDoor` (6). + +> The player rig is a **prefab variant of HVR's TechDemo rig** (`Resources/VR/Prefabs/HVR - Player.prefab` → +> `TechDemoXRRigOpenXR` → `TechDemoXRRig`). So TechDemo scripts (`DemoBackpack`, `DemoHolster`, `DemoUIManager`), +> TechDemo hand models, hand poses, backpack and SFX are runtime dependencies, not just samples. + +## 2. Capability usage map + +Capability IDs refer to [01-hvr-capabilities.md](01-hvr-capabilities.md). + +| Gothic feature | HVR capabilities | Our code (Assets/Gothic-VR/Scripts/…) | Our assets | +|---|---|---|---| +| **Player rig, movement, turning, sit/stand** | H10, H12 | `Adapters/HVROverrides/VRPlayerController.cs` (subclass; Move/Snap/Smooth turn, `CameraRig.SetSitStandMode`, `MovementEnabled`, `RotationEnabled`, `CanJump/Crouch/Sprint`, `CharacterController.stepOffset`, per-hand `AllowGrabbing/AllowHovering`, disabling hand poses) · `Services/Context/VRContextInteractionService.cs` (setup, lock/unlock, `KeepPlayerWithin` via `CharacterController.Move`, `IsGrounded`, `IsClimbing`, far-clip on `Camera`) · `Services/Context/VRContextMenuService.cs` (`HVRSitStand` default) | `HVR - Player.prefab` (HVRCameraRig, HVRHeadCollision, HVRCanvasFade …) | +| **Swimming / diving** | H10, H15 | `Adapters/Player/VRSwimDive.cs` – rewrites `Gravity`, `MoveSpeed`, `RunSpeed`, `MaxFallSpeed`, `CanSprint`, moves `CharacterController` by hand strokes using `Left/RightControllerTransform`, `CameraRig`, `CameraHeight`, `ScreenFader.Fade` | | +| **Custom inputs** (menu, both-grips, jump on A, simulator keys) | H12 | `Adapters/HVROverrides/VRPlayerInputs.cs` (subclass; `HVRController.GetButtonState`, `HVRButtonState`, `UseWASD`) · `Adapters/UI/VRCinema.cs` (skip video via Trigger/Primary) | `HVRGlobal.prefab` (input maps: Oculus, Knuckles, Vive, WMR, Cosmos) | +| **Teleport** | H11 | `VRContextInteractionService.TeleportPlayerTo` (`Teleporter.Teleport`) · `VRCinema` / `VRPlayerController` (enable/disable) · `Adapters/Player/VRSpectatorCamera.cs` (`Teleporter.PositionUpdate`) | TeleportMarker (nested) | +| **Item grabbing** (pick up = add to inventory) | H1, H2, H3, H6 | `Adapters/Vob/VRVobItem.cs` (`OnGrabbed/OnReleased`, `SetupColliders`, ghost layer while held) · `Services/VRPlayerService.cs` (`SetGrab/UnsetGrab` - inventory count, distinguishes `HVRForceGrabber` vs `HVRHandGrabber`, `IsLeftHand`, dual-grab; `IgnorePlayerCollision` via `grabbable.Colliders`) · `Adapters/Player/VRPlayerItemAdapter.cs` (`OnBeforeGrabbed` turns physics on) | `Vobs/oCItem.prefab`: `HVRGrabbable` with `PoseType=PhysicPoser`, `HoldType=ManyHands`, `ForceGrabbable=1`, `RequireLineOfSight=1`, `HVRTagSocketable` | +| **Melee combat** | H2 (rigidbody velocity of the held weapon) | `Domain/Player/VrWeaponAttackDomain.cs` (velocity history from `_weaponRigidbody.linearVelocity - characterController.velocity`) · `Services/VRWeaponService.cs` · `Adapters/Player/VRPlayerWeaponInteraction.cs` (`HVRHandGrabber.HandSide`) · `Adapters/Player/VRFistAttackAdapter.cs` (hand colliders on `Hand` layer) | | +| **Hover focus** (name label + brighten) | grab hover events | `Adapters/VRFocus.cs` (`OnHoverEnter/Exit`) | 10 `OnHoverEnter/Exit` bindings in Vob prefabs | +| **Backpack, hip/back holsters** | H7, H4 | `Adapters/Player/VRBackpack.cs` (`HVRSocketContainer.TryAddGrabbable`, `HVRSocketable`, shoulder socket) · `Adapters/HVROverrides/VRSocket.cs` (subclass; reparents the `VobLoader` root instead of the grabbable, rotates by item category) · `VRShoulderSocket.cs` · `Adapters/Vob/Container/VRVobContainerSocketInventory.cs` | `BackPack.prefab` (HVRGrabbable, HVRGrabPoints, HVRPosableGrabPoint, HVRHandPoser, HVRSocketContainer, HVRSocketLink, `DemoBackpack`) · `VRBackpack(Large)InventorySlot.prefab` (HVRTagSocketFilter, HoverMaterial, HoverScale) · 2 `HVRHandPose` assets · `GUZ-VR-Socketables.asset` | +| **Chests** (lid + slots) | H8, H7 | `Adapters/Vob/Container/VRVobContainerPhysicsChest.cs` (**subclass of `HVRPhysicsDoor`**, re-sizes sockets to chest mesh, `TryFindAvailableSocket`, socket audio) · `VRVobContainer.cs` (lid SFX) | `oCMobContainer.prefab`: HVRSocketContainer, HVRSocketContainerGrabber, HVRTriggerGrabbableBag, HVRRotationTracker, filters/hover | +| **Doors** | H8 | `Adapters/Vob/VRVobDoor.cs` (sets `SFXOpened/Closed`) · `Adapters/Vob/LockPicking/VRContainerDoorPickingInteraction.cs` (`HVRPhysicsDoor.Lock/Unlock`) | `oCMobDoor.prefab`: HVRPhysicsDoor, HVRGrabbable, HVRRotationTracker | +| **Lock picking** | H13 + hand side | `VRContainerDoorPickingInteraction.cs`, `VRLockPickInteraction.cs` | | +| **NPC loot** | H7 | `Adapters/VRNpcLoot.cs` (spawns `HVRSocket`s, `TryGrab(grabbable, true, true)`, `IsGrabbing`) | | +| **NPC talk / corpse** | "grab as click" | `Adapters/VRNpc.cs` (grab → release immediately, start dialog) · `Adapters/Marvin/VRNpcMarvinAdapter.cs` | `oCNpc.prefab` HVRGrabbable · `NPC_ForcePullSettings.asset` | +| **Mobs** (wheel, lever, bed, fire, switch, inter) | grab events | `Adapters/Vob/VRMobInteraction.cs` · `VRPlayerService.HandleMobGrab` · `Adapters/Player/VRSeat.cs` (`HVRCanvasFade`) | `oCMob{Bed,Fire,Inter,Switch,Wheel}.prefab` HVRGrabbable | +| **Ladders** | H9 | – (prefab only) | `oCMobLadder.prefab`: HVRClimbable | +| **Dig spots** | grab state | `Adapters/Vob/VRDigSpot.cs` (`FindObjectsByType`, `GrabbedTarget`) | | +| **Haptics** | H13 | `Services/VrHapticsService.cs` (`HVRController.Vibrate(HapticData)`, 4 presets, fight + lockpick events) · `VRContextInteractionService.OnMarvinLogoPoked` | `HVR_GrabHaptics.asset` | +| **Menus / UI laser** | H14 | `VRContextInteractionService.InitUIInteraction` (`HVRInputModule.Instance.UICanvases`), `.Pointers` → `HandSide` · `Adapters/UI/VirtualKeyboard.cs` (`AddCanvas/RemoveCanvas`) | `UIManager.prefab` (HVRInputModule, `DemoUIManager`) · `HVRUIPointer` in hand prefabs | +| **Fades** | H15 | `VRSwimDive` (`ScreenFader`), `VRSeat` (`HVRCanvasFade`) | | +| **Finger curls** (Index / Steam Frame) | H5 | – (automatic) | `HVR_FingerSettings.asset`, XR Hands via `USING_XRHANDS` | +| **Desktop simulator** | H22 | `Adapters/HVROverrides/VRSimulatorControlsGUI.cs` · `VRContextInteractionService` (`HVRBodySimulator`) · `VRPlayerInputs` (`UseWASD`) | package `com.hurricanevrextensions.simulator` | +| **Editor/build** | – | `Editor/HurricaneActions.cs` (URP material conversion), `Editor/VRContextToolActions.cs` (toggle define), CI injects HVR from private repo | | +| **Lab** | util | `Gothic-Lab/Scripts/Handler/LabFightHandler.cs` (`HurricaneVR.Framework.Core.Utils`) | | +| **Core leaks** | layers & comments | `Gothic-Core/Scripts/Const/Constants.cs:113-117` (`Player`, `DynamicPose`, `Grabbable`, `Hand` layers), comments in `MobInteractionService`, `VobService`, `NpcHelperService` | `ProjectSettings/TagManager.asset` layers 8, 9, 20, 21 | + +## 3. HVR features we do **not** use + +Stabbing, guns/bow/ammo/recoil, damage/destructible, buttons/dials/levers/drawers (we use plain grab events for +mobs), pose zones, SteamVR/OVR/FinalIK/HexaBody integrations, gesture detector, most editor creators. +→ Roughly **⅓ of HVR is relevant** to us; the relevant third is, however, its hardest part (physics hands + +physics grabbing + procedural posing). + +## 4. Assets that must be replaced (licensed HVR content) + +| Asset | Used for | +|-------|----------| +| `TechDemo/Prefabs/TechDemoXRRig(OpenXR).prefab` | whole player rig base | +| `TechDemo/Assets/Hands/HVR_left/right_hand*.fbx/.prefab`, `Physics Left/RightHand.prefab` | visible + physics hands | +| `Framework/Models/OculusCustomHands/*` (Quest2 controller and custom hand meshes) | hand/controller visuals | +| `TechDemo/Poses/HandPoses.prefab`, `pose_fist.asset`, `DefaultPoses/OculusCustomHand{Open,Fist}.asset` | default & fist poses | +| `TechDemo/Assets/Interactables/Props/Backpack/BackPack.prefab` + `sfx_back_pack_open/close.wav` | backpack | +| `Framework/Prefabs/SocketOval.prefab`, `Models/Ring.fbx`, `Materials/{Socket,Valid,Invalid}SocketRing.mat` | socket visuals | +| `Framework/Prefabs/TeleportMarker.prefab` + materials | teleport | +| `Framework/Resources/InputSettings/*.asset`, `HVR_ControllerOffsets`, `HVR_FingerSettings`, `HVR_GrabHaptics`, `HVR_DefaultHandStrength`, `HVR_HandPullingSettings`, `HVR_ForcePullSettings` | tuning data | +| `TechDemo/Prefabs/UIManager.prefab`, `PlayerSettingsUI.prefab` | UI module host | + +Note on licensing: our overrides partially **copy HVR source** (`VRSocket.OnGrabbed` says "From HVRGrabberBase.cs … +From HVRSocket.cs"). Any replacement must be written fresh, not ported line by line from HVR. + +## 5. Platform matrix today + +| Platform | Path | HVR involvement | +|----------|------|-----------------| +| Quest 2/3 | OpenXR + Meta Quest Support, Oculus Touch / Touch Pro profiles | `HVRInputManager` → XRInput/InputSystem, Oculus input map | +| Pico 4 / 4 Ultra / Neo3 | OpenXR + `pico-openxr-sdk` (toggled by `VRBuilderActions.SetPicoSettings`) | generic XR input map | +| PCVR (Index, Vive, Touch via Link/SteamVR) | OpenXR on Windows, Index/Vive profiles | Knuckles/Vive maps | +| Finger tracking (Index, Steam Frame) | OpenXR + Hand Tracking Subsystem (`com.unity.xr.hands` 1.7.3) | `HVROpenXRFingerCurls` (Knuckles only, fingers 2-4) | + +## 6. Files gated by `GOTHIC_HVR_INSTALLED` without any HVR usage + +`VRContextBootstrap` (gating is intentional - registration), `VrColliderHitTracker`, `VrNpcColliderDebugAdapter`, +`MarvinInspectorTabHandler`, `VRFistAttackAdapter`, `VRHandsOnTop`, `VRIntroduceChapter`, `TextMatcher`, +`VRSettingsAccessibilityMenu`, `VRSettingsImmersionMenu`, `TutorialHandler`, `VRBillboard`, `VRDialog`, +`VRPrintScreen`, `VRSubtitles`, `VRUiOnTop`, `VRLockPickInteraction`, `VRLockPickProperties`, `VRWeaponAttackAdapter`, +`ReflexVRSceneInstaller`, `VRUiOnTopService`, `VRUnityLifecycleEvents`. + +Plus 8 that only touch HVR through our wrappers: `VRSpectatorCamera`, `SpeechToTextHandler`, `VRFollowCamera`, +`VRPlaceInFrontOfCamera`, `VRContextDialogService`, `VRCinemaService`, `HurricaneActions`, `VRContextToolActions`. + +These ~30 files are free wins: once our own abstractions exist, they compile without HVR. diff --git a/Docs/HVR-replacement/03-framework-comparison.md b/Docs/HVR-replacement/03-framework-comparison.md new file mode 100644 index 000000000..9f27402c8 --- /dev/null +++ b/Docs/HVR-replacement/03-framework-comparison.md @@ -0,0 +1,112 @@ +# 03 - HVR vs. UltimateXR vs. other frameworks + +Candidates assessed: + +| Framework | Version checked | License | Maintainer / activity | Fits "free for every contributor"? | +|-----------|-----------------|---------|------------------------|-----------------------------------| +| **HurricaneVR** (today) | 2.9.3 | Asset Store EULA, paid | 1 dev, active | ❌ | +| **UltimateXR (UXR)** | `ultimatexr-unity/` 1.0.0 *(Unreleased in CHANGELOG)*, last commit `dde5c47` 2026-06-08, 184 commits | MIT | VRMADA (small studio), slowed down | ✅ | +| **Unity XR Interaction Toolkit (XRI)** | 3.x (3.1 released, 3.2 in docs) | Unity Companion License (free, any Unity project) | Unity, active, ships as a Unity 6 core package | ✅ | +| Meta Interaction SDK (ISDK) | – | Proprietary Meta SDK license | Meta, active; officially **Quest only** | ❌ (Pico/PCVR not supported, not OSS) | +| MRTK3 | – | BSD-3 / MIT | community org; **built on XRI**; mixed-reality UI focus | ◐ (adds little for a game) | +| VRTK 4, NewtonVR, HPTK (Hand Physics Toolkit) | – | MIT | unmaintained | ❌ (dead dependencies) | +| AutoHand, VR Interaction Framework, HexaBody | – | paid | active | ❌ (same problem as HVR) | +| Build our own | – | ours | us | ✅ | + +## 1. UltimateXR - tech stack facts (from the source in `ultimatexr-unity/`) + +- 573 runtime C# files, **~109k LoC** (2.5× HVR). Huge share is multiplayer/state-sync/serialization + (`Core/StateSync`, `Core/StateSave`, `Networking/*` with Photon/Mirror/FishNet/NetCode), avatar/IK, weapons, tweens. +- `package.json`: `"unity": "2021.2"`, depends on `com.unity.render-pipelines.universal: 12.1.6`. We are on + **Unity 6000.3.13f1 / URP 17.3**. Unity-6 compatibility is unverified upstream. +- **Avatar-centric**: everything hangs off `UxrAvatar` + `UxrAvatarRig` + `UxrStandardAvatarController`. + Locomotion, grabbing and hand poses all expect a configured UXR avatar. +- **Kinematic manipulation**: while grabbed, the object's rigidbody is forced kinematic + (`Manipulation/UxrGrabManager.Manipulation.cs:284-286`), physics come back on release with a throw impulse + (`…:1280`). No joint-driven objects, no physics hands. +- **Authored poses**: `UxrHandPoseAsset` + a very good Hand Pose Editor, grab-point shapes + (`UxrGrabPointShapeAxisAngle` lets a hand slide along an axis). No procedural finger fitting. +- **Sockets** = `UxrGrabbableObjectAnchor` with compatible tags and `MaxPlaceDistance`. +- **Constraints** on grabbables (translation/rotation limits) give kinematic doors/levers/dials. +- **Input via legacy `UnityEngine.XR.InputDevice`** per device class. On our pure-OpenXR stack: + `UxrMetaTouchQuest3Input` requires the *Oculus* SDK (`SDKDependency => SdkOculus`), `UxrPicoNeo3Input` requires the + *PicoXR* (non-OpenXR) SDK and only knows "PicoXR Controller-Left/Right", `UxrValveIndexInput` derives from + `UxrSteamVRControllerInput` (SteamVR plugin). Only `UxrGenericOpenXRInput` works for us, with generic capabilities. +- **Hand tracking**: `UxrMetaHandTracking` uses `OVRPlugin`; no `com.unity.xr.hands` support anywhere in Runtime. +- Locomotion: `UxrSmoothLocomotion` on `CharacterController` (gravity, sprint, terminal velocity), + `UxrTeleportLocomotion`. +- UI: `UxrPointerInputModule`, laser pointer and finger-tip (poke) raycasters, keyboard UI. +- Camera: `UxrCameraFade`, `UxrCameraWallFade` (= HVRHeadCollision). +- Art: MIT hand meshes (`Art/Avatars/BigHands`, `SmallHands`, skin variations) - a real asset win. + +## 2. XRI 3.x - tech stack facts + +- OpenXR-first through the **Input System** (action maps per interaction profile) - the same stack we already ship + (OpenXR 1.16, Meta Quest feature, Pico OpenXR SDK, Index/Vive/Touch profiles, XR Hands 1.7). +- `XROrigin` (tracking origin floor/device → sit/stand), locomotion providers: continuous move, snap/continuous turn, + teleport, **climb** (`ClimbProvider` / `ClimbInteractable`), gravity + jump (3.1), works with `CharacterController`. +- Interactors: direct, ray, **near-far (distance grab + UI in one)**, poke, socket. Interactables: + `XRGrabInteractable` with movement types *Instantaneous / Kinematic / **VelocityTracking*** (object stays a + dynamic rigidbody → real velocity for our melee), multi-hand grab transformers, `XRSocketInteractor` with hover mesh, + select filters. +- UI: `XRUIInputModule` + `TrackedDeviceGraphicRaycaster` (no manual canvas registration list). +- Haptics: `HapticImpulsePlayer`, simple haptic feedback component. +- **XR Interaction Simulator** (keyboard/mouse driven HMD + controllers + hands) → replaces our HVR simulator package. +- No physics hands, no hand poser (XR Hands has *gesture* shapes, not grab poses), no physics door/lever components. + +## 3. Capability mapping (only capabilities we use) + +✅ native · ◐ partial / needs our code · ❌ missing (we must build it) + +| # | Capability (Gothic use) | HVR | UltimateXR | XRI 3.x | Meta ISDK | Notes | +|---|-------------------------|-----|-----------|---------|-----------|-------| +| H1 | Physics hands (no hands through walls, fist hits) | ✅ | ❌ | ❌ | ◐ (sync-hand) | Must be built in any free option. Can be optional (comfort setting). | +| H2 | Dynamic grabbed objects (melee velocity, collisions) | ✅ joints | ❌ kinematic | ✅ VelocityTracking | ◐ | **Decisive for combat.** UXR would force us to compute weapon velocity from transform deltas and lose held-object collisions. | +| H3 | Procedural finger fitting on runtime-loaded meshes | ✅ PhysicsPoser | ❌ | ❌ | ❌ | **Gothic-specific must-have**: all items come from ZenKit at runtime, nobody can author per-item poses. Build ourselves (finger sweep/capsule-cast, ~500-800 LoC). | +| H4 | Authored poses (backpack, a few special grips) | ✅ | ✅ best-in-class editor | ❌ | ✅ | Few uses. Can borrow UXR's pose asset format/editor (MIT) or keep simple static poses. | +| H5 | Finger curls from buttons + Index/Steam Frame finger tracking | ✅ (XR Hands for Knuckles) | ◐ (SteamVR / OVR only) | ◐ (input actions + XR Hands available, mapping is ours) | ◐ | Small: read grip/trigger/touch actions + `XRHandSubsystem` curls. | +| H6 | Distance grab (items, NPC select) | ✅ | ❌ | ✅ Near-Far | ✅ | | +| H7 | Sockets: backpack, holsters, chest slots, loot, filters, hover feedback | ✅ | ◐ anchors + tags | ◐ socket interactor + filters | ◐ | Container/auto-fill/“drop into chest” logic is ours in every option. | +| H8 | Physics doors & chest lids (hinge, lock, SFX) | ✅ | ◐ kinematic constraints | ◐ grab + HingeJoint | ◐ | Small component on our side (hinge limits, lock, open/close detection, SFX). | +| H9 | Ladders | ✅ | ❌ | ✅ Climb | ◐ | | +| H10 | Player controller (move/turn/sprint/jump/crouch/gravity/sit-stand/swim tweaks) | ✅ | ◐ (avatar-bound) | ✅ providers + XROrigin | ◐ | Swim/dive keep our own code; needs gravity/speed knobs - available in both. | +| H11 | Teleport | ✅ | ✅ | ✅ | ✅ | | +| H12 | Cross-device input | ✅ | ◐ (per-SDK classes, wrong SDKs for us) | ✅ (OpenXR profiles) | ◐ | | +| H13 | Haptics | ✅ | ✅ | ✅ | ✅ | | +| H14 | UI laser on world canvases | ✅ | ✅ | ✅ | ✅ | | +| H15 | Fades, head-in-wall fade | ✅ | ✅ | ◐ (vignette; wall-fade is ours) | ◐ | | +| H22 | Desktop simulator | ✅ (ext. package) | ❌ | ✅ | ◐ | Critical for contributors without a headset. | +| – | Quest 2/3 | ✅ | ◐ generic OpenXR | ✅ | ✅ | | +| – | Pico 4 / Ultra (OpenXR) | ✅ | ◐ generic OpenXR | ✅ | ❌ | | +| – | PCVR Index/Vive/Touch | ✅ | ◐ (SteamVR plugin for Index) | ✅ | ❌ | | +| – | Unity 6000.3 / URP 17 | ✅ | ❓ (declares 2021.2/URP12) | ✅ (core package) | ✅ | | + +### Score (20 rows above, ✅=2, ◐=1, ❌/❓=0…1) + +| | HVR | UXR | XRI | Meta ISDK | +|---|---|---|---|---| +| Points (max 40) | 40 | 19 (❓ counted as 1) | 30 | 24 | +| Missing (❌) | 0 | 6 (H1, H2, H3, H6, H9, H22) | 3 (H1, H3, H4) | 3 (H3, Pico, PCVR) - and disqualified by license | + +Weighting matters more than points: H2 (combat), H3 (runtime items), H12 (all platforms) and H22 (contributors +without headsets) are the four rows that decide the outcome. XRI covers H2/H12/H22 natively; UXR covers none of them +on our stack. + +## 4. What each option would cost us + +| Option | We must build | We must adapt / fight | Risk | +|--------|---------------|-----------------------|------| +| **UltimateXR as base** | physics hands, dynamic grab (or rewrite combat to kinematic), procedural poser, distance grab, climbing, simulator, OpenXR/XR-Hands input for Quest/Pico/Index | Adopt the `UxrAvatar` model for a player that Gothic drives itself; port 109k LoC to Unity 6/URP 17; strip networking/state-save; carry an owner-less fork if upstream stalls | **High** - we'd fork and own a framework 2.5× HVR's size, and still build the hard parts | +| **XRI as base + own Gothic interaction layer** | procedural poser, physics hands (optional), hand visuals, finger curls, door/lid/container components, wall fade | XRI events (`selectEntered/Exited`, `hoverEntered/Exited`) instead of HVR events - mechanical | **Medium** - hard parts are the same ones as with UXR, but everything else is maintained by Unity | +| **From scratch** | everything incl. input mapping, locomotion, teleport, UI module, simulator, sockets | – | **High** - weeks spent on solved problems (input, UI raycasting, simulator) | +| Meta ISDK | – | Pico/PCVR not supported, proprietary | Disqualified | + +## 5. What is worth borrowing from UltimateXR (MIT) + +UXR is a poor *base* for us, but a good *quarry* (keep the MIT notice when copying): + +- **Hand meshes and skins** (`Art/Avatars/*Hands*`) - replaces HVR's licensed hand models. +- **Hand pose asset + Hand Pose Editor** ideas/code for the few authored grips (backpack, shoulder, ladder). +- `UxrCameraWallFade` → reference for head-in-wall fade. +- `UxrGrabPointShapeAxisAngle` → reference for "slide hand along the blade/handle axis" on weapons. +- `UxrBodyIK` / arm IK - only if we later want a visible body. diff --git a/Docs/HVR-replacement/04-recommendation.md b/Docs/HVR-replacement/04-recommendation.md new file mode 100644 index 000000000..00d232c76 --- /dev/null +++ b/Docs/HVR-replacement/04-recommendation.md @@ -0,0 +1,126 @@ +# 04 - Recommendation and migration path + +## Verdict + +**Don't adopt UltimateXR as the base, and don't rebuild everything from scratch.** +Build a thin, Gothic-owned interaction layer (`Gothic.VR.Interaction`) **on top of Unity XR Interaction Toolkit 3.x**, +write the three things no free framework offers ourselves (procedural finger posing, physics hands, Gothic +containers/doors), and **borrow selectively from UltimateXR (MIT)**, mainly its hand art and pose-editor ideas. + +### Why (from the data in 01-03) + +1. **Our hardest requirements aren't covered by UltimateXR either.** Runtime-loaded items need procedural finger + fitting (H3), and melee needs held weapons to stay dynamic rigidbodies (H2, `VrWeaponAttackDomain.cs:361`). UXR + makes grabbed objects kinematic (`UxrGrabManager.Manipulation.cs:286`) and only supports authored poses. We'd + build H1/H3 in either case, and with UXR we'd also have to rework combat. +2. **Platform reach.** Our stack is OpenXR + Input System + XR Hands on Quest, Pico, and PCVR. XRI uses exactly this + stack. UXR's device classes expect the Oculus SDK (Quest 3), the PicoXR SDK (Pico), and the SteamVR plugin (Index + finger skeletons). On OpenXR it falls back to `UxrGenericOpenXRInput`, and it has no XR Hands support, so Index and + Steam Frame finger tracking would be ours to write anyway. +3. **Maintenance.** UXR has ~109k LoC, targets Unity 2021.2/URP 12, its 1.0 is still "Unreleased", and the last + commit was 4.5 months ago. Adopting it means forking and maintaining a framework 2.5× HVR's size, most of which + (networking, state sync, avatars) we don't need. XRI ships as a Unity 6 core package and Unity maintains it. +4. **Contributors.** XRI's Interaction Simulator replaces our HVR-dependent simulator package (H22), so someone + without a headset can still run the VR scene. UXR has no equivalent. +5. **From scratch is wasteful.** Input mapping, UI raycasting, teleport, turn/move providers, sockets and the + simulator are solved problems, and XRI covers 13 of our 16 used capabilities natively or partially. + +### What we accept + +- **No physics hands until Phase 5.** Without them, the hand model follows the tracked controller 1:1, so a real + hand that moves "into" a virtual wall, chest or door puts the virtual hand through it. With XRI `VelocityTracking` + the held item (a sword) still stops at the wall while the hand keeps going, so hand and item visibly separate. + HVR avoids this with a rigidbody hand pulled towards the controller by a joint (`HVRJointHand`), plus a ghost hand + that shows the real controller pose. + - What Gothic depends on today: only the look and feel. The one gameplay use, fist attacks through hand + colliders, is still disabled (`VRFistAttackAdapter.Awake`: "TODO - Implement before enable"). Our player prefab + doesn't override HVR's hand strength settings, so we run HVR defaults. + - Size of HVR's solution: ~5.8k LoC directly involved (`HVRHandGrabber` 3,277, `HVRTeleportCollisonHandler` 762, + `HVRPhysicsPoser` 551, `HVRJointHand` 363, `HVRJointSettings` 223, strength/joint utils ~470) and ~145 public + tuning fields across them (`HVRHandGrabber` 79, `HVRJointSettings` 36, teleport handler 13, joint hand 12, + `PDStrength` 6). + - Maturity: `Documentation/ReleaseNotes.txt` lists ~70 releases (1.1 → 2.9.3). 174 release-note lines mention + joints, strength, stuck hands, collisions or teleporting with physics hands - for example "hand stuck in + collision geometry", "physics hands jump after teleporting when Update/Fixed are out of sync", "default wrist + strength … too under damped". The notes have no dates, so the timespan isn't measurable from the repo. + - Takeaway: a basic joint hand is small (a few hundred LoC). The cost is in the edge cases: teleport, stuck + hands, held-object return, two-hand strength, and tuning across Quest/Pico/PCVR frame rates. Treat Phase 5 as + the phase most likely to overrun, and keep physics hands optional. +- During the transition there are two backends. Phase 0 keeps that cheap. + +## Target architecture + +``` +Gothic.VR (adapters/services: VRVobItem, VRBackpack, VRSwimDive, VrHapticsService, …) + │ depends only on ↓ (no XRI / HVR types in game code) +Gothic.VR.Interaction (our abstractions + components) + ├─ Model: VrHandSide, VrButton, VrButtonState, VrHapticPreset + ├─ Ports: IVrRig (move/turn/teleport/lock/gravity/speeds/sit-stand/fade/camera/hand transforms) + │ IVrInput (GetButtonState(side, button), menu/both-grips helpers) + │ IVrHaptics (Vibrate(side, preset)) + │ IVrGrabbable / IVrGrabber events: HoverEnter/Exit, BeforeGrabbed, Grabbed, Released (+ grabber kind: + │ Hand | Distance | Socket, + HandSide) + │ IVrSocket / IVrSocketContainer (TryPlace, TryFindFree, IsOccupied, ForceRelease, filter by item category) + │ IVrUiPointers (register canvas, pointer → hand side) + ├─ Own components: ProceduralHandPoser, PhysicsHand, VrDoor (hinge/lock/SFX), VrContainerSockets, + │ VrClimbable bridge, WallFade, FingerCurlProvider (input + XR Hands) + └─ Backend: XRI implementation (later the only one); temporary HVR implementation during migration +``` + +Rules: game code never touches `UnityEngine.XR.Interaction.Toolkit` types, so the next framework swap only touches +the backend. Our own `VrHandSide` replaces `HVRHandSide` (34 uses) and `GlobalEventDispatcher.HandSide`. + +## Phases + +Detailed plans: `phase-0-decouple.md` … `phase-6-removal.md` in this folder (see the README). + +Each phase is its own PR (see `commit-pr` skill) and is playable on Quest, Pico and PCVR before merging. + +| Phase | Content | Replaces (HVR) | Size* | +|-------|---------|----------------|-------| +| **0 - Decouple** (HVR stays) | Add `Gothic.VR.Interaction` ports + HVR backend. Move the 32 direct-HVR files onto the ports. Drop `#if GOTHIC_HVR_INSTALLED` from the 22 files that don't need it (02 §6). Move `Player/DynamicPose/Grabbable/Hand` layer names out of HVR wording. | – | M (1-2 wk) | +| **1 - Rig, input, locomotion, UI, simulator** | New XRI player prefab (XROrigin + CharacterController, move/turn/snap/teleport/jump/gravity, sit/stand via tracking origin + height offset). Input System actions for menu, both-grips, jump, sprint, crouch. `XRUIInputModule` (deletes the `InitUIInteraction` FindObjectsOfType hack). Screen fade + wall fade. XR Interaction Simulator. Swim/dive on the new rig knobs. | H10, H11, H12, H14, H15, H22, `VRPlayerController`, `VRPlayerInputs`, `VRSimulatorControlsGUI`, hvr-simulator package | L (2-3 wk) | +| **2 - Grabbing** | `XRGrabInteractable` (VelocityTracking) on `oCItem`, mobs, NPCs; near-far interactor for distance grab with line-of-sight; hover → `VRFocus`; inventory bookkeeping in `VRPlayerService` on the new events; collision ignore for held items; combat velocity stays rigidbody-based. | H2, H6, grab events | M-L (2 wk) | +| **3 - Sockets & inventory** | Socket interactor wrapper that reparents the `VobLoader` root (today's `VRSocket` behaviour), category rotation, filters by item flag (replaces tag socketables), hover scale/material, backpack + shoulder socket, hip holsters, chest slots resized to mesh, NPC loot sockets, "drop into chest" volume. | H7, `VRSocket`, `VRShoulderSocket`, `GUZ-VR-Socketables` | L (2-3 wk) | +| **4 - Mechanics** | `VrDoor`: HingeJoint + grab, lock/unlock, open/close threshold → Gothic SFX (replaces `HVRPhysicsDoor` + `HVRRotationTracker`, used by `VRVobDoor`, `VRVobContainerPhysicsChest`, lock picking). Ladders via XRI `ClimbInteractable`. | H8, H9 | M (1-2 wk) | +| **5 - Hands** | Hand meshes (UXR MIT hands or other CC0). `FingerCurlProvider`: grip/trigger/touch + `XRHandSubsystem` curls (Index, Steam Frame). `ProceduralHandPoser`: per-finger sweep until contact, cached per item instance. Authored poses for backpack/ladder. `PhysicsHand` (ConfigurableJoint follow, ghost hand, fist collider layer) behind an immersion setting. | H1, H3, H4, H5, H13 tuning | L-XL (3-5 wk) | +| **6 - Removal** | Delete HVR backend, `Assets/HurricaneVR`, `GOTHIC_HVR_INSTALLED`, `HurricaneActions.cs`, `VRContextToolActions.cs`, CI private-repo injection, hvr-simulator package; update CLAUDE.md, wiki, CONTRIBUTING (VR now builds for everyone). | everything | S (2-3 d) | + +\*Rough single-developer estimates, including playtesting on three platforms. Total ≈ **12-18 weeks**. Phases 2-4 +can run in parallel once Phase 1 has landed. + +### Ordering rationale + +- Phase 0 pays off right away: HVR moves into one folder, ~30 files compile without it, and later phases only swap + the backend. +- Phase 1 already unblocks contributors for menus, dialogs, UI, cinema, subtitles and locomotion work. To get there + early, the VR scene can boot with the XRI rig while grabbing is still missing (DeveloperConfig flag + `VrInteractionBackend`, see `feature-checklist` skill). +- Phase 5 is last because it carries the most tuning risk and the game is playable without it (non-physics hands + with procedural poses are acceptable first). + +## Assets plan (Prefabs via UnityMCP only, per CLAUDE.md) + +| HVR asset | Replacement | +|-----------|-------------| +| TechDemo XR rig | New `VR - Player.prefab` from XRI Starter Assets as reference, built through UnityMCP | +| Hand models / controller models | UXR hands (MIT, keep notice); controller models from XRI / OpenXR render models or none | +| Socket rings, teleport marker | Simple procedural/CC0 meshes + our URP materials | +| Backpack prefab + SFX | Gothic asset at runtime (a bag/pouch mesh from the Gothic install, loaded via ZenKit) + Gothic SFX - keeps the "no bundled assets" principle | +| Input maps, controller offsets | XRI Input Actions asset + per-profile pose offsets (OpenXR grip/aim poses mostly make them unnecessary) | +| HVR settings ScriptableObjects (joints, haptics, force pull) | Our own ScriptableObjects in `Gothic-VR/Resources/VR/Settings/` | + +## Risks and mitigations + +| Risk | Mitigation | +|------|-----------| +| The game feels worse than HVR (grab feel, hands) | Keep the HVR backend until Phase 5 is accepted in playtests. Compare side by side with the `playtest-planner` agent. | +| VelocityTracking grabs jitter with CharacterController motion | Same compensation as today (`linearVelocity - characterController.velocity`). Tune the XRI velocity/angular damping per weight class. | +| Procedural poser is expensive on Quest | Pose once on grab, cache per item instance, use simple colliders (we already compute item bounds). | +| Pico OpenXR quirks with XRI | XRI is the Unity-supported path for Pico's OpenXR SDK. Test early in Phase 1. | +| Accidental HVR code copies (license) | Write new code from behaviour specs (02 tables), not from HVR source. Reviewers check this. | + +## Fallback + +If XRI turns out unsuitable during Phase 1 (e.g. Pico input), the Phase 0 ports still make **UXR (forked) or a +from-scratch backend** possible without touching game code. That's the main reason Phase 0 comes first. diff --git a/Docs/HVR-replacement/README.md b/Docs/HVR-replacement/README.md new file mode 100644 index 000000000..5a2c81920 --- /dev/null +++ b/Docs/HVR-replacement/README.md @@ -0,0 +1,43 @@ +# HurricaneVR replacement assessment + +Goal: remove the paid HurricaneVR (HVR) dependency so every contributor can build and run the VR target on +Quest 2/3, Pico, PCVR, including Index / Steam Frame finger tracking. + +| Doc | Answers | +|-----|---------| +| [01-hvr-capabilities.md](01-hvr-capabilities.md) | What can HVR do (high and low level)? | +| [02-gothic-hvr-usage.md](02-gothic-hvr-usage.md) | Which of it do we use, where (code and prefabs), and which assets are licensed? | +| [03-framework-comparison.md](03-framework-comparison.md) | How does it map to UltimateXR, XR Interaction Toolkit, Meta ISDK and others? | +| [04-recommendation.md](04-recommendation.md) | What do we do, in which order, and at what cost? | + +### Implementation phases + +| Phase | Doc | Size | +|-------|-----|------| +| 0 | [phase-0-decouple.md](phase-0-decouple.md) - Gothic-owned ports, HVR behind one backend folder | M | +| 1 | [phase-1-rig-input-locomotion-ui.md](phase-1-rig-input-locomotion-ui.md) - XRI rig, input, locomotion, UI, simulator, CI | L | +| 2 | [phase-2-grabbing.md](phase-2-grabbing.md) - items, melee, distance grab, hover, mobs, NPCs | M-L | +| 3 | [phase-3-sockets-inventory.md](phase-3-sockets-inventory.md) - backpack, holsters, chest slots, NPC loot | L | +| 4 | [phase-4-doors-chests-ladders.md](phase-4-doors-chests-ladders.md) - hinges, lock picking, chest lids, ladders | M | +| 5 | [phase-5-hands.md](phase-5-hands.md) - hand models, finger curls, procedural posing, physics hands | L-XL | +| 6 | [phase-6-removal.md](phase-6-removal.md) - delete HVR, define, CI injection; update docs | S | + +## TL;DR + +- HVR 2.9.3: ~43k LoC. We use about a third of it, but that third is the hard part: **physics hands, physics + grabbing, procedural finger posing, sockets, physics doors, player controller and input**. +- Coupling: 62 VR files are gated by `GOTHIC_HVR_INSTALLED`. 32 use HVR directly, 8 only through our wrappers, and + **22 don't use it at all**. 18 of our prefabs/assets contain HVR components, and the player rig is a variant of + HVR's *TechDemo* rig. +- **UltimateXR** (MIT, ~109k LoC, 1.0 unreleased, Unity 2021/URP 12): good hand art and pose editor, but grabbing + is kinematic, posing is authored-only, there's no distance grab, climbing or simulator, and its device layer targets + Oculus/PicoXR/SteamVR SDKs instead of our OpenXR + XR Hands stack. As a base, that's a poor fit. +- **XR Interaction Toolkit 3.x** (free, Unity-maintained, same OpenXR/Input System/XR Hands stack) covers rig, + locomotion, teleport, climb, distance grab, velocity-tracked grabbing, sockets, UI, haptics and a simulator. + Missing: physics hands, procedural/authored hand posing. +- **Recommendation:** our own `Gothic.VR.Interaction` ports, with XRI as the backend, our own procedural poser, + physics hands and door/container components, plus selected UltimateXR borrowings (hands art, pose ideas). + Six phases, ≈12-18 developer-weeks. Phase 0 (decoupling behind ports while HVR still runs) comes first and keeps + every other option open. + +Snapshot: `main` @ `084e5e95`, 2026-10-22. UltimateXR checked at `dde5c47` (2026-06-08). diff --git a/Docs/HVR-replacement/phase-0-decouple.md b/Docs/HVR-replacement/phase-0-decouple.md new file mode 100644 index 000000000..7b54701bb --- /dev/null +++ b/Docs/HVR-replacement/phase-0-decouple.md @@ -0,0 +1,240 @@ +# Phase 0 - Decouple game code from HVR + +**Goal:** game code in `Gothic.VR` talks only to Gothic-owned interfaces (ports). HVR moves behind one backend +folder. Nothing changes for the player: HVR still runs everything. + +**Size:** M (1-2 weeks) · **Depends on:** nothing · **Unblocks:** all later phases, and any backend +(XRI, UltimateXR fork, own) + +## Exit criteria + +- [x] No file outside `Gothic-VR/Scripts/Interaction/Backends/Hvr/` has `using HurricaneVR…` or an `HVR*` type. + (Editor tooling about the backend is the exception: `Editor/Backends/Hvr/HurricaneActions.cs` converts the + HVR materials by folder path, `Editor/VRContextToolActions.cs` toggles the define. Neither uses HVR types.) +- [x] `#if GOTHIC_HVR_INSTALLED` exists only in the HVR backend folder and in `VRContextBootstrap` (backend selection). +- [x] `Gothic.VR` compiles with `GOTHIC_HVR_INSTALLED` removed. Without a backend, VR mode fails at boot with a clear + log error, not a compile error. +- [x] Our prefabs no longer wire HVR UnityEvents to our methods in the inspector; adapters subscribe in code. (0c) +- [ ] Playtest on Quest + PCVR shows no behaviour change (see test plan). + +## Proposed structure + +``` +Assets/Gothic-VR/Scripts/Interaction/ namespace Gothic.VR.Interaction… +├─ Models/ VrHandSide, VrButton, VrButtonState, VrGrabberKind, VrGrabArgs, VrHapticPreset, VrSitStand, +│ VrMoveDirection, VrTurnType +├─ Ports/ IVrRig, IVrInput, IVrHaptics, IVrUiPointers, IVrSocket, IVrSocketContainer +├─ Components/ VrInteractable (game-facing grab/hover events), VrSocketSlot (game-facing socket events) +└─ Backends/ + └─ Hvr/ #if GOTHIC_HVR_INSTALLED - HvrRig, HvrInput, HvrHaptics, HvrUiPointers, + HvrInteractableBridge, HvrSocketBridge, VRSocket/VRShoulderSocket/VRSimulatorControlsGUI (moved) +``` + +It stays inside the `Gothic.VR` assembly, so no new asmdef and the star topology is unaffected. Folder names and the +`Ports` term are a proposal; align with the team before PR 0a. + +## Design + +### Models (replace HVR enums) + +| New type | Replaces | Note | +|----------|----------|------| +| `VrHandSide { Left = 0, Right = 1 }` | `HVRHandSide` (34 uses) | Same int values. The lock-pick events pass `int` and `VrHapticsService` casts it to `HVRHandSide`, so keeping 0/1 keeps them working. | +| – | `GlobalEventDispatcher.HandSide { None=0, Left=1, Right=2, Both=3 }` | Keep it (fight events need `None/Both`), but add a `ToVrHandSide()` mapping in one place. Today the two enums use different numbers for Left/Right; document that in both enums. | +| `VrButton` (Grip, Trigger, Primary, Secondary, Menu, JoystickButton) and `VrButtonState { Active, JustActivated, JustDeactivated }` | `HVRButtons`, `HVRButtonState` | | +| `VrSitStand { Sitting=0, Standing=1, PlayerHeight=2 }`, `VrMoveDirection { Camera=0, LeftController=1, RightController=2 }`, `VrTurnType { Smooth=0, Snap=1 }` | `HVRSitStand`, `PlayerDirectionMode`, `RotationType` | **Same int values**: they're stored in the player's Gothic.ini (`VRConstants.IniNames`), so existing settings keep working. | +| `VrGrabberKind { Hand, Distance, Socket }` | `is HVRHandGrabber / HVRForceGrabber / HVRSocket` checks | | +| `VrGrabArgs { Kind, HandSide, Interactable, GrabberGo }` | `(HVRGrabberBase, HVRGrabbable)` event signature | | +| `VrHapticPreset { Info, Warning, Error, Success }` | `VrHapticsService.VibrationType` + `HapticData` | | + +### Ports + +```csharp +public interface IVrRig +{ + Transform Root { get; } + Transform Head { get; } + Transform LeftHand { get; } + Transform RightHand { get; } + Camera Camera { get; } + CharacterController CharacterController { get; } + float CameraHeight { get; } + bool IsGrounded { get; } + bool IsClimbing { get; } + + bool MovementEnabled { get; set; } + bool TurnEnabled { get; set; } + bool TeleportEnabled { get; set; } + bool CanJump { get; set; } + bool CanCrouch { get; set; } + bool CanSprint { get; set; } + float Gravity { get; set; } + float MaxFallSpeed { get; set; } + float MoveSpeed { get; set; } + float RunSpeed { get; set; } + float StepOffset { get; set; } + + void ApplyComfortSettings(VrSitStand sitStand, VrMoveDirection direction, VrTurnType turn, float snapDegrees, + float smoothSpeed); + void Teleport(Vector3 position, Quaternion rotation); + event Action Teleported; + void SetGrabbingEnabled(bool enabled); + void Fade(float alpha, float speed); +} + +public interface IVrInput +{ + VrButtonState GetButton(VrHandSide side, VrButton button); + bool IsSimulator { get; } +} + +public interface IVrHaptics +{ + void Vibrate(VrHandSide side, VrHapticPreset preset); +} + +public interface IVrUiPointers +{ + void RegisterCanvas(Canvas canvas); + void UnregisterCanvas(Canvas canvas); + void RegisterAllCanvases(); + bool TryGetHandSide(PointerEventData eventData, out VrHandSide side); +} +``` + +`VrInteractable` is a plain MonoBehaviour on every grabbable prefab (items, mobs, NPCs, backpack). It exposes C# +events (`HoverEntered`, `HoverExited`, `BeforeGrabbed`, `Grabbed`, `Released`) plus `IsHeld`, `Colliders`, +`ForceRelease()`, `SetupColliders()`. The backend bridge (`HvrInteractableBridge`, later `XriInteractableBridge`) +sits next to it, translates framework events into `VrGrabArgs` and forwards them. + +`IVrSocket` / `IVrSocketContainer`: `IsOccupied`, `Held`, `TryPlace(VrInteractable, bool raiseEvents)`, +`ForceRelease()`, `TryFindFree(VrInteractable, out IVrSocket)`, `Placed` / `Removed` events, plus audio fallback +clips. That covers everything `VRBackpack`, `VRNpcLoot` and `VRVobContainerPhysicsChest` call today. + +Registration: `IVrInput`, `IVrHaptics`, `IVrUiPointers` and `IVrSfxPlayer` as Reflex singletons in +`ReflexVRSceneInstaller`. +`IVrRig` is resolved from the scene by `VRContextInteractionService.SetupPlayerController` and exposed through it +(as `VRPlayerController` is today). + +## Work items + +Split into four PRs so each one stays reviewable. + +### PR 0a - Models and hand side + +- [x] Add `Interaction/Models/*` (`VrGrabArgs` waits for PR 0c, it needs `VrInteractable`). HVR mapping lives in + `Backends/Hvr/HvrEnumExtensions.cs` (`ToHvr()` / `ToVr()`). +- [x] Replace `HVRHandSide` in `VrWeaponAttackDomain`, `VRWeaponService`, `VRPlayerWeaponInteraction`, + `VRContainerDoorPickingInteraction`, `VrHapticsService` (`VibrationType` → `VrHapticPreset`). + `VRCinema` and `VRPlayerInputs` only pass it to `HVRController.GetButtonState`, so they move with `IVrInput` + in PR 0b. +- [x] `VRContextMenuService.cs:115` and `VRPlayerController.SetNormalControls`: replace `HVRSitStand`, + `PlayerDirectionMode` and `RotationType` with the new enums, converting at the HVR boundary + (`VRPlayerController.ApplyComfortSettings`, the later `IVrRig` method). + +### PR 0b - Rig, input, haptics, UI ports + +- [x] `IVrRig` ← `HvrRig` (was `VRPlayerController`, moved with its GUID, still subclassing + `HVRPlayerController`). Added to the sketch above: `TrackingSpace` (HVR's `CameraRig`; controller velocities + are relative to it, so it can't be `Root`) and `FadeAlpha` (`VRSeat` waits for the fade). +- [x] Gothic logic left the HVR subclass: new `Adapters/Player/VRPlayer` (on the same GameObject, wired in + `HVR - Player.prefab`) holds `MenuHandler`, `Cinema`, the swim step height, `IsMenuButtonEnabled` and the + menu / both-grips inputs. Control modes (locked, walking, water, swim, dive) and the Gothic.ini comfort + settings moved to `VRContextInteractionService`, which exposes `Rig` and `Player`. +- [x] Callers switch to `IVrRig`/`VRPlayer`: `VRContextInteractionService`, `VRSwimDive`, `VRSpectatorCamera`, + `VRCinema`, `VRCinemaService`, `VRFollowCamera`, `VRPlaceInFrontOfCamera`, `SpeechToTextHandler`, + `VRHandVelocityDebugger`, `VrWeaponAttackDomain`, `VRPlayerService.IgnorePlayerCollision`. + (`VRContextDialogService` only had "HVR" in a comment.) +- [x] `IVrInput` ← `HvrInput`. `VRPlayerInputs` became `Backends/Hvr/HvrPlayerInputs` (only HVR's keyboard + overrides for jump/crouch/sprint). Swimming reads `Grip` button states (identical to HVR's + `IsLeftGrabActivated`/`IsLeftGripHoldActive`) plus the new `IVrInput.GetControllerVelocity`. + The device simulator toggle moved to `IVrInput.SetDeviceSimulatorActive`. +- [x] `IVrHaptics` ← `HvrHaptics` (owns the preset table). `VRPlayerService.GetHand` is gone. +- [x] `IVrUiPointers` ← `HvrUiPointers`. Callers: `VRContextInteractionService`, `VirtualKeyboard`. +- [x] `VRSeat`: `IVrRig.Fade` / `FadeAlpha` instead of the `HVRCanvasFade` lookup; HVR's `FindChildRecursive` + replaced by our `FindChildRecursively`. +- [x] `SFXPlayer`: new port `IVrSfxPlayer` ← `HvrSfxPlayer` (still HVR's pool from `HVRGlobal.prefab`; an own + pool is a later phase). Callers: `VRWeaponService`, `VrWeaponAttackDomain`, `VRSwimDive`. +- [x] `VRSimulatorControlsGUI` moved to `Backends/Hvr/HvrSimulatorControlsGUI` (GUID kept). + +### PR 0c - Grab and socket events + +- [x] Add `VrInteractable`, `HvrInteractableBridge`, `IVrSocket(Container)`, `HvrSocketBridge`. + Added on the way: `VrGrabArgs`, `VrGrabberKind.Other` (e.g. HVR's chest collector, which the old code treated + as "neither hand nor socket"), `IVrGrabber` + `HvrGrabberBridge` for the hand and force grabbers (HVRGrabbable + has no `BeforeGrabbed` event, only the grabber has; the grabber bridge also raises + `VrInteractable.BeforeGrabbed`), `IVrRig.HandGrabbers`, `IVrInteractableBackend` (contract between + `VrInteractable` and its bridge) and `HvrGrabArgsFactory`. `IVrSocket` extends `IVrGrabber`, so "placed" / + "removed" are its `Grabbed` / `Released` events. `TryPlace(interactable, silent)` keeps HVR's "no grab sound" + flag (the old `TryGrab(g, true, true)` calls). Grabbables without a `VrInteractable` get one at runtime + (warning log). +- [x] Change adapter signatures from `(HVRGrabberBase, HVRGrabbable)` to `(VrGrabArgs)` and subscribe in + `Awake/OnEnable` instead of inspector bindings: `VRVobItem`, `VRPlayerItemAdapter`, `VRPlayerWeaponInteraction`, + `VRFocus`, `VRNpc`, `VRNpcMarvinAdapter`, `VRMobInteraction`, `VRSeat`, `VRBackpack`, + `VRVobContainerSocketInventory`, `VRNpcLoot`. + Subscribed in `Awake` / unsubscribed in `OnDestroy` (persistent calls also fired for disabled components). + `VRMobInteraction` and `VRNpcMarvinAdapter` subscribe in `Start`, so `VRSeat` / `VRNpc` still run first. + Cross-hierarchy wiring is serialized as GameObject lists: `VRBackpack._holsterSockets` / `_inventorySockets`, + `VRVobContainerSocketInventory._additionalSockets` (holsters; its own child sockets are found in code). + The NPC health bar hover (`StatusBarAdapter.EnableBar/DisableBar`, Gothic.Core) moved into `VRNpc`. +- [x] `VRPlayerService.SetGrab/UnsetGrab/IgnorePlayerCollision`: branch on `VrGrabArgs.Kind`, use + `VrInteractable.Colliders`. +- [x] `VRDigSpot`: replace `FindObjectsByType` + `GrabbedTarget` with a query on + `VRPlayerService` (`GrabbedItemLeft/Right` already exist). +- [x] `VRVobContainerPhysicsChest` subclasses `HVRPhysicsDoor`. For now move it under `Backends/Hvr`; Phase 4 + replaces it. The socket part goes through `IVrSocketContainer`. (Renamed to `HvrPhysicsChest`, GUID kept. + `VRSocket` / `VRShoulderSocket` moved to `Backends/Hvr/HvrSocket` / `HvrShoulderSocket`, GUIDs kept. + `HvrSocket` still re-implements parts of `HVRSocket`; rewrite it with the own socket in a later phase.) +- [x] `VRVobDoor`, `VRVobContainer` (door SFX), `VRContainerDoorPickingInteraction` (`Lock/Unlock`): add a small + `IVrHinge` port (`Lock()`, `Unlock()`, `SetSounds(open, close)`) implemented by an HVR bridge. + (`HvrHingeBridge`; also exposes `Transform` and `Rigidbody` for the push after unlocking. The lock picking + finds the hinge via the VobLoader instead of a serialized `HVRPhysicsDoor` reference.) +- [x] **Prefabs (UnityMCP only):** in all 11 VR prefabs, add `VrInteractable` + bridge next to `HVRGrabbable` and + remove the inspector UnityEvent bindings to our methods (17× `OnBeforeGrabbed`, 18× `OnReleased`, 10× + `OnHoverEnter/Exit`, holster/backpack callbacks, …). If UnityMCP isn't connected, stop and report (CLAUDE.md). + Bridges were added next to every `HVRGrabbable`, `HVRSocket`, `HVRSocketContainer`, `HVRPhysicsDoor` and the + hand/force grabbers. Effective persistent calls from HVR events to Gothic methods: 0 (UI button bindings stay). + Dead overrides on a removed TechDemo component in `HVR - Player.prefab` were dropped as well. + +### PR 0d - Gating and leftovers + +- [x] Remove `#if GOTHIC_HVR_INSTALLED` from the 22 files that don't use HVR (list in 02 §6) and from the 8 that + only used our wrappers. (After 0a-0c this was 49 files under `Gothic-VR/Scripts`, all file-level wrappers.) +- [x] `VRContextBootstrap`: select the backend (`Hvr` for now). If none is available, log + `Logger.LogError(…, LogCat.VR)` with a hint to set `GameControls = Flat` or install a backend, then throw as + today. (Switching to Flat automatically would mean loading the Flat player scene; not worth it for a + transitional state.) `VRContextBootstrap.SelectBackend()` returns an `IVrBackend` (`HvrBackend`) or null. +- [x] `ReflexVRSceneInstaller`: always compiled; registers port implementations from the active backend. + (`IVrBackend.InstallBindings()`. Without a backend it logs an error and registers no ports; the Player scene + is loaded before `InitPhase1()`, so this error comes before the bootstrap error.) +- [x] `Gothic-Lab/…/LabFightHandler.cs`: replace the `HurricaneVR.Framework.Core.Utils` helper with our own extension. + (Its only use was `IsNullOrWhiteSpace()`; replaced by `string.IsNullOrWhiteSpace()`, no extension needed.) +- [x] `Gothic-Core/Scripts/Const/Constants.cs:113-117`: change the comment "HVR Layers" to "VR layers". Layer names + stay (`TagManager.asset` unchanged). +- [x] Remove the HVR wording from comments in `MobInteractionService`, `VobService` and `NpcHelperService`. + (Also `VobInitializerDomain` and `ResourceCacheService`.) + +## Test plan (unchanged behaviour) + +Run on Quest (OpenXR) and PCVR (Index if available), G1 and G2: + +1. Boot → main menu laser works, Marvin logo poke vibrates the correct hand. +2. Move/snap/smooth turn; change sit-stand, direction and turn settings in the accessibility menu → applied live and + kept after a restart (Gothic.ini compatibility). +3. Pick up an item by hand and by distance grab → inventory count +1; drop → -1; two-hand grab doesn't double-count. +4. Holster a sword on the hip; backpack on the shoulder; put an item in and out of the backpack, check pages. +5. Open a chest, take/put items; lock-pick a chest and a door → haptics on the correct hand per combo result. +6. Talk to an NPC by grabbing; loot a dead NPC. +7. Use a mob (wheel/bed), a ladder, a dig spot. +8. Swim and dive (stroke movement, fade with air), walk out of water. +9. Melee hit an NPC; fight-window haptics. +10. Desktop simulator (`EnableVRDeviceSimulator`): WASD, Esc menu, hand keys. +11. Build with the define removed → compiles; VR boot logs the "no backend" error. Flat mode boots normally. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| Event ordering differs from the old inspector bindings (e.g. `VRPlayerItemAdapter.OnBeforeGrabbed` must enable physics before HVR moves the item) | The bridge raises `BeforeGrabbed` synchronously from HVR's `BeforeGrabbed`. Keep the order of subscription identical to the old inspector order. | +| Remote grab raises `SetGrab` twice (force grabber + hand grabber) | Keep today's guard in `VRPlayerService`. The bridge passes `Kind = Distance` for the first call. | +| Prefab rewiring misses a binding | Grep `m_MethodName` in `Gothic-VR/Resources/VR/Prefabs` before/after: the count of our method bindings must reach 0. | diff --git a/Docs/HVR-replacement/phase-1-rig-input-locomotion-ui.md b/Docs/HVR-replacement/phase-1-rig-input-locomotion-ui.md new file mode 100644 index 000000000..d5ddc86bc --- /dev/null +++ b/Docs/HVR-replacement/phase-1-rig-input-locomotion-ui.md @@ -0,0 +1,153 @@ +# Phase 1 - XRI rig, input, locomotion, UI, simulator + +**Goal:** a second player rig built on XR Interaction Toolkit that implements the Phase 0 ports `IVrRig`, +`IVrInput`, `IVrHaptics` and `IVrUiPointers`. A contributor without HVR can boot into the world, walk, swim, use +menus and dialogs, and watch videos, on a headset or in the simulator. Grabbing is not part of this phase. + +**Size:** L (2-3 weeks) · **Depends on:** Phase 0 · **Unblocks:** Phases 2-4 (parallel) + +## Exit criteria + +- [ ] `DeveloperConfig.VrInteractionBackend = Xri` boots Quest, Pico and PCVR builds into the world without HVR + installed. +- [ ] Every comfort setting from the accessibility menu works on the XRI rig, and existing Gothic.ini values load. +- [ ] Menus, dialogs, virtual keyboard, cinema, subtitles, print-screen messages and the spectator camera work. +- [ ] Swimming/diving behaves as on HVR (strokes, gravity, fade with air, walking out of water). +- [ ] The XR Interaction Simulator replaces the HVR simulator for the Xri backend. +- [ ] CI builds the Xri backend without the private HVR repo (new job or label). + +## Packages + +- Add `com.unity.xr.interaction.toolkit` 3.x. Pin an exact version that is at least 2 weeks old and compatible with + Unity 6000.3 (check the package manager "compatible" list). `com.unity.inputsystem` and `com.unity.xr.core-utils` + come in as dependencies. +- Import the samples **Starter Assets** (input actions, reference rig) and **XR Interaction Simulator**. Copy what we + need into `Gothic-VR/` and don't reference the `Samples/` folder from our prefabs, so a sample re-import can't break + us. +- Keep OpenXR 1.16, the Meta Quest feature, `pico-openxr-sdk` and XR Hands 1.7 as they are. XRI uses exactly these. + +## Backend switch + +- Add `DeveloperConfig.VrInteractionBackend { Hvr, Xri }`: the C# field **and** the value in the DeveloperConfig + asset (see the `feature-checklist` skill). Default `Hvr` while HVR is installed, `Xri` otherwise. +- `Player.unity` (and `Lab.unity`) contain both rigs, disabled. `VRContextInteractionService.SetupPlayerController` + enables the one matching the backend (today it already enables `transform.parent.parent`). +- The Xri backend files carry no define, since XRI is free and always installed. The Hvr backend stays behind + `GOTHIC_HVR_INSTALLED`. + +## Rig (`Gothic-VR/Resources/VR/Prefabs/VR - Player XRI.prefab`, built via UnityMCP) + +``` +VR - Player XRI +└─ XR Origin (XROrigin, CharacterController, XRBodyTransformer, LocomotionMediator) + ├─ Camera Offset + │ ├─ Main Camera (TrackedPoseDriver, Camera, AudioListener, WallFade, ScreenFade) + │ ├─ Left Controller (TrackedPoseDriver / XRI controller input, NearFarInteractor [Phase 2], hand visual) + │ └─ Right Controller (same) + ├─ Locomotion + │ ├─ ContinuousMoveProvider (forward source = head / left / right controller) + │ ├─ SnapTurnProvider + ContinuousTurnProvider (one enabled at a time) + │ ├─ TeleportationProvider + │ ├─ GravityProvider, JumpProvider + │ └─ ClimbProvider [Phase 4] + └─ Gothic components moved from the HVR rig: MenuHandler, VRCinema, VRSwimDive, VRSpectatorCamera, + VRUiOnTop, VRPlaceInFrontOfCamera, VRPrintScreen anchor, VRMouth, VRHandsOnTop, … +``` + +`XriRig : MonoBehaviour, IVrRig` maps the port onto these components. + +| `IVrRig` member | XRI implementation | +|-----------------|--------------------| +| `MovementEnabled` / `TurnEnabled` / `TeleportEnabled` | enable/disable the providers (or their input actions) | +| `MoveSpeed` / `RunSpeed` / `CanSprint` | `ContinuousMoveProvider.moveSpeed`; sprint is **ours**: a sprint action switches between the two speeds | +| `Gravity` / `MaxFallSpeed` | `GravityProvider` (gravity, terminal velocity); swimming sets 0 | +| `CanJump` | `JumpProvider.enabled` | +| `CanCrouch` | **ours**: a crouch action toggles an extra `Camera Offset` y-offset and shrinks the `CharacterController` height | +| `StepOffset` | `CharacterController.stepOffset` | +| `IsGrounded` | `CharacterController.isGrounded` (or `GravityProvider.isGrounded`) | +| `IsClimbing` | `ClimbProvider` state (Phase 4; `false` until then) | +| `Teleport(pos, rot)` | `TeleportationProvider.QueueTeleportRequest` with `MatchOrientation.TargetUpForward`; raise `Teleported` after the provider applied it. Today's workaround of setting rotation afterwards (`VRContextInteractionService.cs:202`) may no longer be needed. Verify. | +| `ApplyComfortSettings` | `VrSitStand.Sitting` → `XROrigin.RequestedTrackingOriginMode = Device` + `CameraYOffset` = eye height. `Standing`/`PlayerHeight` → `Floor`. HVR's `Standing` *scales* the camera (`HVRCameraRig.cs:244`); if we want that, scale `Camera Offset` by `EyeHeight / HMD height` ourselves. `VrMoveDirection` → `ContinuousMoveProvider.forwardSource`. `VrTurnType` → enable snap or continuous turn. `snapDegrees` → `SnapTurnProvider.turnAmount`. `smoothSpeed` → `ContinuousTurnProvider.turnSpeed`. | +| `SetGrabbingEnabled` | no-op in Phase 1; Phase 2 toggles the interactors | +| `Fade(alpha, speed)` | own `ScreenFade` (see below) | + +## Input (`Gothic-VR/Resources/VR/Input/GothicVR.inputactions`) + +Start from the Starter Assets actions and add Gothic actions per hand: + +| Action | Binding (Quest/Pico/Touch-style) | Index | Simulator key | +|--------|----------------------------------|-------|---------------| +| Menu | left secondary (Y) | left B | Esc | +| Jump | right primary (A) | right A | Space | +| Crouch | right secondary (B), as today (`HVRPlayerInputs.GetCrouch`; Vive: trackpad up) | right B | Z / X | +| Sprint | left thumbstick click, as today (`HVRPlayerInputs.GetSprinting`) | same | Left Shift | +| BothGrips | derived in `VRPlayerInputs` from both grip actions | | T | +| SkipVideo | trigger or primary, either hand (`VRCinema`) | | | + +`XriInput : IVrInput` reads the actions and keeps a `VrButtonState` per hand/button (pressed this frame / held / +released this frame). `IsSimulator` is true when the simulator is active. + +## Haptics + +`XriHaptics : IVrHaptics` uses one `HapticImpulsePlayer` per controller. Map the presets from `VrHapticsService` +(amplitude/duration/frequency as today: Info 0.15/0.25/30, Warning 0.25/0.5/100, Error 0.4/0.8/175, +Success 0.5/0.6/80). Note: HVR's `HapticData(duration, amplitude, frequency)` argument order. Check it and keep the +same perceived strength. + +## UI + +- `EventSystem` gets `XRUIInputModule` instead of `HVRInputModule` (rig variant only). +- `XriUiPointers.RegisterCanvas` adds a `TrackedDeviceGraphicRaycaster` to the canvas (if missing). + `RegisterAllCanvases` keeps today's one-shot scan in `InitUIInteraction`, but it can be removed later once all VR + canvases carry the raycaster in their prefabs. +- `TryGetHandSide(eventData)`: `TrackedDeviceEventData.interactor` → which controller → `VrHandSide` (Marvin logo + haptics). +- Ray interactor per hand for UI only in this phase (Phase 2 replaces it with the Near-Far interactor). + +## Fades + +- `ScreenFade`: a camera-attached inverted sphere or quad with an unlit URP material whose alpha is driven by + `Fade(alpha, speed)`. Used by `VRSwimDive` (dive darkness by air), `VRSeat`, and scene transitions where + `HVRCanvasFade` is used today. +- `WallFade` (replaces `HVRHeadCollision`): `Physics.OverlapSphere` on the camera with the world layers. Fade towards + black by penetration depth. UltimateXR's `UxrCameraWallFade` (MIT) is a reference. + +## Swim/dive (`VRSwimDive.cs`) + +Already on `IVrRig` after Phase 0. Check: +- Stroke movement reads `IVrRig.LeftHand/RightHand` positions and moves `CharacterController` directly. The XRI + providers must not fight it, so `MovementEnabled = false` while swimming, as today. +- Rotation math (`VRSwimDive.cs:350-415`) assumed HVR's rig hierarchy (`CameraRig.TransformDirection`). Re-check + with `XROrigin.Origin` and the camera's yaw. + +## Simulator + +- Use the XR Interaction Simulator prefab in `Player.unity`. Enable it via `EnableVRDeviceSimulator`, as today with + `HVRBodySimulator`. +- Port the on-screen help from `VRSimulatorControlsGUI` (keys list) as a small `OnGUI`/UGUI overlay. + +## CI + +- Add a build job that doesn't inject HVR, removes `GOTHIC_HVR_INSTALLED` and sets the backend to `Xri`. Methods + stay `VRBuilderActions.Perform*Build`. + +## Test plan + +On Quest 3, Pico 4 and PCVR (Index), backend `Xri`: +1. Main menu: laser click on every menu page, virtual keyboard (save name), settings sliders. +2. All accessibility settings: sit-stand (sitting in a chair → eye height correct), move direction head/left/right, + snap 5°…, smooth speed min/max. Restart → kept. +3. Walk, sprint, jump, crouch, fall from a ledge, walk up stairs, Xardas' tower water exit (step height). +4. Teleport from code: new game spawn, `TeleportPlayerTo` (Marvin goto, chapter change), spectator camera follows. +5. Dialog with an NPC (start with the menu fallback until Phase 2 grab-to-talk), subtitles, cinema video, skip. +6. Swim and dive; air bar fade; climb out. +7. Head into a wall → fades. +8. Simulator on a desktop without a headset: all of the above that applies. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| Sitting/Standing semantics differ from HVR | Implement `PlayerHeight` first (most players), then `Sitting`; check `Standing` scaling with a playtester. | +| Pico button names differ in OpenXR profiles | Test the Pico 4 profile early; bind via the generic `{LeftHand}/secondaryButton` paths where possible. | +| Gravity/jump providers vs. our `KeepPlayerWithin` (`controller.Move`) | Both move the `CharacterController`. Keep `KeepPlayerWithin` after the providers (late update order) and verify dialogs. | diff --git a/Docs/HVR-replacement/phase-2-grabbing.md b/Docs/HVR-replacement/phase-2-grabbing.md new file mode 100644 index 000000000..1545761bf --- /dev/null +++ b/Docs/HVR-replacement/phase-2-grabbing.md @@ -0,0 +1,106 @@ +# Phase 2 - Grabbing (items, mobs, NPCs, distance grab, hover) + +**Goal:** on the Xri backend, everything that is an `HVRGrabbable` today works through `VrInteractable` + +`XriInteractableBridge`: picking items up (inventory), melee weapons, distance grab, hover focus, using mobs, and +talking to or looting NPCs. + +**Size:** M-L (2 weeks) · **Depends on:** Phase 0 + Phase 1 · **Parallel with:** Phases 3, 4 + +## Exit criteria + +- [ ] Item pickup by hand and by distance grab adds to the inventory exactly once; two-hand grab doesn't double-count; + drop removes. +- [ ] Melee: weapon velocity detection (`VrWeaponAttackDomain`) triggers hits with the same thresholds as on HVR. +- [ ] Hover shows the name label and highlight (`VRFocus`). +- [ ] Grab on NPC = talk / skip line; grab on a dead NPC = loot panel; grab on a mob = use it. +- [ ] Held/socketed items don't push the player's `CharacterController`. +- [ ] Swimming disables grabbing and hovering (`IVrRig.SetGrabbingEnabled(false)`). + +## Mapping + +| Today (HVR) | Xri | +|-------------|-----| +| `HVRGrabbable` on `oCItem` (PoseType PhysicPoser, HoldType ManyHands, ForceGrabbable, RequireLineOfSight) | `XRGrabInteractable`, **movementType = VelocityTracking**, `selectMode = Multiple`, `XRGeneralGrabTransformer` (two hands), `useDynamicAttach = true` (hand grabs where it touches; no authored attach points needed for runtime meshes) | +| `HVRHandGrabber` | `NearFarInteractor` per hand (near = direct grab, far = distance grab + UI). It replaces Phase 1's UI-only ray. | +| `HVRForceGrabber` (pull to hand) | Near-Far far-select; the interactable flies to the attach point. Pull speed via `attachEaseInTime`. Line of sight: our own `XRBaseTargetFilter` doing a linecast hand → target (excluding the item's own colliders). | +| `HVRGrabbable` on mobs (`oCMobBed/Fire/Inter/Switch/Wheel`) and `oCNpc` | `XRSimpleInteractable` (select = "use/talk", nothing moves). This removes the "grab then `ForceRelease()` immediately" workaround in `VRNpc.OnGrabbed`. | +| `HVRGrabbable.HoverEnter/Exit` | `hoverEntered/hoverExited` → `VrInteractable.HoverEntered/Exited` | +| grabber `BeforeGrabbed` | No direct XRI equivalent. Options: (a) `XRGrabInteractable` subclass overriding `OnSelectEntering` (called before `selectEntered`), or (b) a select filter that runs our callback in `Process`. Use (a): `GothicGrabInteractable : XRGrabInteractable`. | +| `Grabbed` / `Released` | `selectEntered` / `selectExited` | +| `HVRGrabbable.SetupColliders()` (`VRVobItem.Start`) | XRI collects colliders on `Awake`/registration. Our items get the `MeshCollider` at runtime, so call `interactionManager.UnregisterInteractable` + `RegisterInteractable` after the collider exists, or create the interactable after the collider. | +| `HVRGrabbable.Colliders` | `XRBaseInteractable.colliders` | +| `IsBeingHeld` | `isSelected` | +| Per-hand `AllowGrabbing/AllowHovering` | `NearFarInteractor.enabled` / `allowSelect` / `allowHover` | + +### `VrGrabArgs.Kind` with Near-Far + +The same interactor does both near and far, so `Kind` comes from `NearFarInteractor.selectionRegion` +(`Near` → `Hand`, `Far` → `Distance`) at selection time. HVR raised two grabs for distance grab (force grabber, +then hand grabber); XRI raises one. Keep `VRPlayerService`'s duplicate guard anyway; it's harmless. + +## Item flow (unchanged game logic) + +`VRPlayerItemAdapter.OnBeforeGrabbed` enables physics (Gothic items lie kinematic) → `VRVobItem.OnGrabbed`: +ghost layer `VobItemNoWorldCollision` + transparency for 1 s, culling tracking, `VRPlayerService.SetGrab` (inventory) +→ release reverses it. These adapters only change their subscription (done in Phase 0). Check: + +- VelocityTracking needs a non-kinematic rigidbody **before** the first fixed update of the grab. That's what + `OnBeforeGrabbed` already guarantees. +- `throwOnDetach` stays on (throwing items). Tune `throwVelocityScale` against HVR's feel. +- Ghost layer: the `VobItemNoWorldCollision` layer must still collide with nothing in the world during the grab + but also not block the interactor's physics queries. Check the Near-Far casting mask. + +## Melee (`VrWeaponAttackDomain`, `VRWeaponService`, `VRPlayerWeaponInteraction`) + +- The velocity source stays `weaponRigidbody.linearVelocity - characterController.velocity` + (`VrWeaponAttackDomain.cs:361`). It works because VelocityTracking keeps the weapon dynamic. +- Tune `velocityDamping`, `velocityScale`, `angularVelocityDamping` and `angularVelocityScale` of + `XRGrabInteractable` so a fast swing reaches `WeaponPhysicsConfig.WeaponVelocityThreshold`. If XRI's damping lowers + peak speeds, lower the threshold per backend rather than changing the HVR values. +- Heavy two-handers: HVR had per-grabbable hand strength. XRI has no "strength"; VelocityTracking always reaches the + target. Optional: scale `velocityScale` by item weight (Gothic `ItemInstance` has no mass; use the weapon category). +- Hand side for `VRWeaponService.OnGrabbed(handSide, …)`: from the interactor's handedness + (`InteractorHandedness`) → `VrHandSide`. + +## Hover focus (`VRFocus`) + +Subscribe to `VrInteractable.HoverEntered/Exited`. Only show it for the **closest** hovered target per hand: +Near-Far already sorts targets, so react to the first valid target only (avoid label flicker when several items +overlap). + +## Dig spots (`VRDigSpot`) + +After Phase 0 it asks `VRPlayerService` for the held items. No XRI work beyond verifying the left/right mapping. + +## Prefab work (UnityMCP only) + +| Prefab | Change | +|--------|--------| +| `Vobs/oCItem.prefab` | add `GothicGrabInteractable` (VelocityTracking, dynamic attach, multiple select, throw on detach) + `XriInteractableBridge`. Keep the HVR components while both backends exist; only the bridge for the active backend initialises (it checks `VrInteractionBackend`). | +| `Vobs/oCMob{Bed,Fire,Inter,Switch,Wheel}.prefab`, `Vobs/oCNpc.prefab` | add `XRSimpleInteractable` + bridge | +| `VR - Player XRI.prefab` | Near-Far interactor per hand, layer masks (`Grabbable`, `VobItem`, `VobNpcOrMonster`, mob layers) | + +Both backends on one prefab double the component count for a while. That's acceptable until Phase 6 removes the +HVR ones. + +## Test plan (Xri backend; repeat the relevant steps on Hvr to catch regressions) + +1. Pick up apple, sword, torch: inventory +1 (check in the backpack / status). Drop: -1. +2. Hold the sword with both hands, release one hand: no inventory change. Release both: -1. +3. Distance grab an item behind a fence: blocked by line of sight. In the open: flies to the hand. +4. Pull an item out of a chest that it was overlapping: no getting stuck, ghost transparency for ~1 s. +5. Melee a scavenger: hits register on fast swings only; fight-window haptics on the weapon hand. +6. Hover over many items on a table: one label at a time, per hand. +7. Grab an NPC: dialog starts; grab during the dialog: line skipped; dead NPC: loot panel. +8. Bed (sleep), wheel, switch, fire (cook): mob use triggers; the seated NPC stays kinematic. +9. Swim: no grab or hover possible; leave the water: possible again. +10. Throw an item: flies plausibly far. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| Hand and item separate visually (no physics hands until Phase 5) | Accept for now, or attach the hand model to the item while held (`XRGrabInteractable` → parent the hand visual to the attach transform). That's a cheap interim fix worth doing. | +| VelocityTracking jitter while walking | Turn on rigidbody interpolation for held items and test XRI's visual-smoothing options for velocity-tracked grabs. Test while running. | +| API names in this doc drift from the pinned XRI version | Names here follow XRI 3.x docs. Verify each one with `unity_reflect` / the package docs before implementing. | +| Runtime colliders not registered | Register the interactable after `VobItem` creation (see the mapping table). Add a log warning if `colliders.Count == 0` on hover registration. | diff --git a/Docs/HVR-replacement/phase-3-sockets-inventory.md b/Docs/HVR-replacement/phase-3-sockets-inventory.md new file mode 100644 index 000000000..d4d6928be --- /dev/null +++ b/Docs/HVR-replacement/phase-3-sockets-inventory.md @@ -0,0 +1,118 @@ +# Phase 3 - Sockets and inventory (backpack, holsters, chests, NPC loot) + +**Goal:** every place that holds items, implemented on the Xri backend behind `IVrSocket` / `IVrSocketContainer` +(Phase 0), with the same Gothic logic as today: inventory counts, save-game vob list, culling, pages and categories. + +**Size:** L (2-3 weeks) · **Depends on:** Phases 0-2 · **Parallel with:** Phase 4 + +## Exit criteria + +- [ ] Backpack: grab from the shoulder, browse categories/pages, take items out, put items in; the inventory and the + save-game vob list stay consistent. +- [ ] Hip/back holsters keep weapons; drawing and holstering updates the inventory as today. +- [ ] Chests: the content spawns into slots (scaled down), items can be taken and put back; dropping an item into the + open chest stores it. +- [ ] NPC loot: equipped and inventory items appear in loot slots, taking one moves it to the player. +- [ ] Hover feedback on slots (scale and valid/invalid material) is equivalent to HVR. +- [ ] Socket sounds: Gothic `InvOpen`/`InvClose` for the backpack, socket fallback sounds for slots, silent bulk + spawning. + +## What HVR does for us today (behaviour spec, write new code from this, not from HVR source) + +| Behaviour | Where | Settings | +|-----------|-------|----------| +| Socket holds a grabbable, **re-parents the `VobLoader` root** (not the grabbable child), resets local pose, rotates by item category | `VRSocket` (ours, subclass) | rotation table in `VRSocket.RotateItemForCategorySlot` | +| On release, restores `Grabbable → VobLoader → previous parent` and skips destroyed loaders | `VRSocket.OnReleased` | | +| **Scales the item down to fit** the slot (by model bounds) and restores the scale on removal | `HVRSocket.ScaleGrabbable` | backpack slot `Size 0.05`, chest slot `Size 0.18` | +| Only items are accepted | `HVRTagSocketFilter` + `GUZ-VR-Socketables.asset` | only one tag exists: "Items General" | +| Hover feedback | `HVRSocketHoverScale`, `HVRSocketHoverMaterial` (Valid/InvalidSocketRing) | | +| Container = list of slots, find a free one, add programmatically | `HVRSocketContainer.Sockets`, `TryFindAvailableSocket`, `TryAddGrabbable` | | +| Drop into the chest volume → auto-place into a free slot | `HVRSocketContainerGrabber` + `HVRTriggerGrabbableBag` on `oCMobContainer` | | +| Backpack itself is socketable onto the shoulder; sounds on (un)socket | `HVRShoulderSocket`/`VRShoulderSocket`, `HVRSocketable` | clips set in `VRBackpack.Init` | +| Backpack slots follow the backpack | `HVRSocketLink`, `DemoBackpack` (TechDemo) | | +| Detection mode | `GrabDetectionType: 1` (trigger-based), `ParentDisablesGrab: 1` for backpack slots, `CanRemoveGrabbable: 1` | | +| Programmatic place | `socket.TryGrab(grabbable, true, true)` (`VRNpcLoot`, chests) | | + +## Design + +### `VrSocketSlot` (component, backend-neutral game logic) + +Owns the Gothic behaviour: re-parent the `VobLoader` root, category rotation, scale-to-fit (bounds of the item's +renderers, computed once and cached per item), restore on removal, sounds, and `Placed/Removed` events with +`VrGrabArgs`. It does **not** depend on XRI. + +### `XriSocketBridge : XRSocketInteractor` (backend) + +- Uses XRI's socket for detection, hover and select. +- Overrides the attach/re-parent step so `VrSocketSlot` does the Gothic re-parenting instead of XRI moving the + grabbable child. XRI 3.x has a socket scale mode (fixed / fit to bounds). Check it against our `VobLoader` + hierarchy; if it scales the wrong transform, scale in `VrSocketSlot` and leave XRI's at "none". +- Select filter: accept only `VrInteractable`s whose `VobLoader` is an item (`oCItem`). That replaces the tag + socketables, since there is only one tag anyway. If we later want per-slot categories (only weapons on the hip), + filter by `ItemInstance.MainFlag`. +- Hover feedback: XRI's `showInteractableHoverMeshes` gives a ghost preview. Additionally, port the scale/material + ring feedback as a small `VrSocketHoverFeedback` component (own ring mesh + valid/invalid URP materials). + +### `VrSocketContainer` + +Holds `VrSocketSlot`s and implements `IVrSocketContainer`: `TryFindFree`, `TryPlace`, `SetSilent(bool)` (replaces +the audio-null juggling in `VRVobContainerPhysicsChest.PreSpawnContent/PostSpawnContent`). + +### Drop into chest + +`VrContainerDropZone`: trigger collider inside the open chest. When a held item is released inside it (listen to +`VrInteractable.Released` + overlap check), call `container.TryPlace`. Simpler than HVR's bag + container grabber. + +### Backpack on the shoulder + +- The backpack is a `GothicGrabInteractable` (Phase 2) and the shoulder is an `XriSocketBridge` near the head-relative + shoulder anchor. While it's on the shoulder, its slots are disabled (`ParentDisablesGrab` behaviour). +- Replace `DemoBackpack` + `HVRSocketLink` (TechDemo): slots are children of the backpack, so they follow + automatically; enable/disable them on shoulder (un)socket. +- `VRBackpack.OnBackpackReleasedFromShoulder` (refresh the inventory view) hooks into the shoulder socket's + `Removed` event. +- Authored hand pose on the backpack strap: Phase 5. Until then, dynamic attach. + +### Holsters + +Today: two `VRSocket`s on the player rig (hip), plus HVR TechDemo `DemoHolster` / `HeadRelativeInventory`. New: two +`VrSocketSlot` + `XriSocketBridge` on body-relative anchors. They follow the head yaw, not the head pitch (same idea +as HVR's head-relative inventory). `VRBackpack.OnItemPutIntoHolster/OutOfHolster` subscribe to their events. + +## Work items + +- [ ] `VrSocketSlot`, `VrSocketContainer`, `VrSocketHoverFeedback`, `VrContainerDropZone` (backend-neutral). +- [ ] `XriSocketBridge`, filter, attach override. +- [ ] Move the logic of `VRSocket` / `VRShoulderSocket` into `VrSocketSlot`. The HVR versions stay in + `Backends/Hvr` until Phase 6. +- [ ] `VRBackpack`: uses `IVrSocketContainer` (already after Phase 0), handles page refresh with + `TryPlace(…, raiseEvents: false)` instead of `_tempIgnoreSocketing` if possible. +- [ ] `VRVobContainerPhysicsChest`: split into `VrChestLid` (Phase 4) + `VrChestSlots` (this phase: resize slots to the + chest mesh, as today's `AlignSockets` logic, bulk spawn silently, pagination still TODO as logged today). +- [ ] `VRNpcLoot`: create `VrSocketSlot`s at runtime instead of `HVRSocket`s; `Removed` → `OnItemTakenFromLoot`. +- [ ] `VRVobContainerSocketInventory`: subscribe to container events. +- [ ] **Assets (UnityMCP):** new `VR Socket Slot.prefab` (replaces `VRBackpack(Large)InventorySlot` + HVR's + `LargeInventorySlot` / `SocketOval`), ring mesh (simple torus, our own) + `SocketRing/Valid/Invalid` URP materials, + add slots to `oCMobContainer.prefab` and the backpack prefab, shoulder + hip anchors on the XRI rig. +- [ ] Remove `GUZ-VR-Socketables.asset` usage on the Xri path (keep the file until Phase 6). + +## Test plan + +1. New game: backpack on the shoulder; grab it off → slots show the current category; flip pages/categories; put it + back on the shoulder → `InvClose` sound. +2. Pick up an apple, put it into the backpack → inventory +1, the vob disappears from the world (save → load: not in + the world, in the inventory). +3. Take it out again → world vob again (save → load: in the world). +4. Holster a sword at the hip, walk, teleport, swim (grab disabled), draw it again. +5. Open a chest with 20 items: slots scaled to the chest, items mini-sized, no sound burst while spawning. +6. Take an item, put it back by dropping it into the open chest. +7. Kill a bandit, loot: equipped weapon shows `[E]`, taking it removes the weapon mesh from the corpse. +8. Hover an item over a full slot → invalid feedback; over a free slot → valid. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| XRI socket moves the grabbable child, breaking the `VobLoader` hierarchy (culling and save rely on it) | Attach override in `XriSocketBridge`; unit-check the hierarchy after place/remove in a PlayMode test (`Gothic.Tests.PlayMode`). | +| Scale-to-fit needs mesh bounds one frame after spawn (today's `yield return null`) | Keep the frame wait in bulk spawn; compute bounds from renderers, not colliders. | +| Kinematic vs. dynamic state of items in slots | A socketed item is kinematic, with collisions off against the player (`IgnorePlayerCollision`, Phase 0). On removal, Phase 2's grab flow takes over. | diff --git a/Docs/HVR-replacement/phase-4-doors-chests-ladders.md b/Docs/HVR-replacement/phase-4-doors-chests-ladders.md new file mode 100644 index 000000000..10f5e792d --- /dev/null +++ b/Docs/HVR-replacement/phase-4-doors-chests-ladders.md @@ -0,0 +1,101 @@ +# Phase 4 - Doors, chest lids, ladders + +**Goal:** replace `HVRPhysicsDoor` (doors and chest lids) and `HVRClimbable` (ladders) on the Xri backend. + +**Size:** M (1-2 weeks) · **Depends on:** Phases 0-2 · **Parallel with:** Phase 3 (chest slots) + +## Exit criteria + +- [ ] Doors open by grabbing and pulling/pushing, are limited to 0-90°, and play the Gothic open/close sounds from the + door's MDS once per open/close. +- [ ] Locked doors don't move; lock picking unlocks them (`VRContainerDoorPickingInteraction`). +- [ ] Chest lids open 0-110°. The first open spawns the content (Phase 3); closing hides the slots; lock picking works. +- [ ] Ladders can be climbed hand over hand. `IVrRig.IsClimbing` is true while climbing (used by `KeepPlayerWithin`). + +## Behaviour spec (what we use from `HVRPhysicsDoor` today) + +From `oCMobDoor.prefab` / `oCMobContainer.prefab` and our scripts: + +| Setting / API | Door | Chest lid | Used by | +|---------------|------|-----------|---------| +| Hinge axis | Y (`Axis: 1`) | X (`Axis: 0`) | prefab | +| Limits `MinAngle/MaxAngle` | 0 / 90 | 0 / 110 | prefab | +| `Mass` | 10 | 10 | prefab | +| `CloseAngle` (counts as closed below) | 5° | 5° | prefab | +| `SFXOpened/SFXClosed`, `SFXResetThreshold 1` | from the MDS animations `t_S0_2_S1` / `t_S1_2_S0` | same | `VRVobDoor.PrepareSounds`, `VRVobContainer` | +| `Lock()` / `Unlock()` / `Locked` | ✓ | ✓ | `VRContainerDoorPickingInteraction` | +| `Opened` / `Closed` state (polled every frame) | – | ✓ | `VRVobContainerPhysicsChest.Update` → `OnOpened/OnClosed` | +| Grab on the door leaf (`HVRGrabbable`) + `HVRRotationTracker` | ✓ | ✓ | prefab | +| Handle-requires-rotation, door knobs, latch | off | off | – (not needed) | + +## Design + +### `VrHinge` (backend-neutral component, replaces `HVRPhysicsDoor` for us) + +- Adds/configures a `HingeJoint` (axis, limits, spring 0, damper) on the leaf's `Rigidbody` (mass 10, no gravity, as + HVR's `DisableGravity`). +- `Angle` from `HingeJoint.angle` (or our own measurement relative to the closed rotation). No rotation tracker needed. +- States `IsOpen` / `IsClosed` with hysteresis (`CloseAngle`, `SFXResetThreshold`), and C# events `Opened` / `Closed` + (no more polling in the chest). +- Sounds: play `OpenClip` when the angle passes `CloseAngle + threshold` upwards, `CloseClip` when it falls back + below `CloseAngle`; at most once per transition, with a timeout. Clips come from `VRVobDoor` / `VRVobContainer` as + today. +- `Lock()` / `Unlock()`: locked = rigidbody kinematic at the closed rotation (or joint limits 0/0). +- Optional soft close: below `CloseAngle` and not held → snap to 0 over `CloseOverTime` (0.25 s). +- Implements the `IVrHinge` port from Phase 0, so `VRVobDoor`, `VRVobContainer` and the lock picking don't change. + +### Grabbing the leaf + +`GothicGrabInteractable` (Phase 2) on the leaf with **VelocityTracking**: the joint constrains the motion, and the +hand drags the leaf physically. No position tracking of the hand → hinge, which avoids the classic "door explodes" +problem. Set `trackRotation = false` so only the position drives the leaf (feels like pushing/pulling a handle). + +Alternative if VelocityTracking + HingeJoint feels jittery: kinematic leaf with our own angle solve (project the hand +movement onto the hinge plane, clamp to the limits). That's how UltimateXR does constrained grabbables +(`UxrGrabbableObject` rotation constraints, MIT, useful as a reference). + +### Chest + +`VRVobContainerPhysicsChest` today **is** an `HVRPhysicsDoor` subclass. Split it: +- `VrHinge` on the lid (this phase). +- `VrChestSlots` (Phase 3) subscribes to `VrHinge.Opened/Closed` and keeps `AlignSockets`, `InitializeContent`, + `ParseContent` and the spawning code. + +### Ladders + +- XRI `ClimbInteractable` on the ladder collider of `oCMobLadder.prefab`, plus `ClimbProvider` on the rig (prepared + in Phase 1). +- While climbing, `GravityProvider` must pause (XRI's mediator does this) and `IVrRig.IsClimbing` returns + `ClimbProvider` active. +- Gothic ladders have no rungs as separate objects. Use one climbable collider along the ladder; the hand can grab + anywhere on it. +- Getting off at the top: XRI climbing has no auto-mantle. Add a small `VrLadderExit`: when the head is above the top + edge and the player pushes forward, move the rig onto the top floor (CharacterController sweep for safety). HVR + had no auto-mantle either; check today's behaviour in a playtest and match it. + +## Work items + +- [ ] `VrHinge` (+ `IVrHinge` implementation), `VrLadderExit`. +- [ ] `VRVobContainerPhysicsChest` → `VrChestSlots` (logic) + `VrHinge` (lid); delete the subclassing on the Xri path. +- [ ] **Prefabs (UnityMCP):** `oCMobDoor.prefab` (VrHinge + grab interactable + bridge), `oCMobContainer.prefab` + (lid), `oCMobLadder.prefab` (ClimbInteractable + bridge). +- [ ] `VRContextInteractionService.KeepPlayerWithin` uses `IVrRig.IsClimbing`; verify with a dialog at a ladder. + +## Test plan + +1. Old camp: open/close several doors with one hand, push with the body (the CharacterController must not push the + door through its limits), close slowly → one close sound, close fast → one close sound. +2. Locked door (e.g. a hut in the old camp): doesn't move; pick the lock → haptics per combo → door unlocked, opens. +3. Chest: lid opens to ~110°, content appears; close → slots hidden; reopen → same content, nothing spawned twice. +4. Locked chest with lock picking; broken lock pick → error haptics. +5. Ladders: climb the watchtower in the old camp, step off at the top, climb down, let go mid-way (fall with + gravity). +6. Teleport while holding a door → the door releases cleanly. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| VelocityTracking + HingeJoint jitter | Try kinematic angle solving (see above) before adding tuning knobs. | +| The player's CharacterController pushes doors | Put door leaves on a layer the CharacterController doesn't push against, or make the leaf kinematic while not held. | +| Ladder dismount feels worse than HVR | Playtest HVR first and record the expected behaviour in the PR. | diff --git a/Docs/HVR-replacement/phase-5-hands.md b/Docs/HVR-replacement/phase-5-hands.md new file mode 100644 index 000000000..21dddca35 --- /dev/null +++ b/Docs/HVR-replacement/phase-5-hands.md @@ -0,0 +1,143 @@ +# Phase 5 - Hands (models, finger curls, procedural posing, physics hands) + +**Goal:** hands that look and feel at least as good as HVR's on the Xri backend: our own hand meshes, fingers +driven by input and finger tracking, fingers wrapping around any runtime-loaded Gothic item, and optional physics +hands that don't pass through walls. + +**Size:** L-XL (3-5 weeks) · **Depends on:** Phases 1-3 · **Riskiest phase** (see 04, "What we accept") + +Split into four parts that ship separately. 5a-5c are required, 5d is optional. + +| Part | Content | Size | +|------|---------|------| +| 5a | Hand models + rig + `VRHandsOnTop` | S | +| 5b | `FingerCurlProvider` (buttons, touches, XR Hands) | S-M | +| 5c | `ProceduralHandPoser` + few authored poses | M-L | +| 5d | `PhysicsHand` (joint-driven), ghost hand, teleport handling | L | + +## Exit criteria + +- [ ] No HVR hand/controller meshes, poses or settings are referenced by the Xri rig. +- [ ] Fingers react to grip, trigger and capacitive touch on Quest/Pico/Touch; on Index (and Steam Frame, if its + runtime exposes hand joints, see 5b), middle/ring/pinky follow the real fingers. +- [ ] Holding any Gothic item (sword, apple, torch, bottle, scroll, ring) shows fingers closed around it, not inside + it and not floating. +- [ ] 5d: with "physics hands" on (immersion setting), hands stop at walls, chests and doors; held items too; a ghost + hand shows the real controller pose when separated. + +## 5a - Hand models + +- **Source:** UltimateXR hand meshes (`ultimatexr-unity/Runtime/Art/Avatars/BigHands`, `SmallHands`, MIT). Copy + them into `Gothic-VR/Art/Hands/` with `THIRD-PARTY-NOTICES` (MIT text, VRMADA copyright). Alternative: any CC0 + rigged hand. Avoid Meta/Oculus hand assets (license). +- Rig: wrist + 3 bones per finger + thumb. Write a `VrHandSkeleton` component that maps the bones once (name pattern + per model), so the poser and the curl logic don't depend on bone names. +- Materials: URP Lit, plus the on-top variant for `VRHandsOnTop` (render queue 3950, as today). +- Hand layer stays `Hand` (`Constants.HandLayer`). `VRFistAttackAdapter` resets the attack collider layer; keep it. +- Controller models: not needed (the hands replace them). The simulator shows hands as well. + +## 5b - Finger curls (`FingerCurlProvider`) + +Replaces `HVRHandAnimator` + `HVRFingerSettings` + `HVROpenXRFingerCurls`. + +- Output: `float[5]` curls per hand (thumb…pinky, 0 = open, 1 = fist). +- Input source per finger (configurable ScriptableObject `VrFingerSettings`, replacing `HVR_FingerSettings.asset`): + + | Finger | Source | + |--------|--------| + | Thumb | max(primary/secondary/thumbstick touch) → 0.6-0.8 | + | Index | trigger value (+ trigger touch → 0.2) | + | Middle, ring, pinky | grip value | + +- Finger tracking: if `XRHandSubsystem` is running and the hand is tracked, compute curls from joint angles + (metacarpal → tip) and **override middle/ring/pinky** (as HVR does today for Knuckles, fingers 2-4). Index and + thumb stay on buttons, because the trigger/joystick need them. + - Index under SteamVR OpenXR exposes controller-driven hand joints through `XR_EXT_hand_tracking`. That's what HVR + uses today via `USING_XRHANDS`. + - Steam Frame: verify on a device that its runtime exposes the same. If yes, it works without extra code. + - Quest/Pico controller-free hand tracking is out of scope (HVR doesn't support it either). The provider design + allows adding it later. +- The pose blend per finger: `curl` lerps between the open and the fist pose (two `VrHandPose` assets), unless a + grab pose overrides that finger (5c). +- Swimming: `IVrRig.SetGrabbingEnabled(false)` also forces open hands (today `VRPlayerController.ChangeGrabbing` + disables poses). + +## 5c - Procedural hand posing (`ProceduralHandPoser`) + +Replaces `HVRPhysicsPoser` (`PoseType: PhysicPoser` on every `oCItem`). It's needed because no one can author +poses for thousands of runtime-loaded Gothic items. + +Algorithm (one-shot on grab, not every frame): +1. Hand attach: with XRI dynamic attach (Phase 2), the item is held where the palm touched. Align the palm normal + to the closest point on the item's collider (`Collider.ClosestPoint` from the palm center), and offset the palm by + a small skin distance. +2. For each finger, iterate the bones from proximal to distal: rotate the bone in steps (e.g. 5°) around its curl + axis until a `Physics.ComputePenetration`/`CapsuleCast` of the bone capsule against **the item's colliders only** + hits, then step back one increment. Cap at the fist pose. +3. Thumb: same, but with its opposition axis first. +4. Store the result as a `VrHandPose` and apply it while held (the item doesn't change shape). +5. Cache per item **instance name** + attach-point bucket (e.g. a 2 cm grid in item space). Gothic has many copies of + the same item, so most grabs are cache hits. + +Budget: ~15 bones × ~20 steps × 1 capsule query = ~300 queries per grab, done once. Fine even on Quest. Measure with +the profiler (`unity_profiler_frame`). + +Reference implementations to read for ideas (not to copy): HVR's poser (licensed, read only for behaviour); the +UltimateXR Hand Pose Editor (MIT, authored poses). + +**Authored poses** (few): backpack strap (today `backpack_left/right_hand_pose.asset`), ladder, door handle (optional). +`VrHandPose` asset = per-bone local rotations; capture them in the editor from the posed hand (a small "Save pose" +inspector button) instead of porting a full pose editor. + +## 5d - Physics hands (optional, immersion setting) + +Replaces `HVRJointHand` + `HVRHandPhysics` + `HVRGhostHand` + the hand part of `HVRTeleportCollisonHandler`. + +- Physics hand = `Rigidbody` (interpolated, continuous dynamic collision) with simple colliders (palm box + finger + capsules), driven towards the tracked controller pose every `FixedUpdate`: + - Position: velocity-based (`rb.linearVelocity = (target - pos) / dt`, clamped to max speed) or a + `ConfigurableJoint` with drives. Start velocity-based: fewer parameters, and it's what XRI's VelocityTracking + already does for items. + - Rotation: angular velocity from the quaternion delta, clamped. +- The visible hand follows the physics hand. A ghost hand (transparent) follows the controller when the distance is + > ~5 cm. +- Max distance: if physics hand ↔ controller > ~0.5 m for > 0.2 s (stuck behind a wall), snap the physics hand back + to the controller (with the held item released if it's stuck, as HVR's `MaxDistanceBehaviour`). +- Teleport and scene changes: after `IVrRig.Teleported`, move the hands and held items with the rig (same offset), + then sweep; if they overlap geometry, snap to the controller. HVR spent most of its fixes here (see 04 data points). +- Held items: Phase 2 VelocityTracking targets the **physics hand's** attach point, not the controller, so the item + stops at walls together with the hand. +- Collision layers: hands collide with the world, mobs, doors and NPCs; not with the player's CharacterController, + not with held items of the same hand. +- Comfort: a setting "physics hands" in the immersion menu (`VRSettingsImmersionMenu`, Gothic.ini key in + `VRConstants.IniNames`). Off = hands follow the controllers directly (Phase 2 state + interim parenting fix). +- Fist attacks (`VRFistAttackAdapter`, disabled today) become possible with physics hands. Enabling them is a + separate gameplay task. + +## Work items + +- [ ] 5a: art import + notices, `VrHandSkeleton`, hand prefabs (UnityMCP), `VRHandsOnTop` renderers. +- [ ] 5b: `VrFingerSettings` asset, `FingerCurlProvider`, `VrHandPose` asset type, open/fist poses. +- [ ] 5c: `ProceduralHandPoser` + cache, authored backpack/ladder poses, an editor "Save pose" button. +- [ ] 5d: `PhysicsHand`, `GhostHand`, teleport handling, immersion setting (C# + menu + ini), retarget VelocityTracking. +- [ ] PlayMode test: poser produces no finger-collider overlaps for a sword, an apple and a bottle (`Gothic.Tests.PlayMode`). + +## Test plan + +1. Quest 3, Pico 4: grip/trigger/touch animate the fingers; the menu laser hand pose is readable. +2. Index (and Steam Frame): middle/ring/pinky follow the real fingers; the index finger follows the trigger. +3. Grab 20 different items (weapons of each category, food, potions, scrolls, runes, rings, torch, lock pick): fingers + wrap plausibly; regrab the same item → instant (cache). +4. Backpack strap and ladder use the authored poses. +5. 5d on: punch a wall → the hand stops, ghost visible; pull back → reconnects; hold a sword against a wall → it + stops; teleport and Marvin "goto" while holding → nothing stuck; dialog + `KeepPlayerWithin` unaffected. +6. 5d off: same as the Phase 2 state. +7. Performance: Quest 3 frame time with 5d on during a fight in the old camp. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| Poser looks wrong on odd meshes (rings, runes, tiny items) | Fallback: if fewer than 2 fingers make contact, use a generic "pinch" pose for small bounds and a "power grip" for long bounds. | +| Physics hands tuning eats time (HVR history: ~170 release-note lines on this) | Keep 5d optional and off by default until playtests approve it; ship 5a-5c first. | +| Steam Frame doesn't expose hand joints via OpenXR | Fall back to button curls (Index-like capacitive data may still come through the interaction profile). | diff --git a/Docs/HVR-replacement/phase-6-removal.md b/Docs/HVR-replacement/phase-6-removal.md new file mode 100644 index 000000000..f1512ad55 --- /dev/null +++ b/Docs/HVR-replacement/phase-6-removal.md @@ -0,0 +1,74 @@ +# Phase 6 - Remove HVR + +**Goal:** HVR is gone from the repository, the build and the docs. Every contributor can open the project, build +the VR targets and play them, with or without a headset (simulator). + +**Size:** S (2-3 days) · **Depends on:** Phases 1-5 accepted in playtests on Quest, Pico and PCVR (5d may still be +off by default) + +## Entry check (go / no-go) + +- [ ] Xri backend has been the default for at least one release/playtest round without HVR-only regressions. +- [ ] The playtest checklists of Phases 0-5 pass on Quest 3, Pico 4 and PCVR (Index). +- [ ] Nobody on Discord has open work that depends on HVR components. + +## Work items + +### Code + +- [ ] Delete `Gothic-VR/Scripts/Interaction/Backends/Hvr/` (incl. `VRPlayerController`-based `HvrRig`, `VRSocket`, + `VRShoulderSocket`, `VRSimulatorControlsGUI`, `VRVobContainerPhysicsChest` HVR version, bridges). +- [ ] Remove `DeveloperConfig.VrInteractionBackend` (C# field **and** asset value), or keep it with only `Xri` + if a future backend is planned. The removal is easier to read. +- [ ] `VRContextBootstrap`: no backend selection, no `#if`. +- [ ] Remove `GOTHIC_HVR_INSTALLED` from `ProjectSettings/ProjectSettings.asset` (Android + Standalone defines) and + from every remaining file (`grep -rn GOTHIC_HVR_INSTALLED Assets` = 0). +- [ ] Delete `Gothic-VR/Editor/HurricaneActions.cs` (URP material conversion) and `Gothic-VR/Editor/VRContextToolActions.cs` + (define toggling). +- [ ] Remove `HurricaneVR.*` references from asmdefs if any (`Gothic.VR.asmdef`, `Gothic.VR.Editor`, Lab, Tests). +- [ ] `grep -rni "hvr\|hurricane" Assets --include=*.cs` = 0 (comments too). + +### Packages and assets + +- [ ] `Packages/manifest.json`: remove `com.hurricanevrextensions.simulator`. +- [ ] Delete your local `Assets/HurricaneVR/` (it isn't in git: `.gitignore:106`; CI injects it). Keep the ignore + entry so nobody commits it by accident. +- [ ] **Prefabs (UnityMCP):** remove all HVR components from the 11 VR prefabs (`HVRGrabbable`, `HVRTagSocketable`, + `HVRPhysicsDoor`, `HVRRotationTracker`, `HVRClimbable`, socket components …), delete `HVR - Player.prefab`, + `HVRGlobal` instance in `Player.unity` / `Lab.unity`, `UIManager` (HVR) instance. +- [ ] Rename `VR - Player XRI.prefab` → `VR - Player.prefab`. +- [ ] Delete `Gothic-VR/Resources/VR/HVR Settings/`, `GUZ-VR-Socketables.asset`, + `Player-Elements/BackPack/backpack_*_hand_pose.asset` (replaced in Phase 5), old slot prefabs. +- [ ] Open every VR prefab and scene once and check for "Missing script" (UnityMCP `find_gameobjects` / console). + +### Build and CI + +- [ ] Remove the private HVR asset-repo checkout/injection from the CI workflow. +- [ ] `pipeline-test-build` label: VR builds (Windows64, Pico, Quest) run for every contributor's PR. +- [ ] `VRBuilderActions`: nothing HVR-specific (check). + +### Docs + +- [ ] `CLAUDE.md`: remove the "Without HurricaneVR" and "Purple HVR hands" setup notes, the `GOTHIC_HVR_INSTALLED` + text, and "HurricaneVR" in Key Dependencies / VR Framework; describe `Gothic.VR.Interaction` + XRI. +- [ ] `README.md`, `CONTRIBUTING.md`: VR works out of the box; the simulator explains how to play without a headset. +- [ ] Wiki (`../Gothic-Unity.wiki`, edit there, not the in-repo copy): VR setup page, architecture page. +- [ ] `Docs/HVR-replacement/`: add a short "Done in " note to `README.md`; keep the docs as history. +- [ ] Project memory/skills that mention HVR (e.g. `feature-checklist`, `unity-mcp-debug`): update the wording. + +## Test plan + +1. Fresh clone on a machine that never had HVR: open the project, no compile errors, no missing scripts in the VR + scenes. +2. Play the Bootstrap scene with `GameControls = VR` + simulator: new game, walk, grab, backpack, chest, door, ladder, + dialog, fight. +3. CI: Windows64, Pico and Quest builds green without secrets for HVR. +4. Install the three builds: one full playtest loop each (G1 + G2 start areas). +5. Flat mode: unaffected. + +## Risks + +| Risk | Mitigation | +|------|-----------| +| Hidden references (serialized fields typed as HVR classes in scenes) produce missing scripts | Use the GUID scan from 02 (resolve `m_Script` GUIDs against `Assets/HurricaneVR/**/*.meta` before deleting the folder); the result must be empty. | +| Someone still has HVR locally and commits generated files | `.gitignore` entry + a CI check that fails if `Assets/HurricaneVR` exists in the PR. |