62 lines
No EOL
1.4 KiB
C#
62 lines
No EOL
1.4 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.XR;
|
|
|
|
[Serializable]
|
|
public class Control
|
|
{
|
|
[HideInInspector]
|
|
public Logic logic;
|
|
|
|
public OculusFilter oculusFilter;
|
|
public ValveFilter valveFilter;
|
|
|
|
public bool connected;
|
|
public InputDevice headDevice, lHandDevice, rHandDevice;
|
|
public Vector3 headTrackedPos, lHandTrackedPos, rHandTrackedPos;
|
|
public Quaternion headTrackedRot, lHandTrackedRot, rHandTrackedRot;
|
|
|
|
public void Set(InspectorSetter setter)
|
|
{
|
|
oculusFilter.Set(setter);
|
|
valveFilter.Set(setter);
|
|
}
|
|
|
|
public void Fetch(InspectorSetter setter)
|
|
{
|
|
oculusFilter.Fetch(setter);
|
|
valveFilter.Fetch(setter);
|
|
}
|
|
|
|
public void Start(Logic logic)
|
|
{
|
|
this.logic = logic;
|
|
|
|
headDevice = InputDevices.GetDeviceAtXRNode(XRNode.Head);
|
|
lHandDevice = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
|
|
rHandDevice = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
|
|
|
|
oculusFilter.Start(this);
|
|
valveFilter.Start(this);
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
// General
|
|
connected = headDevice.IsValid && (lHandDevice.IsValid || rHandDevice.IsValid);
|
|
if (!connected)
|
|
return;
|
|
|
|
|
|
XRDevice.DisableAutoXRCameraTracking(Camera.main, true);
|
|
|
|
// headDevice.TryGetFeatureValue();
|
|
// need to update...
|
|
|
|
// you can play with your left controller or your right (and?) RIG CLASS?
|
|
|
|
// Swappable Proprietary Overrides
|
|
oculusFilter.Update();
|
|
valveFilter.Update();
|
|
}
|
|
} |