diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/CONTRIBUTING.md.meta b/CONTRIBUTING.md.meta new file mode 100644 index 0000000..5a33e8e --- /dev/null +++ b/CONTRIBUTING.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c55d00a05de5d8340a1a49f5d8b2aeed +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/HumanoidControl/Configuration_Editor.cs b/Editor/HumanoidControl/Configuration_Editor.cs index bc4289c..099260e 100644 --- a/Editor/HumanoidControl/Configuration_Editor.cs +++ b/Editor/HumanoidControl/Configuration_Editor.cs @@ -219,7 +219,7 @@ namespace Passer.Humanoid { for (int i = 0; i < hcScripts.Length; i++) { string assetPath = AssetDatabase.GUIDToAssetPath(hcScripts[i]); if (assetPath.Length > 36 && assetPath.Substring(assetPath.Length - 27, 27) == "/Scripts/HumanoidControl.cs") { - humanoidPath = assetPath.Substring(6, assetPath.Length - 24); + humanoidPath = assetPath.Substring(0, assetPath.Length - 18); return humanoidPath; } } diff --git a/Editor/HumanoidControl/Extensions/Oculus/OculusObject_Editor.cs b/Editor/HumanoidControl/Extensions/Oculus/OculusObject_Editor.cs deleted file mode 100644 index 231733f..0000000 --- a/Editor/HumanoidControl/Extensions/Oculus/OculusObject_Editor.cs +++ /dev/null @@ -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 -*/ \ No newline at end of file diff --git a/Editor/HumanoidControl/Extensions/Oculus/OculusObject_Editor.cs.meta b/Editor/HumanoidControl/Extensions/Oculus/OculusObject_Editor.cs.meta deleted file mode 100644 index a0d1b83..0000000 --- a/Editor/HumanoidControl/Extensions/Oculus/OculusObject_Editor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d2b97881a82361047b0057dafb5be452 -timeCreated: 1530177518 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/HumanoidControl/Extensions/Oculus/OculusTracker_Editor.cs b/Editor/HumanoidControl/Extensions/Oculus/OculusTracker_Editor.cs deleted file mode 100644 index 8faf3ab..0000000 --- a/Editor/HumanoidControl/Extensions/Oculus/OculusTracker_Editor.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/Editor/HumanoidControl/Extensions/Oculus/OculusTracker_Editor.cs.meta b/Editor/HumanoidControl/Extensions/Oculus/OculusTracker_Editor.cs.meta deleted file mode 100644 index a519d53..0000000 --- a/Editor/HumanoidControl/Extensions/Oculus/OculusTracker_Editor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d6ea259c2e931ad4881c602c46a1a8b1 -timeCreated: 1562140542 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/HumanoidControl/Extensions/Oculus/Oculus_Editor.cs b/Editor/HumanoidControl/Extensions/Oculus/Oculus_Editor.cs deleted file mode 100644 index 58fd6b3..0000000 --- a/Editor/HumanoidControl/Extensions/Oculus/Oculus_Editor.cs +++ /dev/null @@ -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(); - // if (controller == null) - // controller = handTarget.oculus.sensorTransform.gameObject.AddComponent(); - // controller.isLeft = handTarget.isLeft; - //#else - OculusController sensorComponent = handTarget.oculus.sensorTransform.GetComponent(); - if (sensorComponent == null) - sensorComponent = handTarget.oculus.sensorTransform.gameObject.AddComponent(); - 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(); - foreach (OculusHmd hmd in hmds) - Object.DestroyImmediate(hmd.gameObject, true); - - OculusController[] controllers = Object.FindObjectsOfType(); - foreach (OculusController controller in controllers) - Object.DestroyImmediate(controller.gameObject, true); - } - } -#endif -} -*/ \ No newline at end of file diff --git a/Editor/HumanoidControl/Extensions/Oculus/Oculus_Editor.cs.meta b/Editor/HumanoidControl/Extensions/Oculus/Oculus_Editor.cs.meta deleted file mode 100644 index 43708ed..0000000 --- a/Editor/HumanoidControl/Extensions/Oculus/Oculus_Editor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 35c29c2d27bfad041b62b94717b32a5f -timeCreated: 1475155546 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/HumanoidControl/Extensions/UnityXR/UnityXR_Editor.cs b/Editor/HumanoidControl/Extensions/UnityXR/UnityXR_Editor.cs index deb8e76..3075c69 100644 --- a/Editor/HumanoidControl/Extensions/UnityXR/UnityXR_Editor.cs +++ b/Editor/HumanoidControl/Extensions/UnityXR/UnityXR_Editor.cs @@ -54,8 +54,8 @@ namespace Passer.Humanoid { protected void OculusHandTrackingInspector() { #if hOCHAND GUIContent labelText = new GUIContent( - "Oculus Hand Tracking", - "Enables hand tracking on the Oculus Quest" + "Quest Hand Tracking", + "Enables hand tracking on the Meta Quest" ); oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue); #endif @@ -71,7 +71,9 @@ namespace Passer.Humanoid { return; string humanoidPath = Configuration_Editor.FindHumanoidFolder(); - string questManifestPath = Application.dataPath + humanoidPath + "Extensions/Oculus/QuestManifest.xml"; + string questManifestPath = Application.dataPath.Substring(0, Application.dataPath.Length - 6) + // remove /Assets + humanoidPath + "Extensions/Oculus/QuestManifest.xml"; + Debug.Log(questManifestPath); File.Copy(questManifestPath, manifestPath); } catch (System.Exception _) { diff --git a/Editor/HumanoidControl/HumanoidControl_Editor.cs b/Editor/HumanoidControl/HumanoidControl_Editor.cs index d969e7e..0711efb 100644 --- a/Editor/HumanoidControl/HumanoidControl_Editor.cs +++ b/Editor/HumanoidControl/HumanoidControl_Editor.cs @@ -377,24 +377,11 @@ namespace Passer { #region Animations - private SerializedProperty animatorParamForwardProp; - private SerializedProperty animatorParamSidewardProp; - private SerializedProperty animatorParamRotationProp; - private SerializedProperty animatorParamHeightProp; - - - private void InitAnimations(HumanoidControl humanoid) { - - animatorParamForwardProp = serializedObject.FindProperty("animatorParameterForwardIndex"); - animatorParamSidewardProp = serializedObject.FindProperty("animatorParameterSidewardIndex"); - animatorParamRotationProp = serializedObject.FindProperty("animatorParameterRotationIndex"); - animatorParamHeightProp = serializedObject.FindProperty("animatorParameterHeightIndex"); - } + private void InitAnimations(HumanoidControl humanoid) { } bool showAnimatorParameters = false; private void AnimatorInspector(HumanoidControl humanoid) { AnimatorControllerInspector(humanoid); - AnimatorParametersInspector(humanoid); } private void AnimatorControllerInspector(HumanoidControl humanoid) { @@ -423,44 +410,6 @@ namespace Passer { EditorGUILayout.EndHorizontal(); } - private void AnimatorParametersInspector(HumanoidControl humanoid) { - if (showAnimatorParameters && humanoid.animatorEnabled && humanoid.targetsRig.runtimeAnimatorController != null) { - if (animatorParameterNames == null) - animatorParameterNames = GetAnimatorParameters(humanoid); - - EditorGUI.indentLevel++; - - GUIContent forwardSpeedText = new GUIContent( - "Forward Speed", - "Animator parameter controlling the forward motion animation" - ); - animatorParamForwardProp.intValue = SetAnimatorInput(forwardSpeedText, animatorParamForwardProp.intValue, ref humanoid.animatorParameterForward); - - GUIContent sidewardSpeedText = new GUIContent( - "Sideward Speed", - "Animator parameter controlling the sideward motion animation" - ); - animatorParamSidewardProp.intValue = SetAnimatorInput(sidewardSpeedText, animatorParamSidewardProp.intValue, ref humanoid.animatorParameterSideward); - - GUIContent turnSpeedText = new GUIContent( - "Turn Speed", - "Animator parameter controlling the rotation animation" - ); - animatorParamRotationProp.intValue = SetAnimatorInput(turnSpeedText, animatorParamRotationProp.intValue, ref humanoid.animatorParameterRotation); - - GUIContent headHeightText = new GUIContent( - "Head Height", - "Animation parameter controlling the squatting animation" - ); - animatorParamHeightProp.intValue = SetAnimatorInput(headHeightText, animatorParamHeightProp.intValue, ref humanoid.animatorParameterHeight); - - EditorGUI.indentLevel--; - } - else - showAnimatorParameters = false; - - } - protected GUIContent[] animatorParameterNames; public GUIContent[] GetAnimatorParameters(HumanoidControl humanoid) { if (humanoid == null || humanoid.targetsRig.runtimeAnimatorController == null) diff --git a/Editor/HumanoidControl/Extensions/Oculus.meta b/LICENSE.meta similarity index 67% rename from Editor/HumanoidControl/Extensions/Oculus.meta rename to LICENSE.meta index dcbb67e..c49da3b 100644 --- a/Editor/HumanoidControl/Extensions/Oculus.meta +++ b/LICENSE.meta @@ -1,6 +1,5 @@ fileFormatVersion: 2 -guid: 565c528cf57cf7b44bb215ac006b5c73 -folderAsset: yes +guid: ef89ebf080626664e9353fa0565b680e DefaultImporter: externalObjects: {} userData: diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..21c5835 --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9bd4d529ee013784db3923a2bdbc5bef +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/HumanoidControl/Scripts/Animator/Animator_Doc.md.cs b/Runtime/HumanoidControl/Scripts/Animator/Animator_Doc.md.cs index 48b7db0..d165417 100644 --- a/Runtime/HumanoidControl/Scripts/Animator/Animator_Doc.md.cs +++ b/Runtime/HumanoidControl/Scripts/Animator/Animator_Doc.md.cs @@ -9,57 +9,6 @@ /// when setting the Runtime Animator Controller parameter which is standard /// [Unity Animator Controller](https://docs.unity3d.com/Manual/class-AnimatorController.html). /// - /// Humanoid Control can control the animator controller using a number of float Animation - /// Parameters. These can be set in the Params section and refer to the - /// [Animation Parameters](https://docs.unity3d.com/Manual/AnimationParameters.html) - /// of the Animator Controller. - /// - /// float Forward Speed | The forward/backward speed. Negative is backward walking. Unit is units(meters) per second. - /// float Sideward Speed | The left/right speed. Negative is left strafing. Unit is units(meters) per second - /// float Turn Speed | The turning speed around the Y axis. Negative is turning left. Unit is full rotations (360 degrees) per second. - /// float Head Height | The head height relative to the standing position. Negative is crouching. Positive is reaching up. Unit is meters. - /// - /// Please note the unit of the parameters. Great care should be paid to this when creating the animations, - /// because it is not possible to use root motion (see below). - /// If the animation root speed does not match the required units of speed, - /// you can adjust them using the Speed parameter of the Animation State (see - /// [Unity3d – Animation States](https://docs.unity3d.com/Manual/class-State.html)). - /// For example, when the turning animation is set up such that it takes 4 seconds for a full rotation, - /// the Speed parameter should be set to 0.25. - /// - /// Root Motion - /// =========== - /// or the animations to work well they should not contain root motion. - /// This is because we need to be able to move the character from the VR headset, - /// not from the animation, or players will get motion sickness. - /// - /// To get the right behaviour, ensure that the following options are checked on the imported animations: - /// - /// Loop Time -> Loop Pose - /// Root Transform Rotation -> Bake Into PoseRoot Transform Position(Y) -> Bake Into Pose - /// Root Transform Position(XZ) -> Bake Into Pose - /// - /// Animation Restrictions - /// ====================== - /// The animations are controlled by the Animation Parameters which are derived from the head movements. - /// In order to match the movements of the player, the animations should be set in a specific way. - /// - /// - The animation being player when Forward Speed = 1 should ensure - /// that the head speed is exactly 1 unit(meter) per second. - /// If the head speed in the animation is different you may see feet slipping - /// over the ground because the animation is played too fast or too slow. - /// - The Forward Speed should only have effect on the forward/backward (Z-axis) speed of the avatar. - /// If this is not ensured, the animations will be wrong. - /// For example when the head moves to the left when forward speed = 1, the sideward speed will also be activated, - /// resulting in unwanted animations. - /// - The same is true for the Sideward Speed and Turn Speed, - /// but then limited to the sideward (X-axis) motion and rotation along the Y axis. - /// - The Head height is used to change the vertical position of the avatar. - /// A value of -0.3 can result in a crouching with even lower values resulting in a crawling position. - /// Positive values like 0.1 can result in a reaching position when the avatar stands on his toes. - /// - As with the other parameters, the Head Height parameter should only have effect - /// on the Y position of the head.All other movements must be avoided in this animation. - /// /// Targets /// ======= /// When the Animation option is enabled on the Humanoid Control script, diff --git a/Runtime/HumanoidControl/Scripts/Animator/TorsoAnimator.cs b/Runtime/HumanoidControl/Scripts/Animator/TorsoAnimator.cs index 7d00801..b689053 100644 --- a/Runtime/HumanoidControl/Scripts/Animator/TorsoAnimator.cs +++ b/Runtime/HumanoidControl/Scripts/Animator/TorsoAnimator.cs @@ -44,7 +44,6 @@ namespace Passer.Humanoid { Animator targetAnimator = hipsTarget.humanoid.targetsRig; // Don't use procedural if the animator controller plays an animation clip if (targetAnimator.runtimeAnimatorController != null && - hipsTarget.humanoid.animatorParameterForward == null && targetAnimator.GetCurrentAnimatorClipInfoCount(0) > 0) return; diff --git a/Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusDevice.cs b/Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusDevice.cs index 402e65e..5a7e64e 100644 --- a/Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusDevice.cs +++ b/Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusDevice.cs @@ -292,15 +292,16 @@ namespace Passer.Tracking { } public static bool GetSkeleton(bool isLeft, out Skeleton skeleton) { - return GetSkeleton(isLeft ? SkeletonType.HandLeft : SkeletonType.HandRight, out skeleton); - } - public static bool GetSkeleton(SkeletonType skeletonType, out Skeleton skeleton) { + SkeletonType skeletonType = isLeft ? SkeletonType.HandLeft : SkeletonType.HandRight; #if OVRPLUGIN_UNSUPPORTED_PLATFORM - skeleton = default(Skeleton); - return false; + skeleton = default(Skeleton); + return false; #else if (_version >= OVRP_1_44_0.version) { - return OVRP_1_44_0.ovrp_GetSkeleton(skeletonType, out skeleton) == Result.Success; + Result r = OVRP_1_44_0.ovrp_GetSkeleton(skeletonType, out skeleton); + if (r == Result.Failure_NotYetImplemented) + UnityEngine.Debug.LogWarning("OVR Plugin is too old for hand tracking, please update."); + return (r == Result.Success); } else { skeleton = default(Skeleton); diff --git a/Runtime/HumanoidControl/Scripts/Extensions/Oculus/Oculus_Doc.cs b/Runtime/HumanoidControl/Scripts/Extensions/Oculus/Oculus_Doc.cs index e93af05..21e4e32 100644 --- a/Runtime/HumanoidControl/Scripts/Extensions/Oculus/Oculus_Doc.cs +++ b/Runtime/HumanoidControl/Scripts/Extensions/Oculus/Oculus_Doc.cs @@ -1,29 +1,35 @@ namespace Passer.Humanoid { - /// \page OculusDoc Meta/Oculus + /// \page QuestDoc Meta Quest /// - /// Oculus Rift and Quest are supported using the \ref UnityXRTracker "UnityXR" component. - /// This pages gives additional specific information for using the Oculus devices + /// Meta Rift and Quest are supported using the \ref UnityXRTracker "UnityXR" component. + /// This pages gives additional specific information for using the Meta devices /// /// Unity XR Plugin /// =============== - /// Oculus devices can be used with both the Oculus and OpenXR plugin for Unity XR. - /// However, it should be mentioned that hand tracking with the Oculus Quest is only + /// Meta devices can be used with both the Oculus and OpenXR plugin for Unity XR. + /// However, it should be mentioned that hand tracking with the Meta Quest is only /// supported using the Oculus plugin. /// - /// Hand Tracking (Plus & Pro) - /// ========================== - /// For hand tracking, make sure the Unity XR plugin is set to Oculus. + /// Hand Tracking + /// ============= + /// + /// For hand tracking, make sure the Unity XR plugin is set to *Oculus*. /// Hand tracking is currently not supported for OpenXR. + /// + /// Also, OVR plugin _version 1.75.0 or higher_ is required for hand tracking. + /// The latest OVR plugin version can be installed by importing the latest + /// Oculus Integration package from the Asset Store. + /// /// When the platform is Android, an additional option will appear in the inspector /// \image html OculusHandTracking.png /// \image rtf OculusHandTracking.png /// /// Please make sure that for hand tracking, ‘Use Hands’ is enabled in the - /// Settings of the Oculus Quest itself or hand tracking will not work. + /// Settings of the Meta Quest itself or hand tracking will not work. /// /// Controller Buttons /// ================== - /// The buttons of the Oculus controller can be accessed using ControllerInput. + /// The buttons of the controller can be accessed using ControllerInput. /// The buttons are mapped as follows: /// /// Left Controller diff --git a/Runtime/HumanoidControl/Scripts/HumanoidControl.cs b/Runtime/HumanoidControl/Scripts/HumanoidControl.cs index 8315c1e..effbb88 100644 --- a/Runtime/HumanoidControl/Scripts/HumanoidControl.cs +++ b/Runtime/HumanoidControl/Scripts/HumanoidControl.cs @@ -384,7 +384,7 @@ namespace Passer.Humanoid { if (humanoidNetworking != null) { if (remoteAvatar != null) { - Possessable avatarPossessable = remoteAvatar.GetComponent(); + Possessable avatarPossessable = remoteAvatar.GetComponent(); if (avatarPossessable == null) humanoidNetworking.ChangeAvatar(this, fpAvatarPrefab.name); else @@ -1330,7 +1330,6 @@ namespace Passer.Humanoid { UpdateTargetsAndMovements(); CalculateVelocityAcceleration(); - UpdateAnimation(); UpdatePoseEvent(); } @@ -2178,7 +2177,7 @@ namespace Passer.Humanoid { float leftFootBoneDistance = leftFootTarget.foot.bone.transform.position.y - leftFootTarget.foot.target.transform.position.y; float rightFootBoneDistance = rightFootTarget.foot.bone.transform.position.y - rightFootTarget.foot.target.transform.position.y; if (leftFootBoneDistance > 0.02F && rightFootBoneDistance > 0.02F) - AdjustTrackingHeight(-0.01F); + AdjustTrackingHeight(-0.01F); } } @@ -2336,35 +2335,6 @@ namespace Passer.Humanoid { } #region Animation - public string animatorParameterForward; - public string animatorParameterSideward; - public string animatorParameterRotation; - public string animatorParameterHeight; - - // needed for the Editor - public int animatorParameterForwardIndex; - public int animatorParameterSidewardIndex; - public int animatorParameterRotationIndex; - public int animatorParameterHeightIndex; - - private void UpdateAnimation() { - if (targetsRig.runtimeAnimatorController != null) { - if (animatorParameterForward != null && animatorParameterForward != "") { - targetsRig.SetFloat(animatorParameterForward, velocity.z); - } - if (animatorParameterSideward != null && animatorParameterSideward != "") { - targetsRig.SetFloat(animatorParameterSideward, velocity.x); - } - if (animatorParameterRotation != null && animatorParameterRotation != "") { - targetsRig.SetFloat(animatorParameterRotation, turningVelocity); - } - - if (animatorParameterHeight != null && animatorParameterHeight != "") { - float relativeHeadHeight = headTarget.neck.target.transform.position.y - avatarNeckHeight; - targetsRig.SetFloat(animatorParameterHeight, relativeHeadHeight); - } - } - } private void PostAnimationCorrection() { diff --git a/Runtime/HumanoidControl/Scripts/HumanoidControl_Doc.cs b/Runtime/HumanoidControl/Scripts/HumanoidControl_Doc.cs index cf9d558..7e00723 100644 --- a/Runtime/HumanoidControl/Scripts/HumanoidControl_Doc.cs +++ b/Runtime/HumanoidControl/Scripts/HumanoidControl_Doc.cs @@ -13,7 +13,7 @@ /// Devices /// ------- /// * \ref UnityXRTracker "UnityXR" - /// * \ref OculusDoc "Oculus" + /// * \ref QuestDoc "Meta Rift/Quest" /// /// Input /// ----- diff --git a/Third-Party-Notices.md.meta b/Third-Party-Notices.md.meta new file mode 100644 index 0000000..43d1502 --- /dev/null +++ b/Third-Party-Notices.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 66c74601d6531f8479851bbff7409ea9 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json index 2f5d307..797d394 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.passervr.humanoidcontrol_free", - "version": "4.1.3-beta", + "version": "4.2.0-beta", "displayName": "Humanoid Control 4 Free", "description": "Humanoid Control is the next generation of human character control. It will provide you with an effortless setup for having animated characters in your environments.", "unity": "2019.4", @@ -25,11 +25,6 @@ "displayName": "Grocery Store Demo", "description": "The old Grocery Store demo from previous versions", "path": "Samples~/GroceryStore" - }, - { - "displayName": "Visitors & Sites", - "description": "Example Visitors and Sites for browsing the internet", - "path": "Samples~/VisitorsAndSites" } ] } \ No newline at end of file