Cleanup
This commit is contained in:
parent
4f3088685d
commit
abab50dc76
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 565c528cf57cf7b44bb215ac006b5c73
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
#if hOCULUS
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace Passer.Humanoid {
|
|
||||||
|
|
||||||
public class OculusObject_Editor {
|
|
||||||
|
|
||||||
#region Object Tracker
|
|
||||||
private enum Side {
|
|
||||||
Left,
|
|
||||||
Right
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ObjectTrackerInspector(ObjectTracker objectTracker) {
|
|
||||||
//#if hOCULUS
|
|
||||||
//#if UNITY_STANDALONE_WIN
|
|
||||||
// bool wasEnabled = objectTracker.oculusTouch.enabled;
|
|
||||||
// SensorInspector(objectTracker.oculusTouch, "Oculus Touch");
|
|
||||||
// if (!wasEnabled && objectTracker.oculusTouch.enabled)
|
|
||||||
// //objectTracker.oculusTouch.Start(objectTracker.humanoid, objectTracker.transform);
|
|
||||||
|
|
||||||
// if (objectTracker.oculusTouch.enabled) {
|
|
||||||
// EditorGUI.indentLevel++;
|
|
||||||
// Side side = objectTracker.isLeft ? Side.Left : Side.Right;
|
|
||||||
// side = (Side)EditorGUILayout.EnumPopup("Controller side", side);
|
|
||||||
// objectTracker.isLeft = (side == Side.Left);
|
|
||||||
|
|
||||||
// objectTracker.oculusTouch.CheckSensorTransform();
|
|
||||||
// objectTracker.oculusTouch.SetSensor2Target();
|
|
||||||
|
|
||||||
// objectTracker.oculusTouch.sensorTransform = (Transform)EditorGUILayout.ObjectField("Tracker Transform", objectTracker.oculusTouch.sensorTransform, typeof(Transform), true);
|
|
||||||
// EditorGUI.indentLevel--;
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// objectTracker.oculusTouch.sensorTransform = Oculus_Editor.RemoveTransform(objectTracker.oculusTouch.sensorTransform);
|
|
||||||
// }
|
|
||||||
//#elif UNITY_ANDROID
|
|
||||||
// bool wasEnabled = objectTracker.oculusTouch.enabled;
|
|
||||||
// SensorInspector(objectTracker.oculusTouch, "Gear VR Controller");
|
|
||||||
// if (!wasEnabled && objectTracker.oculusTouch.enabled)
|
|
||||||
// objectTracker.oculusTouch.Start(objectTracker.humanoid, objectTracker.transform);
|
|
||||||
|
|
||||||
// if (objectTracker.oculusTouch.enabled) {
|
|
||||||
// EditorGUI.indentLevel++;
|
|
||||||
// Side side = objectTracker.isLeft ? Side.Left : Side.Right;
|
|
||||||
// side = (Side)EditorGUILayout.EnumPopup("Controller side", side);
|
|
||||||
// objectTracker.isLeft = (side == Side.Left);
|
|
||||||
// //objectTracker.gearVRController.sensorTransform = (Transform)EditorGUILayout.ObjectField("Tracker Transform", objectTracker.gearVRController.sensorTransform, typeof(Transform), true);
|
|
||||||
// EditorGUI.indentLevel--;
|
|
||||||
// } else {
|
|
||||||
// //objectTracker.gearVRController.sensorTransform = OculusTouch_Editor.RemoveOculusTracker(objectTracker.gearVRController.sensorTransform);
|
|
||||||
// }
|
|
||||||
//#endif
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SensorInspector(UnitySensor sensor, string name) {
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
sensor.enabled = EditorGUILayout.ToggleLeft(name, sensor.enabled, GUILayout.MinWidth(80));
|
|
||||||
if (sensor.enabled && Application.isPlaying)
|
|
||||||
EditorGUILayout.EnumPopup(sensor.status);
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d2b97881a82361047b0057dafb5be452
|
|
||||||
timeCreated: 1530177518
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,51 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace Passer.Humanoid {
|
|
||||||
using Passer.Tracking;
|
|
||||||
|
|
||||||
[CustomEditor(typeof(Passer.Tracking.Oculus))]
|
|
||||||
public class OculusTracker_Editor : Editor {
|
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
|
||||||
serializedObject.Update();
|
|
||||||
|
|
||||||
PersistentTrackingInspector();
|
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void PersistentTrackingInspector() {
|
|
||||||
SerializedProperty persistentTrackingProp = serializedObject.FindProperty("persistentTracking");
|
|
||||||
persistentTrackingProp.boolValue = EditorGUILayout.Toggle("Persistent Tracking", persistentTrackingProp.boolValue);
|
|
||||||
|
|
||||||
if (persistentTrackingProp.boolValue) {
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
RealWorldConfigurationInspector();
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void RealWorldConfigurationInspector() {
|
|
||||||
SerializedProperty realWorldConfigurationProp = serializedObject.FindProperty("realWorldConfiguration");
|
|
||||||
EditorGUILayout.ObjectField(realWorldConfigurationProp);
|
|
||||||
RealWorldConfiguration configuration = (RealWorldConfiguration)realWorldConfigurationProp.objectReferenceValue;
|
|
||||||
|
|
||||||
if (configuration == null) {
|
|
||||||
EditorGUILayout.HelpBox("Real World Configuration is required for persistent Tracking", MessageType.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RealWorldConfiguration.TrackingSpace trackingSpace =
|
|
||||||
configuration.trackers.Find(space => space.trackerId == TrackerId.Oculus);
|
|
||||||
if (trackingSpace == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Passer.Tracking.Oculus tracker = (Passer.Tracking.Oculus) serializedObject.targetObject;
|
|
||||||
tracker.transform.position = trackingSpace.position;
|
|
||||||
tracker.transform.rotation = trackingSpace.rotation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d6ea259c2e931ad4881c602c46a1a8b1
|
|
||||||
timeCreated: 1562140542
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,396 +0,0 @@
|
|||||||
/*
|
|
||||||
using System.IO;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.XR;
|
|
||||||
using Passer.Tracking;
|
|
||||||
|
|
||||||
namespace Passer {
|
|
||||||
using Humanoid;
|
|
||||||
|
|
||||||
public class Oculus_Editor : Tracker_Editor {
|
|
||||||
|
|
||||||
#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
|
||||||
|
|
||||||
#if UNITY_ANDROID && hOCHAND
|
|
||||||
private readonly static System.Version minHandTrackingVersion = new System.Version(1, 44, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#region Tracker
|
|
||||||
|
|
||||||
public class TrackerProps : HumanoidControl_Editor.HumanoidTrackerProps {
|
|
||||||
|
|
||||||
private readonly SerializedProperty trackerProp;
|
|
||||||
#if UNITY_ANDROID
|
|
||||||
SerializedProperty deviceTypeProp;
|
|
||||||
SerializedProperty handTrackingProp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public TrackerProps(SerializedObject serializedObject, HumanoidControl_Editor.HumanoidTargetObjs targetObjs, OculusTracker _oculus)
|
|
||||||
: base(serializedObject, targetObjs, _oculus, "oculus") {
|
|
||||||
tracker = _oculus;
|
|
||||||
|
|
||||||
trackerProp = serializedObject.FindProperty("oculus.tracker");
|
|
||||||
|
|
||||||
if (targetObjs.headTargetObj != null)
|
|
||||||
headSensorProp = targetObjs.headTargetObj.FindProperty(nameof(HumanoidControl.oculus));
|
|
||||||
if (targetObjs.leftHandTargetObj != null)
|
|
||||||
leftHandSensorProp = targetObjs.leftHandTargetObj.FindProperty(nameof(HumanoidControl.oculus));
|
|
||||||
if (targetObjs.rightHandTargetObj != null)
|
|
||||||
rightHandSensorProp = targetObjs.rightHandTargetObj.FindProperty(nameof(HumanoidControl.oculus));
|
|
||||||
|
|
||||||
#if UNITY_ANDROID && !UNITY_2020_1_OR_NEWER
|
|
||||||
handTrackingProp = serializedObject.FindProperty("oculus.handTracking");
|
|
||||||
//deviceTypeProp = serializedObject.FindProperty("oculus.androidDeviceType");
|
|
||||||
|
|
||||||
//OculusHumanoidTracker.AndroidDeviceType androidDeviceType = (OculusHumanoidTracker.AndroidDeviceType)deviceTypeProp.intValue;
|
|
||||||
//if (androidDeviceType == OculusHumanoidTracker.AndroidDeviceType.OculusQuest)
|
|
||||||
// CheckQuestManifest();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Inspector(HumanoidControl humanoid) {
|
|
||||||
//bool oculusSupported = OculusSupported();
|
|
||||||
//if (oculusSupported) {
|
|
||||||
// humanoid.oculus.CheckTracker(humanoid);
|
|
||||||
// humanoid.headTarget.oculus.CheckSensor(humanoid.headTarget);
|
|
||||||
// humanoid.leftHandTarget.oculus.CheckSensor(humanoid.leftHandTarget);
|
|
||||||
// humanoid.rightHandTarget.oculus.CheckSensor(humanoid.rightHandTarget);
|
|
||||||
#if !pUNITYXR
|
|
||||||
Inspector(humanoid, "Oculus");
|
|
||||||
|
|
||||||
if (enabledProp.boolValue) {
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
if (trackerProp.objectReferenceValue == null) {
|
|
||||||
// Tracker does not exit
|
|
||||||
using (new EditorGUILayout.HorizontalScope()) {
|
|
||||||
EditorGUILayout.LabelField("Tracker", GUILayout.Width(120));
|
|
||||||
if (GUILayout.Button("Show")) {
|
|
||||||
humanoid.oculus.CheckTracker(humanoid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
trackerProp.objectReferenceValue = (Oculus)EditorGUILayout.ObjectField("Tracker", trackerProp.objectReferenceValue, typeof(Oculus), true);
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
#if UNITY_ANDROID && hOCHAND && !UNITY_2020_1_OR_NEWER
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
deviceTypeProp.intValue = (int)(OculusHumanoidTracker.AndroidDeviceType)EditorGUILayout.EnumPopup("Device Type", (OculusHumanoidTracker.AndroidDeviceType)deviceTypeProp.intValue);
|
|
||||||
handTrackingProp.boolValue = EditorGUILayout.Toggle("Hand Tracking", handTrackingProp.boolValue);
|
|
||||||
#if UNITY_EDITOR_OSX
|
|
||||||
if (handTrackingProp.boolValue) {
|
|
||||||
EditorGUILayout.HelpBox(
|
|
||||||
"Hand tracking required at least OVR Plugin version 1.44 or higher\n" +
|
|
||||||
"Install the latetest version using the Oculus Integration package",
|
|
||||||
MessageType.Warning);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (handTrackingProp.boolValue && !(Humanoid.Tracking.OculusDevice.version >= minHandTrackingVersion)) {
|
|
||||||
EditorGUILayout.HelpBox(
|
|
||||||
"Hand tracking required at least OVR Plugin version 1.44 or higher\n" +
|
|
||||||
"Install the latetest version using the Oculus Integration package",
|
|
||||||
MessageType.Error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
#endif
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
// enabledProp.boolValue = false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void CheckQuestManifest() {
|
|
||||||
string manifestPath = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
|
|
||||||
FileInfo fileInfo = new FileInfo(manifestPath);
|
|
||||||
fileInfo.Directory.Create();
|
|
||||||
bool manifestAvailable = File.Exists(manifestPath);
|
|
||||||
if (manifestAvailable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
|
||||||
string questManifestPath = Application.dataPath + humanoidPath + "Extensions/Oculus/QuestManifest.xml";
|
|
||||||
File.Copy(questManifestPath, manifestPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Head
|
|
||||||
|
|
||||||
public class HeadTargetProps : HeadTarget_Editor.TargetProps {
|
|
||||||
|
|
||||||
|
|
||||||
private readonly SerializedProperty hmdProp;
|
|
||||||
SerializedProperty overrideOptitrackPositionProp;
|
|
||||||
|
|
||||||
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
|
||||||
: base(serializedObject, headTarget.oculus, headTarget, "oculus") {
|
|
||||||
|
|
||||||
hmdProp = serializedObject.FindProperty("oculus.hmd");
|
|
||||||
overrideOptitrackPositionProp = serializedObject.FindProperty("oculus.overrideOptitrackPosition");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Inspector() {
|
|
||||||
if (!headTarget.humanoid.oculus.enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(headTarget.oculus, headTarget);
|
|
||||||
headTarget.oculus.enabled = enabledProp.boolValue;
|
|
||||||
|
|
||||||
if (enabledProp.boolValue) {
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
if (headTarget.oculus.hmd == null) {
|
|
||||||
// Hmd does not exist
|
|
||||||
using (new EditorGUILayout.HorizontalScope()) {
|
|
||||||
EditorGUILayout.LabelField("Hmd", GUILayout.Width(120));
|
|
||||||
if (GUILayout.Button("Show")) {
|
|
||||||
headTarget.oculus.CheckSensor(headTarget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
hmdProp.objectReferenceValue = (OculusHmd)EditorGUILayout.ObjectField("Hmd", hmdProp.objectReferenceValue, typeof(OculusHmd), true);
|
|
||||||
#if hOPTITRACK
|
|
||||||
if (headTarget.optitrack.enabled)
|
|
||||||
overrideOptitrackPositionProp.boolValue = EditorGUILayout.Toggle("Override OptiTrack Position", overrideOptitrackPositionProp.boolValue);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
overrideOptitrackPositionProp.boolValue = true;
|
|
||||||
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
headTarget.oculus.CheckSensor(headTarget);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region HMD Component
|
|
||||||
[CustomEditor(typeof(OculusHmd))]
|
|
||||||
public class OculusHmdComponent_Editor : Editor {
|
|
||||||
OculusHmd sensorComponent;
|
|
||||||
|
|
||||||
private void OnEnable() {
|
|
||||||
sensorComponent = (OculusHmd)target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
|
||||||
serializedObject.Update();
|
|
||||||
|
|
||||||
EditorGUI.BeginDisabledGroup(true);
|
|
||||||
EditorGUILayout.EnumPopup("Status", sensorComponent.status);
|
|
||||||
EditorGUILayout.FloatField("Position Confidence", sensorComponent.positionConfidence);
|
|
||||||
EditorGUILayout.FloatField("Rotation Confidence", sensorComponent.rotationConfidence);
|
|
||||||
EditorGUI.EndDisabledGroup();
|
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Hand
|
|
||||||
public class HandTargetProps : HandTarget_Editor.TargetProps {
|
|
||||||
|
|
||||||
#if UNITY_ANDROID && hOCHAND
|
|
||||||
SerializedProperty handTrackingProp;
|
|
||||||
SerializedProperty skeletonProp;
|
|
||||||
#endif
|
|
||||||
#if pUNITYXR
|
|
||||||
SerializedProperty controllerProp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
|
||||||
: base(serializedObject, handTarget.oculus, handTarget, "oculus") {
|
|
||||||
|
|
||||||
#if UNITY_ANDROID && hOCHAND
|
|
||||||
handTrackingProp = serializedObject.FindProperty("oculus.handTracking");
|
|
||||||
skeletonProp = serializedObject.FindProperty("oculus.handSkeleton");
|
|
||||||
#endif
|
|
||||||
#if pUNITYXR
|
|
||||||
controllerProp = serializedObject.FindProperty("oculus.unityXRController");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Inspector() {
|
|
||||||
if (!handTarget.humanoid.oculus.enabled || !OculusSupported())
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if !pUNITYXR
|
|
||||||
CheckControllerComponent(handTarget);
|
|
||||||
#if UNITY_ANDROID && hOCHAND
|
|
||||||
handTarget.oculus.CheckSensor(handTarget, handTarget.humanoid.oculus);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(handTarget.oculus, handTarget);
|
|
||||||
handTarget.oculus.enabled = enabledProp.boolValue;
|
|
||||||
#if !pUNITYXR
|
|
||||||
handTarget.oculus.CheckSensorTransform();
|
|
||||||
#endif
|
|
||||||
if (!Application.isPlaying) {
|
|
||||||
handTarget.oculus.SetSensor2Target();
|
|
||||||
handTarget.oculus.ShowSensor(handTarget.humanoid.showRealObjects && handTarget.showRealObjects);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enabledProp.boolValue) {
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
#if pUNITYXR
|
|
||||||
controllerProp.objectReferenceValue = (UnityXRController)EditorGUILayout.ObjectField("Controller", controllerProp.objectReferenceValue, typeof(UnityXRController), true);
|
|
||||||
#else
|
|
||||||
sensorTransformProp.objectReferenceValue = (Transform)EditorGUILayout.ObjectField("Tracker Transform", handTarget.oculus.sensorTransform, typeof(Transform), true);
|
|
||||||
#endif
|
|
||||||
#if UNITY_ANDROID && hOCHAND
|
|
||||||
if (handTarget.humanoid.oculus.handTracking) {
|
|
||||||
skeletonProp.objectReferenceValue = (OculusHandSkeleton)EditorGUILayout.ObjectField("Skeleton", skeletonProp.objectReferenceValue, typeof(OculusHandSkeleton), true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void CheckControllerComponent(HandTarget handTarget) {
|
|
||||||
if (handTarget.oculus.sensorTransform == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if pUNITYXR
|
|
||||||
// UnityXRController controller = handTarget.oculus.sensorTransform.GetComponent<UnityXRController>();
|
|
||||||
// if (controller == null)
|
|
||||||
// controller = handTarget.oculus.sensorTransform.gameObject.AddComponent<UnityXRController>();
|
|
||||||
// controller.isLeft = handTarget.isLeft;
|
|
||||||
//#else
|
|
||||||
OculusController sensorComponent = handTarget.oculus.sensorTransform.GetComponent<OculusController>();
|
|
||||||
if (sensorComponent == null)
|
|
||||||
sensorComponent = handTarget.oculus.sensorTransform.gameObject.AddComponent<OculusController>();
|
|
||||||
sensorComponent.isLeft = handTarget.isLeft;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//#if hOCHAND
|
|
||||||
// protected static void CheckSkeletonComponent(HandTarget handTarget) {
|
|
||||||
// if (handTarget.oculus.handSkeleton == null) {
|
|
||||||
// handTarget.oculus.handSkeleton = handTarget.oculus.FindHandSkeleton(handTarget.isLeft);
|
|
||||||
// if (handTarget.oculus.handSkeleton == null)
|
|
||||||
// handTarget.oculus.handSkeleton = handTarget.oculus.CreateHandSkeleton(handTarget.isLeft, handTarget.showRealObjects);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
#region Controller Component
|
|
||||||
[CustomEditor(typeof(OculusController))]
|
|
||||||
public class OculusControllerComponent_Editor : Editor {
|
|
||||||
OculusController controllerComponent;
|
|
||||||
|
|
||||||
private void OnEnable() {
|
|
||||||
controllerComponent = (OculusController)target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
|
||||||
serializedObject.Update();
|
|
||||||
|
|
||||||
EditorGUI.BeginDisabledGroup(true);
|
|
||||||
EditorGUILayout.EnumPopup("Status", controllerComponent.status);
|
|
||||||
EditorGUILayout.FloatField("Position Confidence", controllerComponent.positionConfidence);
|
|
||||||
EditorGUILayout.FloatField("Rotation Confidence", controllerComponent.rotationConfidence);
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
EditorGUILayout.Toggle("Is Left", controllerComponent.isLeft);
|
|
||||||
EditorGUILayout.Vector3Field("Joystick", controllerComponent.primaryAxis);
|
|
||||||
EditorGUILayout.Slider("Index Trigger", controllerComponent.trigger1, -1, 1);
|
|
||||||
EditorGUILayout.Slider("Hand Trigger", controllerComponent.trigger2, -1, 1);
|
|
||||||
if (controllerComponent.isLeft) {
|
|
||||||
EditorGUILayout.Slider("Button X", controllerComponent.button1, -1, 1);
|
|
||||||
EditorGUILayout.Slider("Button Y", controllerComponent.button2, -1, 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EditorGUILayout.Slider("Button A", controllerComponent.button1, -1, 1);
|
|
||||||
EditorGUILayout.Slider("Button B", controllerComponent.button2, -1, 1);
|
|
||||||
}
|
|
||||||
EditorGUILayout.Slider("Thumbrest", controllerComponent.button3, -1, 1);
|
|
||||||
EditorGUI.EndDisabledGroup();
|
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Object Target
|
|
||||||
|
|
||||||
private static SerializedProperty objectEnabledProp;
|
|
||||||
private static SerializedProperty objectSensorTransformProp;
|
|
||||||
private static SerializedProperty objectSensor2TargetPositionProp;
|
|
||||||
private static SerializedProperty objectSensor2TargetRotationProp;
|
|
||||||
|
|
||||||
public static void InitObject(SerializedObject serializedObject, ObjectTarget objectTarget) {
|
|
||||||
objectEnabledProp = serializedObject.FindProperty("oculusController.enabled");
|
|
||||||
objectSensorTransformProp = serializedObject.FindProperty("oculusController.sensorTransform");
|
|
||||||
objectSensor2TargetPositionProp = serializedObject.FindProperty("oculusController.sensor2TargetPosition");
|
|
||||||
objectSensor2TargetRotationProp = serializedObject.FindProperty("oculusController.sensor2TargetRotation");
|
|
||||||
|
|
||||||
objectTarget.oculus.Init(objectTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum LeftRight {
|
|
||||||
Left,
|
|
||||||
Right
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ObjectInspector(OculusController controller) {
|
|
||||||
objectEnabledProp.boolValue = Target_Editor.ControllerInspector(controller);
|
|
||||||
controller.CheckSensorTransform();
|
|
||||||
|
|
||||||
if (objectEnabledProp.boolValue) {
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
LeftRight leftRight = controller.isLeft ? LeftRight.Left : LeftRight.Right;
|
|
||||||
leftRight = (LeftRight)EditorGUILayout.EnumPopup("Tracker Id", leftRight);
|
|
||||||
controller.isLeft = leftRight == LeftRight.Left;
|
|
||||||
objectSensorTransformProp.objectReferenceValue = (Transform)EditorGUILayout.ObjectField("Tracker Transform", controller.sensorTransform, typeof(Transform), true);
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetSensor2Target(OculusController controller) {
|
|
||||||
controller.SetSensor2Target();
|
|
||||||
objectSensor2TargetRotationProp.quaternionValue = controller.sensor2TargetRotation;
|
|
||||||
objectSensor2TargetPositionProp.vector3Value = controller.sensor2TargetPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
#endif
|
|
||||||
public static bool OculusSupported() {
|
|
||||||
#if pUNITYXR
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
string[] supportedDevices = XRSettings.supportedDevices;
|
|
||||||
foreach (string supportedDevice in supportedDevices) {
|
|
||||||
if (supportedDevice == "Oculus")
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !hOCULUS
|
|
||||||
[InitializeOnLoad]
|
|
||||||
public class OculusCleanup {
|
|
||||||
|
|
||||||
// Cleanup Oculus devices when Oculus is disabled in the preferences
|
|
||||||
static OculusCleanup() {
|
|
||||||
OculusHmd[] hmds = Object.FindObjectsOfType<OculusHmd>();
|
|
||||||
foreach (OculusHmd hmd in hmds)
|
|
||||||
Object.DestroyImmediate(hmd.gameObject, true);
|
|
||||||
|
|
||||||
OculusController[] controllers = Object.FindObjectsOfType<OculusController>();
|
|
||||||
foreach (OculusController controller in controllers)
|
|
||||||
Object.DestroyImmediate(controller.gameObject, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
*/
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 35c29c2d27bfad041b62b94717b32a5f
|
|
||||||
timeCreated: 1475155546
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -54,8 +54,8 @@ namespace Passer.Humanoid {
|
|||||||
protected void OculusHandTrackingInspector() {
|
protected void OculusHandTrackingInspector() {
|
||||||
#if hOCHAND
|
#if hOCHAND
|
||||||
GUIContent labelText = new GUIContent(
|
GUIContent labelText = new GUIContent(
|
||||||
"Oculus Hand Tracking",
|
"Quest Hand Tracking",
|
||||||
"Enables hand tracking on the Oculus Quest"
|
"Enables hand tracking on the Meta Quest"
|
||||||
);
|
);
|
||||||
oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
|
oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/// Devices
|
/// Devices
|
||||||
/// -------
|
/// -------
|
||||||
/// * \ref UnityXRTracker "UnityXR"
|
/// * \ref UnityXRTracker "UnityXR"
|
||||||
/// * \ref OculusDoc "Oculus"
|
/// * \ref QuestDoc "Meta Rift/Quest"
|
||||||
///
|
///
|
||||||
/// Input
|
/// Input
|
||||||
/// -----
|
/// -----
|
||||||
|
Loading…
x
Reference in New Issue
Block a user