Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Assets/Gothic-VR/Resources/VR/Prefabs/VR - Player XRI.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1232,12 +1232,16 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Xri.XriTeleportAimer
_settings:
StartThreshold: 0.75
ReleaseThreshold: 0.4
ArcSpeed: 9
ArcGravity: 9.81
ArcStep: 0.4
ArcSamples: 40
ArcRadius: 0.1
MaxJumpDistance: 1.5
MaxDropDistance: 3
LineOfSightHeight: 1
LineOfSightSamples: 8
GroundRayHeight: 0.3
ReticleRadius: 0.25
ValidColor: {r: 0.3, g: 0.9, b: 0.4, a: 0.9}
InvalidColor: {r: 0.9, g: 0.3, b: 0.3, a: 0.6}
Expand Down Expand Up @@ -1963,7 +1967,7 @@ MonoBehaviour:
m_RaycastUIDocumentTriggerInteraction: 1
m_TargetNumCurveSegments: 1
m_HitDetectionType: 2
m_CastDistance: 30
m_CastDistance: 10
m_SphereCastRadius: 0.1
m_ConeCastAngle: 6
m_LiveConeCastDebugVisuals: 0
Expand Down Expand Up @@ -2726,7 +2730,7 @@ MonoBehaviour:
m_RaycastUIDocumentTriggerInteraction: 1
m_TargetNumCurveSegments: 1
m_HitDetectionType: 2
m_CastDistance: 30
m_CastDistance: 10
m_SphereCastRadius: 0.1
m_ConeCastAngle: 6
m_LiveConeCastDebugVisuals: 0
Expand Down
113 changes: 91 additions & 22 deletions Assets/Gothic-VR/Resources/VR/Prefabs/Vobs/oCMobContainer.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -2220,9 +2220,9 @@ GameObject:
- component: {fileID: 172510743831141755}
- component: {fileID: 8269181727875358990}
- component: {fileID: 1469359342129423611}
- component: {fileID: 6745565813121138959}
- component: {fileID: 7611355444731811914}
- component: {fileID: 8346136834463750903}
- component: {fileID: 1630585632304796214}
- component: {fileID: 7588009683243012385}
m_Layer: 11
m_Name: BIP01 CHEST_.*_1
m_TagString: Untagged
Expand Down Expand Up @@ -2535,7 +2535,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9fca5660b7d87044b9f6309422813386, type: 3}
m_Name:
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Hvr.HvrHingeBridge
--- !u!114 &6745565813121138959
--- !u!114 &7611355444731811914
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: d53defac19fbb474d81910e60e275fd7, type: 3}
m_Name:
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Xri.XriInteractableBridge
--- !u!114 &1630585632304796214
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -2544,9 +2556,9 @@ MonoBehaviour:
m_GameObject: {fileID: 5980433150175133251}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8a35f6cfbfba9b548aaa00d52cfe8a50, type: 3}
m_Script: {fileID: 11500000, guid: 6087a45bbe7ac8f469bf5110b3d64b49, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.XR.Interaction.Toolkit::UnityEngine.XR.Interaction.Toolkit.Interactables.XRSimpleInteractable
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Xri.GothicGrabInteractable
m_InteractionManager: {fileID: 0}
m_Colliders: []
m_InteractionLayers:
Expand Down Expand Up @@ -2609,19 +2621,65 @@ MonoBehaviour:
m_StartingInteractionStrengthFilters: []
m_AutoFindParentInteractableInHierarchy: 0
m_ParentInteractableObject: {fileID: 0}
--- !u!114 &7611355444731811914
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: d53defac19fbb474d81910e60e275fd7, type: 3}
m_Name:
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Backends.Xri.XriInteractableBridge
--- !u!114 &8346136834463750903
m_AttachTransform: {fileID: 0}
m_SecondaryAttachTransform: {fileID: 0}
m_UseDynamicAttach: 0
m_MatchAttachPosition: 1
m_MatchAttachRotation: 0
m_SnapToColliderVolume: 1
m_ReinitializeDynamicAttachEverySingleGrab: 1
m_AttachEaseInTime: 0.15
m_MovementType: 1
m_PredictedVisualsTransform: {fileID: 0}
m_VelocityDamping: 1
m_VelocityScale: 1
m_AngularVelocityDamping: 1
m_AngularVelocityScale: 1
m_TrackPosition: 0
m_SmoothPosition: 0
m_SmoothPositionAmount: 8
m_TightenPosition: 0.1
m_TrackRotation: 0
m_SmoothRotation: 0
m_SmoothRotationAmount: 8
m_TightenRotation: 0.1
m_TrackScale: 1
m_SmoothScale: 0
m_SmoothScaleAmount: 8
m_TightenScale: 0.1
m_ThrowOnDetach: 0
m_ThrowSmoothingDuration: 0.25
m_ThrowSmoothingCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_ThrowVelocityScale: 1.5
m_ThrowAngularVelocityScale: 1
m_ForceGravityOnDetach: 0
m_UnparentTransformOnGrab: 0
m_RetainTransformParent: 1
m_StartingSingleGrabTransformers: []
m_StartingMultipleGrabTransformers: []
m_AddDefaultGrabTransformers: 1
m_FarAttachMode: 0
m_LimitLinearVelocity: 0
m_LimitAngularVelocity: 0
m_MaxLinearVelocityDelta: 10
m_MaxAngularVelocityDelta: 20
_heldInterpolation: 1
_isOneHandOnly: 0
--- !u!114 &7588009683243012385
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -2630,11 +2688,22 @@ MonoBehaviour:
m_GameObject: {fileID: 5980433150175133251}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ba712f1856779441b7ab647bc58f884, type: 3}
m_Script: {fileID: 11500000, guid: 5bb5c68765cb1e54cbe08cc0a5a15f05, type: 3}
m_Name:
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrChestLidToggle
_openAngle: 110
_swingTime: 0.4
m_EditorClassIdentifier: Gothic.VR::Gothic.VR.Interaction.Components.VrHinge
_localAxis: {x: 1, y: 0, z: 0}
_isOpeningInverted: 0
_minAngle: 0
_maxAngle: 110
_closeAngle: 5
_openHysteresis: 1
_closeOverTime: 0.25
_soundTimeout: 0.5
_maxHandSpeed: 360
_swingDamping: 3
_maxSwingSpeed: 180
_unlockPushSpeed: 60
_breakDistance: 1
--- !u!1 &6389233531767616918
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if GOTHIC_HVR_INSTALLED
using System;
using Gothic.VR.Interaction.Ports;
using HurricaneVR.Framework.Components;
using Reflex.Attributes;
Expand All @@ -8,12 +9,15 @@ namespace Gothic.VR.Interaction.Backends.Hvr
{
/// <summary>
/// Sits next to an HVRPhysicsDoor (doors, and chest lids via HvrPhysicsChest). Switches the door off if another
/// VR backend runs.
/// VR backend runs. Raises IVrHinge.Opened/Closed from HVRPhysicsDoor.Opened/Closed (polled in Update).
/// </summary>
public class HvrHingeBridge : MonoBehaviour, IVrHinge
{
[Inject] private readonly IVrBackend _vrBackend;

// Flags to ensure we raise Opened/Closed once, every time the door's open/close status changes.
private bool _isOpenedRaised;
private bool _isClosedRaised;
private HVRPhysicsDoor _door;

private HVRPhysicsDoor Door
Expand All @@ -26,6 +30,9 @@ private HVRPhysicsDoor Door
}
}

