Replace UltimateXR with HurricaneVR

This commit is contained in:
2024-08-08 17:01:07 +02:00
parent e8658374d6
commit fb21dbbb73
5932 changed files with 358362 additions and 2174150 deletions

View File

@@ -0,0 +1,45 @@
using HurricaneVR.Framework.Components;
using HurricaneVR.Framework.Core.Utils;
using HurricaneVR.Framework.Shared;
using UnityEngine;
namespace HurricaneVR.TechDemo.Scripts
{
public class DemoHeavyDoor : MonoBehaviour
{
public Rigidbody DoorRigidbody;
public HVRRotationTracker ValveTracker;
public HVRRotationLimiter Limiter;
public float MaxAngle = 130f;
public AudioClip[] SFX;
public float SFXAngle = 10f;
public float Angle;
private Quaternion _startRotation;
void Start()
{
_startRotation = DoorRigidbody.transform.rotation;
}
void FixedUpdate()
{
var angle = HVRUtilities.Remap(ValveTracker.Angle, Limiter.MinAngle, Limiter.MaxAngle, 0f, MaxAngle);
DoorRigidbody.MoveRotation(_startRotation * Quaternion.Euler(0f, angle, 0f));
if (SFX != null && SFX.Length > 0)
{
if (ValveTracker.Angle > Angle + SFXAngle || ValveTracker.Angle < Angle - SFXAngle)
{
var index = Random.Range(0, SFX.Length);
var sfx = SFX[index];
Angle = ValveTracker.Angle;
if(SFXPlayer.Instance) SFXPlayer.Instance.PlaySFX(sfx, transform.position);
}
}
}
}
}