public event Action Opened;
public event Action Closed;

public bool IsActive => _vrBackend == null || _vrBackend is HvrBackend;
public Transform Transform => transform;
public Rigidbody Rigidbody => GetComponent<Rigidbody>();
Expand All @@ -37,6 +44,26 @@ private void Awake()
Door.enabled = false;
}

private void Update()
{
if (!IsActive || Door == null)
return;

if (Door.Opened && !_isOpenedRaised)
{
_isOpenedRaised = true;
_isClosedRaised = false;
Opened?.Invoke();
}

if (Door.Closed && !_isClosedRaised)
{
_isClosedRaised = true;
_isOpenedRaised = false;
Closed?.Invoke();
}
}

public void Lock()
{
Door.Lock();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Logging;
using Gothic.VR.Interaction.Components;
using Gothic.VR.Interaction.Ports;
using HurricaneVR.Framework.Components;
using Reflex.Attributes;
using Logger = Gothic.Core.Logging.Logger;

namespace Gothic.VR.Interaction.Backends.Hvr
{
/// <summary>
/// Chest lid (HVR physics door). Opening it shows the chest's slots (VrChestSlots, which spawns the content on
/// the first open), closing it hides them.
/// Temporarily in the HVR backend as it subclasses HVRPhysicsDoor (VrHinge in Phase 4). On other backends it
/// switches itself off before the door is set up (VrChestLidToggle is the lid there).
/// Chest lid (HVR physics door). Opening/closing is reported by HvrHingeBridge (IVrHinge.Opened/Closed), which
/// VrChestSlots listens to. Subclasses HVRPhysicsDoor only so that it can switch itself off before the door is
/// set up if another VR backend runs (VrHinge is the lid there).
/// </summary>
public class HvrPhysicsChest : HVRPhysicsDoor
{
[Inject] private readonly IVrBackend _vrBackend;

private VrChestSlots _chestSlots;

// Flags to ensure we always call On*() once, everytime open/close status changes.
private bool _onOpenedHandled;
private bool _onClosedHandled;


public override void Start()
{
if (_vrBackend != null && _vrBackend is not HvrBackend)
Expand All @@ -34,43 +23,6 @@ public override void Start()
}

base.Start();

_chestSlots = GetComponentInParent<VrChestSlots>();
if (_chestSlots == null)
Logger.LogError($"[HVR] Chest lid {name} has no VrChestSlots in its parents.", LogCat.VR);
}

protected override void Update()
{
base.Update();

if (Opened && !_onOpenedHandled)
{
OnOpened();
}

if (Closed && !_onClosedHandled)
{
OnClosed();
}
}

private void OnOpened()
{
if (_chestSlots != null)
_chestSlots.Open();

_onOpenedHandled = true;
_onClosedHandled = false;
}

private void OnClosed()
{
if (_chestSlots != null)
_chestSlots.Close();

_onOpenedHandled = false;
_onClosedHandled = true;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Gothic.VR.Interaction.Backends.Xri
/// per hand, GothicGrabInteractable + XriInteractableBridge on oCItem), using mobs/NPCs and the socket core
/// (VrSocketSlot + XriSocketBridge, "VR Socket Slot.prefab"), the backpack ("BackPack XRI.prefab") on the
/// shoulder and the hip/shoulder holsters (VrBodyAnchor "Shoulders"/"Waist" on the rig), chest slots
/// (VrChestSlots, lid opened by using it: VrChestLidToggle) and NPC loot slots.
/// Missing: physical doors/chest lids/ladders (4) and hands (5).
/// (VrChestSlots, lid opened by hand: VrHinge), NPC loot slots and doors (VrHinge).
/// Missing: ladders (4c) and hands (5).
/// </summary>
public class XriBackend : IVrBackend
{
Expand Down
Loading