Compare commits
	
		
			No commits in common. "main" and "4.1.3" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,5 +0,0 @@
 | 
			
		||||
Samples
 | 
			
		||||
Samples.meta
 | 
			
		||||
package.json
 | 
			
		||||
package.json.meta
 | 
			
		||||
Samples~.meta
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
Contibuting to Humanoid Control Free
 | 
			
		||||
====================================
 | 
			
		||||
Quick start
 | 
			
		||||
===========
 | 
			
		||||
If you want to contribute to this project, make sure you have access to the repository.
 | 
			
		||||
You can request access by logging into our [GitLab site](https://gitlab.passervr.com/) with an GitHub or Google account.
 | 
			
		||||
Besides that, it is best to [contract us](https://passervr.com/contract) about you wanting to contribute to this project. This will ensure you will get access more quickly.
 | 
			
		||||
 | 
			
		||||
@ -1,7 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: c55d00a05de5d8340a1a49f5d8b2aeed
 | 
			
		||||
TextScriptImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,190 +0,0 @@
 | 
			
		||||
#if hCUSTOM
 | 
			
		||||
using UnityEditor;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
    using Passer.Tracking;
 | 
			
		||||
 | 
			
		||||
    public class Custom_Editor : Tracker_Editor {
 | 
			
		||||
 | 
			
		||||
        #region Tracker
 | 
			
		||||
 | 
			
		||||
        public class TrackerProps : HumanoidControl_Editor.HumanoidTrackerProps {
 | 
			
		||||
            protected SerializedProperty bodySkeletonProp;
 | 
			
		||||
 | 
			
		||||
            public TrackerProps(SerializedObject serializedObject, HumanoidControl_Editor.HumanoidTargetObjs targetObjs, CustomTracker _custom)
 | 
			
		||||
                : base(serializedObject, targetObjs, _custom, "custom") {
 | 
			
		||||
                tracker = _custom;
 | 
			
		||||
 | 
			
		||||
                bodySkeletonProp = serializedObject.FindProperty(nameof(HumanoidControl.custom) + "." + nameof(HumanoidControl.custom.bodySkeleton));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector(HumanoidControl humanoid) {
 | 
			
		||||
                Inspector(humanoid, "Custom");
 | 
			
		||||
 | 
			
		||||
                if (humanoid.custom.enabled == false)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                EditorGUI.indentLevel++;
 | 
			
		||||
                bodySkeletonProp.objectReferenceValue = (BodySkeleton)EditorGUILayout.ObjectField("Body Skeleton", bodySkeletonProp.objectReferenceValue, typeof(BodySkeleton), true);
 | 
			
		||||
                EditorGUI.indentLevel--;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Tracker
 | 
			
		||||
 | 
			
		||||
        #region Head
 | 
			
		||||
 | 
			
		||||
        public class HeadTargetProps : HeadTarget_Editor.TargetProps {
 | 
			
		||||
            protected SerializedProperty sensorProp;
 | 
			
		||||
 | 
			
		||||
            public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
 | 
			
		||||
                : base(serializedObject, headTarget.custom, headTarget, "custom") {
 | 
			
		||||
 | 
			
		||||
                sensorProp = serializedObject.FindProperty("custom.sensorComponent");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector() {
 | 
			
		||||
                if (headTarget.humanoid.custom.enabled == false)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(headTarget.custom, headTarget);
 | 
			
		||||
                headTarget.custom.enabled = enabledProp.boolValue;
 | 
			
		||||
                if (!Application.isPlaying) {
 | 
			
		||||
                    headTarget.custom.SetSensor2Target();
 | 
			
		||||
                    headTarget.custom.ShowSensor(headTarget.humanoid.showRealObjects && headTarget.showRealObjects);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (enabledProp.boolValue) {
 | 
			
		||||
                    EditorGUI.indentLevel++;
 | 
			
		||||
                    if (sensorProp.objectReferenceValue == null && headTarget.custom.sensorComponent != null)
 | 
			
		||||
                        sensorProp.objectReferenceValue = headTarget.custom.sensorComponent; // sensorTransform.GetComponent<SensorComponent>();
 | 
			
		||||
 | 
			
		||||
                    sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
 | 
			
		||||
 | 
			
		||||
                    EditorGUI.indentLevel--;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Head
 | 
			
		||||
 | 
			
		||||
        #region Hand
 | 
			
		||||
 | 
			
		||||
        public class HandTargetProps : HandTarget_Editor.TargetProps {
 | 
			
		||||
            protected SerializedProperty sensorProp;
 | 
			
		||||
            protected SerializedProperty attachedBoneProp;
 | 
			
		||||
 | 
			
		||||
            public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
 | 
			
		||||
                : base(serializedObject, handTarget.custom, handTarget, "custom") {
 | 
			
		||||
 | 
			
		||||
                sensorProp = serializedObject.FindProperty("custom.sensorComponent");
 | 
			
		||||
                attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector() {
 | 
			
		||||
                if (handTarget.humanoid.custom.enabled == false)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(handTarget.custom, handTarget);
 | 
			
		||||
                handTarget.custom.enabled = enabledProp.boolValue;
 | 
			
		||||
                if (!Application.isPlaying) {
 | 
			
		||||
                    handTarget.custom.SetSensor2Target();
 | 
			
		||||
                    handTarget.custom.ShowSensor(handTarget.humanoid.showRealObjects && handTarget.showRealObjects);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (enabledProp.boolValue) {
 | 
			
		||||
                    EditorGUI.indentLevel++;
 | 
			
		||||
                    if (sensorProp.objectReferenceValue == null && handTarget.custom.sensorComponent != null)
 | 
			
		||||
                        sensorProp.objectReferenceValue = handTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
 | 
			
		||||
 | 
			
		||||
                    sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
 | 
			
		||||
                    attachedBoneProp.intValue = (int)(ArmBones)EditorGUILayout.EnumPopup("Bone", (ArmBones)attachedBoneProp.intValue);
 | 
			
		||||
 | 
			
		||||
                    EditorGUI.indentLevel--;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Hand
 | 
			
		||||
 | 
			
		||||
        #region Hips
 | 
			
		||||
 | 
			
		||||
        public class HipsTargetProps : HipsTarget_Editor.TargetProps {
 | 
			
		||||
            protected SerializedProperty sensorProp;
 | 
			
		||||
            protected SerializedProperty attachedBoneProp;
 | 
			
		||||
 | 
			
		||||
            public HipsTargetProps(SerializedObject serializedObject, HipsTarget hipsTarget)
 | 
			
		||||
                : base(serializedObject, hipsTarget.custom, hipsTarget, "custom") {
 | 
			
		||||
 | 
			
		||||
                sensorProp = serializedObject.FindProperty("custom.sensorComponent");
 | 
			
		||||
                attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector() {
 | 
			
		||||
                if (hipsTarget.humanoid.custom.enabled == false)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(hipsTarget.custom, hipsTarget);
 | 
			
		||||
                hipsTarget.custom.enabled = enabledProp.boolValue;
 | 
			
		||||
                if (!Application.isPlaying) {
 | 
			
		||||
                    hipsTarget.custom.SetSensor2Target();
 | 
			
		||||
                    hipsTarget.custom.ShowSensor(hipsTarget.humanoid.showRealObjects && hipsTarget.showRealObjects);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (enabledProp.boolValue) {
 | 
			
		||||
                    EditorGUI.indentLevel++;
 | 
			
		||||
                    if (sensorProp.objectReferenceValue == null && hipsTarget.custom.sensorComponent != null)
 | 
			
		||||
                        sensorProp.objectReferenceValue = hipsTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
 | 
			
		||||
 | 
			
		||||
                    sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
 | 
			
		||||
                    attachedBoneProp.intValue = (int)(TorsoBones)EditorGUILayout.EnumPopup("Bone", (TorsoBones)attachedBoneProp.intValue);
 | 
			
		||||
 | 
			
		||||
                    EditorGUI.indentLevel--;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Hips
 | 
			
		||||
 | 
			
		||||
        #region Foot
 | 
			
		||||
 | 
			
		||||
        public class FootTargetProps : FootTarget_Editor.TargetProps {
 | 
			
		||||
            protected SerializedProperty sensorProp;
 | 
			
		||||
            protected SerializedProperty attachedBoneProp;
 | 
			
		||||
 | 
			
		||||
            public FootTargetProps(SerializedObject serializedObject, FootTarget footTarget)
 | 
			
		||||
                : base(serializedObject, footTarget.custom, footTarget, "custom") {
 | 
			
		||||
 | 
			
		||||
                sensorProp = serializedObject.FindProperty("custom.sensorComponent");
 | 
			
		||||
                attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector() {
 | 
			
		||||
                if (footTarget.humanoid.custom.enabled == false)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(footTarget.custom, footTarget);
 | 
			
		||||
                footTarget.custom.enabled = enabledProp.boolValue;
 | 
			
		||||
                if (!Application.isPlaying) {
 | 
			
		||||
                    footTarget.custom.SetSensor2Target();
 | 
			
		||||
                    footTarget.custom.ShowSensor(footTarget.humanoid.showRealObjects && footTarget.showRealObjects);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (enabledProp.boolValue) {
 | 
			
		||||
                    EditorGUI.indentLevel++;
 | 
			
		||||
                    if (sensorProp.objectReferenceValue == null && footTarget.custom.sensorComponent != null)
 | 
			
		||||
                        sensorProp.objectReferenceValue = footTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
 | 
			
		||||
 | 
			
		||||
                    sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
 | 
			
		||||
                    attachedBoneProp.intValue = (int)(LegBones)EditorGUILayout.EnumPopup("Bone", (LegBones)attachedBoneProp.intValue);
 | 
			
		||||
 | 
			
		||||
                    EditorGUI.indentLevel--;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Foot
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 44d806c9717b1fa46a86f6a982c5e1b9
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,143 +0,0 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
#if hPHOTON2
 | 
			
		||||
using Photon.Pun;
 | 
			
		||||
#if hPUNVOICE2 && !UNITY_WEBGL
 | 
			
		||||
using Photon.Voice.PUN;
 | 
			
		||||
using Photon.Voice.Unity;
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#if UNITY_EDITOR
 | 
			
		||||
using UnityEditor;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
    [InitializeOnLoad]
 | 
			
		||||
    public class OnLoadHumanoidPlayerPun {
 | 
			
		||||
        static OnLoadHumanoidPlayerPun() {
 | 
			
		||||
            CheckHumanoidPlayer();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected static void CheckHumanoidPlayerVoice() {
 | 
			
		||||
#if hPUNVOICE2
 | 
			
		||||
            string prefabPath = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefabPath();
 | 
			
		||||
            prefabPath = prefabPath.Substring(0, prefabPath.Length - 21) + "HumanoidPlayerVoice.prefab";
 | 
			
		||||
            GameObject playerVoicePrefab = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefab(prefabPath);
 | 
			
		||||
            if (playerVoicePrefab == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            bool hasChanged = false;
 | 
			
		||||
#if UNITY_WEBGL
 | 
			
		||||
            PhotonView photonView = playerVoicePrefab.GetComponent<PhotonView>();
 | 
			
		||||
            if (photonView == null) {
 | 
			
		||||
                photonView = playerVoicePrefab.AddComponent<PhotonView>();
 | 
			
		||||
                hasChanged = true;
 | 
			
		||||
            }
 | 
			
		||||
#else
 | 
			
		||||
            PhotonVoiceView photonVoiceView = playerVoicePrefab.GetComponent<PhotonVoiceView>();
 | 
			
		||||
            if (photonVoiceView == null) {
 | 
			
		||||
                photonVoiceView = playerVoicePrefab.AddComponent<PhotonVoiceView>();
 | 
			
		||||
                hasChanged = true;
 | 
			
		||||
            }
 | 
			
		||||
            if (photonVoiceView.UsePrimaryRecorder == false) {
 | 
			
		||||
                photonVoiceView.UsePrimaryRecorder = true;
 | 
			
		||||
                hasChanged = true;
 | 
			
		||||
            }
 | 
			
		||||
            PhotonTransformView photonTransformView = playerVoicePrefab.GetComponent<PhotonTransformView>();
 | 
			
		||||
            if (photonTransformView == null) {
 | 
			
		||||
                photonTransformView = playerVoicePrefab.AddComponent<PhotonTransformView>();
 | 
			
		||||
                hasChanged = true;
 | 
			
		||||
            }
 | 
			
		||||
            PhotonView photonView = playerVoicePrefab.GetComponent<PhotonView>();
 | 
			
		||||
            if (photonView != null) {
 | 
			
		||||
                // should always be there because of the photonVoiceView
 | 
			
		||||
                if (photonView.ObservedComponents == null) {
 | 
			
		||||
                    photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
 | 
			
		||||
                    photonView.ObservedComponents.Add(photonTransformView);
 | 
			
		||||
                    photonView.Synchronization = ViewSynchronization.UnreliableOnChange;
 | 
			
		||||
                    hasChanged = true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //Speaker speaker = playerVoicePrefab.GetComponent<Speaker>();
 | 
			
		||||
            //if (speaker == null) {
 | 
			
		||||
            //    speaker = playerVoicePrefab.AddComponent<Speaker>();
 | 
			
		||||
            //    photonVoiceView.SpeakerInUse = speaker;
 | 
			
		||||
            //    hasChanged = true;
 | 
			
		||||
 | 
			
		||||
            //    AudioSource audioSource = playerVoicePrefab.GetComponent<AudioSource>();
 | 
			
		||||
            //    if (audioSource != null) {
 | 
			
		||||
            //        Debug.Log("adjust rolloff");
 | 
			
		||||
            //        // default logaritmic only work when people are closer than 0.5m...
 | 
			
		||||
            //        audioSource.maxDistance = 5;
 | 
			
		||||
            //    }
 | 
			
		||||
            //}
 | 
			
		||||
#endif
 | 
			
		||||
            if (hasChanged)
 | 
			
		||||
                OnLoadHumanoidPlayer.UpdateHumanoidPrefab(playerVoicePrefab, prefabPath);
 | 
			
		||||
#if !UNITY_WEBGL
 | 
			
		||||
            CheckVoiceNetwork();
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#if hPUNVOICE2 && !UNITY_WEBGL
 | 
			
		||||
        protected static void CheckVoiceNetwork() {
 | 
			
		||||
            NetworkingStarter networkingStarter = Object.FindObjectOfType<NetworkingStarter>();
 | 
			
		||||
            if (networkingStarter == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            PhotonVoiceNetwork voiceNetwork = Object.FindObjectOfType<PhotonVoiceNetwork>();
 | 
			
		||||
            if (voiceNetwork != null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            GameObject voiceNetworkObject = new GameObject("Voice Network");
 | 
			
		||||
            voiceNetwork = voiceNetworkObject.AddComponent<PhotonVoiceNetwork>();
 | 
			
		||||
 | 
			
		||||
            Recorder voiceRecorder = voiceNetworkObject.AddComponent<Recorder>();
 | 
			
		||||
            voiceRecorder.ReactOnSystemChanges = true;
 | 
			
		||||
            voiceRecorder.TransmitEnabled = true;
 | 
			
		||||
            voiceRecorder.SamplingRate = POpusCodec.Enums.SamplingRate.Sampling48000;
 | 
			
		||||
 | 
			
		||||
            voiceNetwork.PrimaryRecorder = voiceRecorder;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        public static void CheckHumanoidPlayer() {
 | 
			
		||||
#if hPHOTON1 || hPHOTON2
 | 
			
		||||
            string prefabPath = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefabPath();
 | 
			
		||||
            GameObject playerPrefab = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefab(prefabPath);
 | 
			
		||||
 | 
			
		||||
            bool hasChanged = false;
 | 
			
		||||
#if hNW_PHOTON
 | 
			
		||||
            if (playerPrefab != null) {
 | 
			
		||||
                PhotonView photonView = playerPrefab.GetComponent<PhotonView>();
 | 
			
		||||
                if (photonView == null) {
 | 
			
		||||
                    photonView = playerPrefab.AddComponent<PhotonView>();
 | 
			
		||||
                    photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
 | 
			
		||||
#if hPHOTON2
 | 
			
		||||
                    photonView.Synchronization = ViewSynchronization.UnreliableOnChange;
 | 
			
		||||
#else
 | 
			
		||||
                    photonView.synchronization = ViewSynchronization.UnreliableOnChange;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                    HumanoidPlayer humanoidPun = playerPrefab.GetComponent<HumanoidPlayer>();
 | 
			
		||||
                    if (humanoidPun != null)
 | 
			
		||||
                        photonView.ObservedComponents.Add(humanoidPun);
 | 
			
		||||
                    hasChanged = true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
#else
 | 
			
		||||
            if (playerPrefab != null) {
 | 
			
		||||
                PhotonView photonView = playerPrefab.GetComponent<PhotonView>();
 | 
			
		||||
                if (photonView != null)
 | 
			
		||||
                    Object.DestroyImmediate(photonView, true);
 | 
			
		||||
            }
 | 
			
		||||
#endif
 | 
			
		||||
            if (hasChanged)
 | 
			
		||||
                OnLoadHumanoidPlayer.UpdateHumanoidPrefab(playerPrefab, prefabPath);
 | 
			
		||||
#endif
 | 
			
		||||
            CheckHumanoidPlayerVoice();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 185ec4e1799d1ac4d867b69454f1cd0f
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,108 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
using UnityEditor;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using UnityEngine.Networking;
 | 
			
		||||
#if hNW_PHOTON
 | 
			
		||||
#if hPHOTON2
 | 
			
		||||
using Photon.Pun;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
namespace Passer {
 | 
			
		||||
 | 
			
		||||
    [CustomEditor(typeof(PhotonStarter))]
 | 
			
		||||
    public class PunStarter_Editor : Editor {
 | 
			
		||||
 | 
			
		||||
        public override void OnInspectorGUI() {
 | 
			
		||||
            base.OnInspectorGUI();
 | 
			
		||||
 | 
			
		||||
            HumanoidControl[] humanoids = FindObjectsOfType<HumanoidControl>();
 | 
			
		||||
            if (humanoids.Length != 1)
 | 
			
		||||
                // We only support sitatuation with one humanoid in the scene
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            //HumanoidControl humanoid = humanoids[0];
 | 
			
		||||
 | 
			
		||||
            if (Application.isPlaying)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            //GameObject humanoidPrefab = CheckHumanoidPrefab(humanoid);
 | 
			
		||||
            //NetworkingComponentsInspectorPun(humanoid, humanoidPrefab);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //private GameObject CheckHumanoidPrefab(HumanoidControl humanoid) {
 | 
			
		||||
        //    GameObject humanoidPrefab = Resources.Load<GameObject>(humanoid.gameObject.name + "_generated");
 | 
			
		||||
        //    if (humanoidPrefab == null) {
 | 
			
		||||
        //        humanoidPrefab = PrefabUtility.CreatePrefab("Assets/Humanoid/Prefabs/Networking/Resources/" + humanoid.gameObject.name + "_generated.prefab", humanoid.gameObject);
 | 
			
		||||
        //        humanoidPrefab.gameObject.SetActive(true);
 | 
			
		||||
        //    }
 | 
			
		||||
        //    return humanoidPrefab;
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //private void UpdateHumanoidPrefab(HumanoidControl humanoid) {
 | 
			
		||||
        //    if (humanoid != null) {
 | 
			
		||||
        //        GameObject humanoidPrefab = Resources.Load<GameObject>(humanoid.gameObject.name + "_generated");
 | 
			
		||||
        //        if (humanoidPrefab != null && humanoid.gameObject != humanoidPrefab)
 | 
			
		||||
        //            PrefabUtility.ReplacePrefab(humanoid.gameObject, humanoidPrefab, ReplacePrefabOptions.ConnectToPrefab);
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
//        private void NetworkingComponentsInspectorPun(HumanoidControl humanoid, GameObject humanoidPrefab) {
 | 
			
		||||
//#if hPHOTON1 || hPHOTON2
 | 
			
		||||
//#if hNW_PHOTON
 | 
			
		||||
//            CheckPunStarter(humanoid, humanoidPrefab);
 | 
			
		||||
//            PhotonView photonView = humanoid.GetComponent<PhotonView>();
 | 
			
		||||
//            if (photonView == null)
 | 
			
		||||
//                photonView = humanoid.gameObject.AddComponent<PhotonView>();
 | 
			
		||||
//            photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
 | 
			
		||||
//            photonView.ObservedComponents.Add(humanoid);
 | 
			
		||||
//#else
 | 
			
		||||
//            cleanupPhotonView = humanoid.GetComponent<PhotonView>();
 | 
			
		||||
//#endif
 | 
			
		||||
//#endif
 | 
			
		||||
//        }
 | 
			
		||||
 | 
			
		||||
//        private void CheckPunStarter(HumanoidControl humanoid, GameObject humanoidPrefab) {
 | 
			
		||||
//            if (Application.isPlaying)
 | 
			
		||||
//                return;
 | 
			
		||||
 | 
			
		||||
//#if hNW_PHOTON
 | 
			
		||||
//            PhotonStarter photonStarter = FindObjectOfType<PhotonStarter>();
 | 
			
		||||
//            if (photonStarter != null && humanoidPrefab != null && photonStarter.playerPrefab != humanoidPrefab) {
 | 
			
		||||
//                Undo.RecordObject(photonStarter, "Updated Player Prefab");
 | 
			
		||||
//                photonStarter.playerPrefab = humanoidPrefab;
 | 
			
		||||
//            }
 | 
			
		||||
//#endif
 | 
			
		||||
//        }
 | 
			
		||||
        public void OnDisable() {
 | 
			
		||||
            Cleanup();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#if hNW_UNET
 | 
			
		||||
        private NetworkIdentity cleanupNetworkIdentity;
 | 
			
		||||
#endif
 | 
			
		||||
#if hPHOTON1 || hPHOTON2
 | 
			
		||||
        private PhotonView cleanupPhotonView;
 | 
			
		||||
#endif
 | 
			
		||||
        private GameObject cleanupPunStarter;
 | 
			
		||||
        private void Cleanup() {
 | 
			
		||||
#if hNW_UNET
 | 
			
		||||
            if (cleanupNetworkIdentity) {
 | 
			
		||||
                DestroyImmediate(cleanupNetworkIdentity, true);
 | 
			
		||||
                cleanupNetworkIdentity = null;
 | 
			
		||||
            }
 | 
			
		||||
#endif
 | 
			
		||||
#if hPHOTON1 || hPHOTON2
 | 
			
		||||
            if (cleanupPhotonView) {
 | 
			
		||||
                DestroyImmediate(cleanupPhotonView, true);
 | 
			
		||||
                cleanupPhotonView = null;
 | 
			
		||||
            }
 | 
			
		||||
#endif
 | 
			
		||||
            if (cleanupPunStarter) {
 | 
			
		||||
                DestroyImmediate(cleanupPunStarter, true);
 | 
			
		||||
                cleanupPunStarter = null;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
*/
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: e86563dd015c559479420645216c4a70
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -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(0, assetPath.Length - 18);
 | 
			
		||||
                    humanoidPath = assetPath.Substring(6, assetPath.Length - 24);
 | 
			
		||||
                    return humanoidPath;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@ -250,6 +250,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            //anyChanged |= SteamVRSettingUI(serializedConfiguration);
 | 
			
		||||
            //anyChanged |= OculusSettingUI(serializedConfiguration);
 | 
			
		||||
            //anyChanged |= WindowsMRSettingUI(serializedConfiguration);
 | 
			
		||||
            //anyChanged |= VrtkSettingUI(serializedConfiguration);
 | 
			
		||||
 | 
			
		||||
            //anyChanged |= LeapSettingUI(serializedConfiguration);
 | 
			
		||||
            //anyChanged |= Kinect1SettingUI(serializedConfiguration);
 | 
			
		||||
@ -429,6 +430,24 @@ namespace Passer.Humanoid {
 | 
			
		||||
            return anyChanged;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool VrtkSettingUI(SerializedObject serializedConfiguration) {
 | 
			
		||||
 | 
			
		||||
            SerializedProperty vrtkSupportProp = serializedConfiguration.FindProperty("vrtkSupport");
 | 
			
		||||
 | 
			
		||||
            if (!isVrtkSupportAvailable)
 | 
			
		||||
                vrtkSupportProp.boolValue = false;
 | 
			
		||||
 | 
			
		||||
            else if (!isVrtkAvailable) {
 | 
			
		||||
                using (new EditorGUI.DisabledScope(true)) {
 | 
			
		||||
                    EditorGUILayout.Toggle("VRTK Supoort", false);
 | 
			
		||||
                }
 | 
			
		||||
                EditorGUILayout.HelpBox("VRTK is not available. Please download it from the Asset Store.", MessageType.Warning, true);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
                vrtkSupportProp.boolValue = EditorGUILayout.Toggle("VRTK Support", vrtkSupportProp.boolValue);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool LeapSettingUI(SerializedObject serializedConfiguration) {
 | 
			
		||||
            SerializedProperty leapSupportProp = serializedConfiguration.FindProperty("leapSupport");
 | 
			
		||||
 | 
			
		||||
@ -781,6 +800,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            configuration.viveTrackerSupport = CheckExtensionViveTracker(configuration);
 | 
			
		||||
            configuration.oculusSupport = CheckExtensionOculus(configuration);
 | 
			
		||||
            configuration.windowsMRSupport = CheckExtensionWindowsMR(configuration);
 | 
			
		||||
            configuration.vrtkSupport = CheckExtensionVRTK(configuration);
 | 
			
		||||
            configuration.neuronSupport = CheckExtensionNeuron(configuration);
 | 
			
		||||
            configuration.hi5Support = CheckExtensionHi5(configuration);
 | 
			
		||||
            configuration.realsenseSupport = CheckExtensionRealsense(configuration);
 | 
			
		||||
@ -828,12 +848,8 @@ namespace Passer.Humanoid {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool CheckExtensionViveTracker(Configuration configuration) {
 | 
			
		||||
#if UNITY_STANDALONE_WIN
 | 
			
		||||
            bool available = isSteamVrAvailable && isViveTrackerSupportAvailable;
 | 
			
		||||
#else
 | 
			
		||||
            bool available = false;
 | 
			
		||||
#endif
 | 
			
		||||
            bool enabled = true; // configuration.viveTrackerSupport;
 | 
			
		||||
            bool available = isViveTrackerSupportAvailable;
 | 
			
		||||
            bool enabled = configuration.viveTrackerSupport;
 | 
			
		||||
            CheckExtension(available && enabled, "hVIVETRACKER");
 | 
			
		||||
            return available && enabled;
 | 
			
		||||
        }
 | 
			
		||||
@ -849,16 +865,17 @@ namespace Passer.Humanoid {
 | 
			
		||||
            return CheckExtension(enabled, windowsMRPath, "hWINDOWSMR");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool CheckExtensionNeuron(Configuration configuration) {
 | 
			
		||||
#if UNITY_STANDALONE_WIN
 | 
			
		||||
            bool enabled = isNeuronSupportAvailable;
 | 
			
		||||
#else
 | 
			
		||||
            bool enabled = false;
 | 
			
		||||
#endif
 | 
			
		||||
            CheckExtension(enabled, "hNEURON");
 | 
			
		||||
        public static bool CheckExtensionVRTK(Configuration configuration) {
 | 
			
		||||
            bool enabled = configuration.vrtkSupport && isVrtkAvailable;
 | 
			
		||||
            CheckExtension(enabled, "hVRTK");
 | 
			
		||||
            return enabled;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool CheckExtensionNeuron(Configuration configuration) {
 | 
			
		||||
            bool enabled = configuration.neuronSupport;
 | 
			
		||||
            return CheckExtension(enabled, neuronPath, "hNEURON");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool CheckExtensionHi5(Configuration configuration) {
 | 
			
		||||
            bool available = configuration.hi5Support;
 | 
			
		||||
            CheckExtension(available, "hHI5");
 | 
			
		||||
@ -874,7 +891,6 @@ namespace Passer.Humanoid {
 | 
			
		||||
        public static bool CheckExtensionLeap(Configuration configuration) {
 | 
			
		||||
            bool available = isLeapAvailable && isLeapSupportAvailable;
 | 
			
		||||
            CheckExtension(available, "hLEAP");
 | 
			
		||||
            CheckExtension(isUltraLeapAvailable, "hULTRALEAP");
 | 
			
		||||
            configuration.leapSupport = available;
 | 
			
		||||
            return available;
 | 
			
		||||
        }
 | 
			
		||||
@ -933,7 +949,6 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
        public static bool CheckExtensionOptitrack(Configuration configuration) {
 | 
			
		||||
            bool available = isOptitrackAvailable && isOptitrackSupportAvailable;
 | 
			
		||||
            available = false; // hard disable because the code currently contains bugs
 | 
			
		||||
            CheckExtension(available, "hOPTITRACK");
 | 
			
		||||
            configuration.optitrackSupport = available;
 | 
			
		||||
            return available;
 | 
			
		||||
@ -1023,7 +1038,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static void CheckFaceTracking(Configuration configuration) {
 | 
			
		||||
            if (DoesTypeExist("Passer.Humanoid.FaceTarget")) {
 | 
			
		||||
            if (IsFileAvailable(facePath)) {
 | 
			
		||||
                GlobalDefine("hFACE");
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
@ -1098,9 +1113,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#endregion
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
#region Availability
 | 
			
		||||
        #region Availability
 | 
			
		||||
 | 
			
		||||
        public static bool DoesTypeExist(string className) {
 | 
			
		||||
            System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
 | 
			
		||||
@ -1111,7 +1126,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#region SDKs
 | 
			
		||||
        #region SDKs
 | 
			
		||||
 | 
			
		||||
        protected static bool isUnityXRAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
@ -1120,9 +1135,6 @@ namespace Passer.Humanoid {
 | 
			
		||||
                    return false;
 | 
			
		||||
                if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.management"))
 | 
			
		||||
                    return true;
 | 
			
		||||
                else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.oculus"))
 | 
			
		||||
                    // Somehow management is no longer available when Oculus is used
 | 
			
		||||
                    return true;
 | 
			
		||||
                else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.openxr"))
 | 
			
		||||
                    // Somehow management is no longer available when OpenXR is used
 | 
			
		||||
                    return true;
 | 
			
		||||
@ -1136,7 +1148,8 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
        private static bool isSteamVrAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
                return DoesTypeExist("Valve.VR.SteamVR");
 | 
			
		||||
                return false;
 | 
			
		||||
                //return DoesTypeExist("Valve.VR.SteamVR");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1150,15 +1163,15 @@ namespace Passer.Humanoid {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static bool isLeapAvailable {
 | 
			
		||||
        private static bool isVrtkAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
                return DoesTypeExist("Leap.Hand");
 | 
			
		||||
                return DoesTypeExist("VRTK.VRTK_SDKManager");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static bool isUltraLeapAvailable {
 | 
			
		||||
        private static bool isLeapAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
                return DoesTypeExist("Leap.Unity.LeapTestProvider") == false;
 | 
			
		||||
                return DoesTypeExist("Leap.Hand");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1262,9 +1275,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endregion SDKs
 | 
			
		||||
        #endregion SDKs
 | 
			
		||||
 | 
			
		||||
#region Support
 | 
			
		||||
        #region Support
 | 
			
		||||
 | 
			
		||||
        private static bool isOpenVrSupportAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
@ -1313,6 +1326,11 @@ namespace Passer.Humanoid {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
        private static bool isVrtkSupportAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
                return DoesTypeExist("Passer.Humanoid.VrtkTracker");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static bool isLeapSupportAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
@ -1390,7 +1408,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
        private static bool isNeuronSupportAvailable {
 | 
			
		||||
            get {
 | 
			
		||||
                return DoesTypeExist("Passer.Tracking.PerceptionNeuron");
 | 
			
		||||
                return DoesTypeExist("Passer.Humanoid.NeuronTracker");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1427,9 +1445,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#endregion Support
 | 
			
		||||
        #endregion Support
 | 
			
		||||
 | 
			
		||||
#endregion
 | 
			
		||||
        #endregion
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class CustomAssetUtility {
 | 
			
		||||
@ -54,15 +54,14 @@ namespace Passer.Humanoid {
 | 
			
		||||
            protected void OculusHandTrackingInspector() {
 | 
			
		||||
#if hOCHAND
 | 
			
		||||
                GUIContent labelText = new GUIContent(
 | 
			
		||||
                    "Quest Hand Tracking",
 | 
			
		||||
                    "Enables hand tracking on the Meta Quest"
 | 
			
		||||
                    "Oculus Hand Tracking",
 | 
			
		||||
                    "Enables hand tracking on the Oculus Quest"
 | 
			
		||||
                    );
 | 
			
		||||
                oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
 | 
			
		||||
#endif
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            protected virtual void CheckQuestManifest() {
 | 
			
		||||
                try {
 | 
			
		||||
                string manifestPath = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
 | 
			
		||||
                FileInfo fileInfo = new FileInfo(manifestPath);
 | 
			
		||||
                fileInfo.Directory.Create();
 | 
			
		||||
@ -71,15 +70,10 @@ namespace Passer.Humanoid {
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                string humanoidPath = Configuration_Editor.FindHumanoidFolder();
 | 
			
		||||
                    string questManifestPath = Application.dataPath.Substring(0, Application.dataPath.Length - 6) + // remove /Assets
 | 
			
		||||
                        humanoidPath + "Extensions/Oculus/QuestManifest.xml";
 | 
			
		||||
                    Debug.Log(questManifestPath);
 | 
			
		||||
                string questManifestPath = Application.dataPath + humanoidPath + "Extensions/Oculus/QuestManifest.xml";
 | 
			
		||||
                File.Copy(questManifestPath, manifestPath);
 | 
			
		||||
            }
 | 
			
		||||
                catch (System.Exception ) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            protected void ViveHandTrackingInspector(HumanoidControl humanoid) {
 | 
			
		||||
#if hVIVEHAND
 | 
			
		||||
@ -110,7 +104,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
 | 
			
		||||
                : base(serializedObject, headTarget.unityXR, headTarget, nameof(HeadTarget.unityXR)) {
 | 
			
		||||
 | 
			
		||||
                hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".sensorComponent");
 | 
			
		||||
                hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".hmd");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector() {
 | 
			
		||||
@ -122,18 +116,17 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
                if (enabledProp.boolValue) {
 | 
			
		||||
                    EditorGUI.indentLevel++;
 | 
			
		||||
                    if (headTarget.unityXR.sensorComponent == null) {
 | 
			
		||||
                    if (headTarget.unityXR.hmd == null) {
 | 
			
		||||
                        // Hmd does not exist
 | 
			
		||||
                        using (new EditorGUILayout.HorizontalScope()) {
 | 
			
		||||
                            EditorGUILayout.LabelField("Hmd", GUILayout.Width(120));
 | 
			
		||||
                            if (GUILayout.Button("Show")) {
 | 
			
		||||
                                //headTarget.unityXR.CheckSensor(headTarget);
 | 
			
		||||
                                headTarget.unityXR.CheckSensor(headTarget); //.GetSensorComponent();
 | 
			
		||||
                                headTarget.unityXR.CheckSensor(headTarget);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                        hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.sensorComponent, typeof(UnityXRHmd), true);
 | 
			
		||||
                        hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.hmd, typeof(UnityXRHmd), true);
 | 
			
		||||
                    EditorGUI.indentLevel--;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
@ -152,7 +145,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
 | 
			
		||||
                : base(serializedObject, handTarget.unityXR, handTarget, "unityXR") {
 | 
			
		||||
 | 
			
		||||
                controllerProp = serializedObject.FindProperty("unityXR.sensorComponent");
 | 
			
		||||
                controllerProp = serializedObject.FindProperty("unityXR.controller");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public override void Inspector() {
 | 
			
		||||
@ -10,7 +10,6 @@ using Photon.Pun;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
namespace Passer {
 | 
			
		||||
    using Tracking;
 | 
			
		||||
    using Humanoid;
 | 
			
		||||
 | 
			
		||||
    [CanEditMultipleObjects]
 | 
			
		||||
@ -290,6 +289,15 @@ namespace Passer {
 | 
			
		||||
#if pUNITYXR
 | 
			
		||||
                new UnityXR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.unityXR),
 | 
			
		||||
#endif
 | 
			
		||||
//#if hOPENVR && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
 | 
			
		||||
//                new OpenVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.openVR),
 | 
			
		||||
//#endif
 | 
			
		||||
//#if hSTEAMVR && UNITY_STANDALONE_WIN
 | 
			
		||||
//                //new SteamVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.steamVR),
 | 
			
		||||
//#endif
 | 
			
		||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
 | 
			
		||||
//                new Oculus_Editor.TrackerProps(serializedObject, targetObjs, humanoid.oculus),
 | 
			
		||||
//#endif
 | 
			
		||||
#if hWINDOWSMR && UNITY_WSA_10_0
 | 
			
		||||
                new WindowsMR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.mixedReality),
 | 
			
		||||
 | 
			
		||||
@ -297,11 +305,14 @@ namespace Passer {
 | 
			
		||||
#if hWAVEVR
 | 
			
		||||
                new WaveVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.waveVR),
 | 
			
		||||
#endif
 | 
			
		||||
#if hVRTK
 | 
			
		||||
                new Vrtk_Editor.TrackerProps(serializedObject, targetObjs, humanoid.vrtk),
 | 
			
		||||
#endif
 | 
			
		||||
#if hHYDRA && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
 | 
			
		||||
                new Hydra_Editor.TrackerProps(serializedObject, targetObjs, humanoid.hydra),
 | 
			
		||||
#endif
 | 
			
		||||
#if hLEAP && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
 | 
			
		||||
                new LeapMotion_Editor.TrackerProps(serializedObject, targetObjs, humanoid.leap),
 | 
			
		||||
                new LeapMotion_Editor.TrackerProps(serializedObject, targetObjs, humanoid.leapTracker),
 | 
			
		||||
#endif
 | 
			
		||||
#if hKINECT1 && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
 | 
			
		||||
                new Kinect1_Editor.TrackerProps(serializedObject, targetObjs, humanoid.kinect1),
 | 
			
		||||
@ -377,11 +388,24 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
        #region Animations
 | 
			
		||||
 | 
			
		||||
        private void InitAnimations(HumanoidControl humanoid) { }
 | 
			
		||||
        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");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        bool showAnimatorParameters = false;
 | 
			
		||||
        private void AnimatorInspector(HumanoidControl humanoid) {
 | 
			
		||||
            AnimatorControllerInspector(humanoid);
 | 
			
		||||
            AnimatorParametersInspector(humanoid);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void AnimatorControllerInspector(HumanoidControl humanoid) {
 | 
			
		||||
@ -410,6 +434,44 @@ 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)
 | 
			
		||||
@ -661,7 +723,6 @@ namespace Passer {
 | 
			
		||||
                CalibrateAtStartSetting();
 | 
			
		||||
                StartPositionSetting();
 | 
			
		||||
                ScalingSetting();
 | 
			
		||||
                FloatCorrectionSetting();
 | 
			
		||||
                DontDestroySetting();
 | 
			
		||||
                if (IsPrefab(humanoid))
 | 
			
		||||
                    DisconnectInstancesSetting();
 | 
			
		||||
@ -720,15 +781,6 @@ namespace Passer {
 | 
			
		||||
            scalingProp.intValue = (int)(HumanoidControl.ScalingType)EditorGUILayout.EnumPopup(text, (HumanoidControl.ScalingType)scalingProp.intValue);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected void FloatCorrectionSetting() {
 | 
			
		||||
            SerializedProperty floatCorrectionProp = serializedObject.FindProperty(nameof(HumanoidControl.floatCorrection));
 | 
			
		||||
            GUIContent text = new GUIContent(
 | 
			
		||||
                "Float Correction",
 | 
			
		||||
                "Correct floating avatars when user is taller than the avatar"
 | 
			
		||||
                );
 | 
			
		||||
            floatCorrectionProp.boolValue = EditorGUILayout.Toggle(text, floatCorrectionProp.boolValue);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ShowTrackers(HumanoidControl humanoid, bool shown) {
 | 
			
		||||
            foreach (Tracker tracker in humanoid.trackers)
 | 
			
		||||
                tracker.ShowTracker(shown);
 | 
			
		||||
@ -855,7 +907,6 @@ namespace Passer {
 | 
			
		||||
                else {
 | 
			
		||||
                    humanoid.pose.Show(humanoid);
 | 
			
		||||
                    humanoid.CopyRigToTargets();
 | 
			
		||||
                    humanoid.MatchTargetsToAvatar();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -1085,7 +1136,7 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
            private void RemoveControllers() {
 | 
			
		||||
                foreach (HumanoidSensor sensor in tracker.sensors)
 | 
			
		||||
                    RemoveSensor(sensor.sensorComponent);
 | 
			
		||||
                    RemoveTransform(sensor.sensorTransform);
 | 
			
		||||
 | 
			
		||||
                if (tracker.headSensor != null)
 | 
			
		||||
                    tracker.headSensor.RemoveController(headSensorProp);
 | 
			
		||||
@ -1101,16 +1152,11 @@ namespace Passer {
 | 
			
		||||
                    tracker.rightFootSensor.RemoveController(rightFootSensorProp);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void RemoveSensor(Tracking.SensorComponent sensorComponent) {
 | 
			
		||||
                if (sensorComponent != null)
 | 
			
		||||
                    DestroyImmediate(sensorComponent.gameObject, true);
 | 
			
		||||
            private void RemoveTransform(Transform trackerTransform) {
 | 
			
		||||
                if (trackerTransform != null)
 | 
			
		||||
                    DestroyImmediate(trackerTransform.gameObject, true);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //private void RemoveTransform(Transform trackerTransform) {
 | 
			
		||||
            //    if (trackerTransform != null)
 | 
			
		||||
            //        DestroyImmediate(trackerTransform.gameObject, true);
 | 
			
		||||
            //}
 | 
			
		||||
 | 
			
		||||
            private void SetSensors2Target() {
 | 
			
		||||
                foreach (HumanoidSensor sensor in tracker.sensors) {
 | 
			
		||||
                    sensor.SetSensor2Target();
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B  | 
| 
		 Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B  | 
@ -22,8 +22,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static GameObject GetHumanoidPlayerPrefab(string prefabPath) {
 | 
			
		||||
            //GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
 | 
			
		||||
            GameObject prefab = null;
 | 
			
		||||
            GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
 | 
			
		||||
            return prefab;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -236,13 +236,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
                if (bones[i] == null || bones[i].bone == null || bones[i].bone.transform == null)
 | 
			
		||||
                    continue;
 | 
			
		||||
 | 
			
		||||
#if UNITY_2022_1_OR_NEWER
 | 
			
		||||
                Handles.FreeMoveHandle(bones[i].bone.transform.position, 0.002F, Vector3.zero, DotHandleCapSaveID);
 | 
			
		||||
#else
 | 
			
		||||
                Handles.FreeMoveHandle(bones[i].bone.transform.position, bones[i].bone.transform.rotation, 0.002F, Vector3.zero, DotHandleCapSaveID);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                controlIds[i] = lastControlID;
 | 
			
		||||
                boneIds[i] = bones[i].boneId;
 | 
			
		||||
            }
 | 
			
		||||
@ -323,6 +317,6 @@ namespace Passer.Humanoid {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#endregion
 | 
			
		||||
        #endregion
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -33,7 +33,7 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
        private void InitEditors() {
 | 
			
		||||
            allProps = new TargetProps[] {
 | 
			
		||||
#if hVIVETRACKER
 | 
			
		||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
 | 
			
		||||
                new ViveTracker_Editor.FootTargetProps(serializedObject, footTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hKINECT1
 | 
			
		||||
@ -48,9 +48,9 @@ namespace Passer {
 | 
			
		||||
#if hORBBEC
 | 
			
		||||
                new Astra_Editor.FootTargetProps(serializedObject, footTarget),
 | 
			
		||||
#endif
 | 
			
		||||
//#if hNEURON
 | 
			
		||||
//                new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
 | 
			
		||||
//#endif
 | 
			
		||||
#if hNEURON
 | 
			
		||||
                new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hOPTITRACK
 | 
			
		||||
                new Optitrack_Editor.FootTargetProps(serializedObject, footTarget),
 | 
			
		||||
#endif
 | 
			
		||||
@ -63,9 +63,9 @@ namespace Passer {
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Disable
 | 
			
		||||
#region Disable
 | 
			
		||||
        public void OnDisable() {
 | 
			
		||||
            if (humanoid == null) {
 | 
			
		||||
                // This target is not connected to a humanoid, so we delete it
 | 
			
		||||
@ -82,9 +82,9 @@ namespace Passer {
 | 
			
		||||
            foreach (TargetProps props in allProps)
 | 
			
		||||
                props.SetSensor2Target();
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Inspector
 | 
			
		||||
#region Inspector
 | 
			
		||||
        public override void OnInspectorGUI() {
 | 
			
		||||
            if (footTarget == null || humanoid == null)
 | 
			
		||||
                return;
 | 
			
		||||
@ -142,7 +142,7 @@ namespace Passer {
 | 
			
		||||
            return foundHumanoid;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region Sensors
 | 
			
		||||
#region Sensors
 | 
			
		||||
        private static bool showControllers = true;
 | 
			
		||||
        private void ControllerInspectors(FootTarget footTarget) {
 | 
			
		||||
            showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
 | 
			
		||||
@ -157,9 +157,9 @@ namespace Passer {
 | 
			
		||||
                EditorGUI.indentLevel--;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Configuration
 | 
			
		||||
#region Configuration
 | 
			
		||||
        private void InitConfiguration(FootTarget footTarget) {
 | 
			
		||||
            if (footTarget.humanoid.avatarRig == null)
 | 
			
		||||
                return;
 | 
			
		||||
@ -200,7 +200,7 @@ namespace Passer {
 | 
			
		||||
            UpdateToesBones(target.toes);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region UpperLeg
 | 
			
		||||
#region UpperLeg
 | 
			
		||||
        //private string upperLegXname;
 | 
			
		||||
        //private SerializedProperty upperLegMinX;
 | 
			
		||||
        //private SerializedProperty upperLegMaxX;
 | 
			
		||||
@ -276,9 +276,9 @@ namespace Passer {
 | 
			
		||||
            //upperLeg.bone.maxAngles.z = upperLegMaxZ.floatValue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region LowerLeg
 | 
			
		||||
#region LowerLeg
 | 
			
		||||
        //private string lowerLegYname;
 | 
			
		||||
        //private SerializedProperty lowerLegMinX;
 | 
			
		||||
        //private SerializedProperty lowerLegMaxX;
 | 
			
		||||
@ -326,9 +326,9 @@ namespace Passer {
 | 
			
		||||
            //lowerLeg.bone.minAngles.x = lowerLegMinX.floatValue;
 | 
			
		||||
            //lowerLeg.bone.maxAngles.x = lowerLegMaxX.floatValue;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Foot
 | 
			
		||||
#region Foot
 | 
			
		||||
        //private string footXname;
 | 
			
		||||
        //private SerializedProperty footMinX;
 | 
			
		||||
        //private SerializedProperty footMaxX;
 | 
			
		||||
@ -390,9 +390,9 @@ namespace Passer {
 | 
			
		||||
            //foot.bone.minAngles.z = footMinZ.floatValue;
 | 
			
		||||
            //foot.bone.maxAngles.z = footMaxZ.floatValue;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Toes
 | 
			
		||||
#region Toes
 | 
			
		||||
        //private string toesXname;
 | 
			
		||||
        //private SerializedProperty toesMinX;
 | 
			
		||||
        //private SerializedProperty toesMaxX;
 | 
			
		||||
@ -441,10 +441,10 @@ namespace Passer {
 | 
			
		||||
            //toes.bone.maxAngles.x = toesMaxX.floatValue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Settings
 | 
			
		||||
#region Settings
 | 
			
		||||
        private SerializedProperty rotationSpeedLimitationProp;
 | 
			
		||||
        private SerializedProperty slidePreventionProp;
 | 
			
		||||
 | 
			
		||||
@ -470,9 +470,9 @@ namespace Passer {
 | 
			
		||||
                EditorGUI.indentLevel--;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Events
 | 
			
		||||
#region Events
 | 
			
		||||
 | 
			
		||||
        protected SerializedProperty groundEventProp;
 | 
			
		||||
 | 
			
		||||
@ -534,11 +534,11 @@ namespace Passer {
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        #region Scene
 | 
			
		||||
#region Scene
 | 
			
		||||
 | 
			
		||||
        public void OnSceneGUI() {
 | 
			
		||||
            if (footTarget == null || humanoid == null)
 | 
			
		||||
@ -551,13 +551,12 @@ namespace Passer {
 | 
			
		||||
                    humanoid.pose.UpdatePose(humanoid);
 | 
			
		||||
                else {
 | 
			
		||||
                    humanoid.pose.Show(humanoid);
 | 
			
		||||
                    humanoid.CopyRigToTargets();
 | 
			
		||||
                    humanoid.MatchTargetsToAvatar();
 | 
			
		||||
                    footTarget.CopyRigToTarget();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // update the target rig from the current foot target
 | 
			
		||||
            humanoid.CopyTargetsToRig();
 | 
			
		||||
            footTarget.CopyTargetToRig();
 | 
			
		||||
            // update the avatar bones from the target rig
 | 
			
		||||
            humanoid.UpdateMovements();
 | 
			
		||||
            // match the target rig with the new avatar pose
 | 
			
		||||
@ -569,11 +568,11 @@ namespace Passer {
 | 
			
		||||
            humanoid.UpdateSensorsFromTargets();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
        public abstract class TargetProps {
 | 
			
		||||
            public SerializedProperty enabledProp;
 | 
			
		||||
            public SerializedProperty sensorComponentProp;
 | 
			
		||||
            public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetPositionProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetRotationProp;
 | 
			
		||||
 | 
			
		||||
@ -582,7 +581,7 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
            public TargetProps(SerializedObject serializedObject, LegSensor _sensor, FootTarget _footTarget, string unitySensorName) {
 | 
			
		||||
                enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
 | 
			
		||||
                sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
 | 
			
		||||
                sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
 | 
			
		||||
                sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
 | 
			
		||||
                sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
 | 
			
		||||
 | 
			
		||||
@ -593,11 +592,11 @@ namespace Passer {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public virtual void SetSensor2Target() {
 | 
			
		||||
                if (sensor.sensorComponent == null)
 | 
			
		||||
                if (sensor.sensorTransform == null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * footTarget.foot.target.transform.rotation;
 | 
			
		||||
                sensor2TargetPositionProp.vector3Value = -footTarget.foot.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
 | 
			
		||||
                sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * footTarget.foot.target.transform.rotation;
 | 
			
		||||
                sensor2TargetPositionProp.vector3Value = -footTarget.foot.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public abstract void Inspector();
 | 
			
		||||
@ -44,8 +44,17 @@ namespace Passer.Humanoid {
 | 
			
		||||
#if pUNITYXR
 | 
			
		||||
                new UnityXR_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
//#if hOPENVR && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
 | 
			
		||||
//                new OpenVR_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
//#if hVIVETRACKER
 | 
			
		||||
//                new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
//#endif
 | 
			
		||||
//#endif
 | 
			
		||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
 | 
			
		||||
                //new SteamVR_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#if hVIVETRACKER
 | 
			
		||||
                new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
                //new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
 | 
			
		||||
//                new Oculus_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
@ -56,6 +65,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
#if hWAVEVR
 | 
			
		||||
                new WaveVR_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hVRTK
 | 
			
		||||
                new Vrtk_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hLEAP
 | 
			
		||||
                new LeapMotion_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
@ -74,9 +86,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
#if hORBBEC
 | 
			
		||||
                new Astra_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
//#if hNEURON
 | 
			
		||||
//                new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
//#endif
 | 
			
		||||
#if hNEURON
 | 
			
		||||
                new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hOPTITRACK
 | 
			
		||||
                new Optitrack_Editor.HandTargetProps(serializedObject, handTarget),
 | 
			
		||||
#endif
 | 
			
		||||
@ -145,6 +157,8 @@ namespace Passer.Humanoid {
 | 
			
		||||
            InteractionPointerButton(handTarget);
 | 
			
		||||
 | 
			
		||||
            serializedObject.ApplyModifiedProperties();
 | 
			
		||||
            //serializedObject.Update();
 | 
			
		||||
            //serializedObject.ApplyModifiedProperties();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static HandTarget Inspector(HandTarget handTarget, string name) {
 | 
			
		||||
@ -437,8 +451,8 @@ namespace Passer.Humanoid {
 | 
			
		||||
            if (showSettings) {
 | 
			
		||||
                EditorGUI.indentLevel++;
 | 
			
		||||
 | 
			
		||||
                SerializedProperty showObjectsProp = serializedObject.FindProperty("_showRealObjects");
 | 
			
		||||
                bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", showObjectsProp.boolValue);
 | 
			
		||||
                // Cannot use serializedPropery because showRealObjects is a getter/setter
 | 
			
		||||
                bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", handTarget.showRealObjects);
 | 
			
		||||
                if (showRealObjects != handTarget.showRealObjects) {
 | 
			
		||||
                    handTarget.showRealObjects = showRealObjects;
 | 
			
		||||
                    handTarget.ShowSensors(showRealObjects, true);
 | 
			
		||||
@ -695,13 +709,12 @@ namespace Passer.Humanoid {
 | 
			
		||||
                    humanoid.pose.UpdatePose(humanoid);
 | 
			
		||||
                else {
 | 
			
		||||
                    humanoid.pose.Show(humanoid);
 | 
			
		||||
                    humanoid.CopyRigToTargets();
 | 
			
		||||
                    humanoid.MatchTargetsToAvatar();
 | 
			
		||||
                    handTarget.CopyRigToTarget();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // update the target rig from the current hand target
 | 
			
		||||
            humanoid.CopyTargetsToRig();
 | 
			
		||||
            handTarget.CopyTargetToRig();
 | 
			
		||||
            // update the avatar bones from the target rig
 | 
			
		||||
            humanoid.UpdateMovements();
 | 
			
		||||
            // match the target rig with the new avatar pose
 | 
			
		||||
@ -717,8 +730,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
        public abstract class TargetProps {
 | 
			
		||||
            public SerializedProperty enabledProp;
 | 
			
		||||
            //public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensorComponentProp;
 | 
			
		||||
            public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetPositionProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetRotationProp;
 | 
			
		||||
 | 
			
		||||
@ -727,8 +739,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
            public TargetProps(SerializedObject serializedObject, Humanoid.ArmSensor _sensor, HandTarget _handTarget, string unitySensorName) {
 | 
			
		||||
                enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
 | 
			
		||||
                //sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
 | 
			
		||||
                sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
 | 
			
		||||
                sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
 | 
			
		||||
                sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
 | 
			
		||||
                sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
 | 
			
		||||
 | 
			
		||||
@ -34,8 +34,10 @@ namespace Passer.Humanoid {
 | 
			
		||||
#if pUNITYXR
 | 
			
		||||
                new UnityXR_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
 | 
			
		||||
#if hVIVETRACKER
 | 
			
		||||
                new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
                //new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#if hWINDOWSMR && UNITY_WSA_10_0
 | 
			
		||||
                new WindowsMR_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
@ -43,6 +45,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
#if hWAVEVR
 | 
			
		||||
                new WaveVR_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hVRTK
 | 
			
		||||
                new Vrtk_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hREALSENSE
 | 
			
		||||
                new Realsense_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
@ -61,9 +66,9 @@ namespace Passer.Humanoid {
 | 
			
		||||
#if hOPTITRACK
 | 
			
		||||
                new Optitrack_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
//#if hNEURON
 | 
			
		||||
//                new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
//#endif
 | 
			
		||||
#if hNEURON
 | 
			
		||||
                new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hTOBII
 | 
			
		||||
                new Tobii_Editor.HeadTargetProps(serializedObject, headTarget),
 | 
			
		||||
#endif
 | 
			
		||||
@ -172,7 +177,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
 | 
			
		||||
            if (showControllers) {
 | 
			
		||||
                EditorGUI.indentLevel++;
 | 
			
		||||
                //FirstPersonCameraInspector(headTarget);
 | 
			
		||||
                FirstPersonCameraInspector(headTarget);
 | 
			
		||||
                ScreenInspector(headTarget);
 | 
			
		||||
 | 
			
		||||
                foreach (TargetProps props in allProps)
 | 
			
		||||
@ -275,7 +280,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
            if (headTarget.humanoid == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator) + "." + nameof(HeadTarget.headAnimator.enabled));
 | 
			
		||||
            SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator)+ "." +nameof(HeadTarget.headAnimator.enabled));
 | 
			
		||||
            if (animatorProp != null && headTarget.humanoid.animatorEnabled) {
 | 
			
		||||
 | 
			
		||||
                GUIContent text = new GUIContent(
 | 
			
		||||
@ -482,13 +487,12 @@ namespace Passer.Humanoid {
 | 
			
		||||
                    humanoid.pose.UpdatePose(humanoid);
 | 
			
		||||
                else {
 | 
			
		||||
                    humanoid.pose.Show(humanoid);
 | 
			
		||||
                    humanoid.CopyRigToTargets();
 | 
			
		||||
                    humanoid.MatchTargetsToAvatar();
 | 
			
		||||
                    headTarget.CopyRigToTarget();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // update the target rig from the current head target
 | 
			
		||||
            humanoid.CopyTargetsToRig();
 | 
			
		||||
            headTarget.CopyTargetToRig();
 | 
			
		||||
            // update the avatar bones from the target rig
 | 
			
		||||
            humanoid.UpdateMovements();
 | 
			
		||||
            // match the target rig with the new avatar pose
 | 
			
		||||
@ -505,8 +509,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
        public abstract class TargetProps {
 | 
			
		||||
            public SerializedProperty enabledProp;
 | 
			
		||||
            //public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensorComponentProp;
 | 
			
		||||
            public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetPositionProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetRotationProp;
 | 
			
		||||
 | 
			
		||||
@ -515,7 +518,7 @@ namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
            public TargetProps(SerializedObject serializedObject, HeadSensor _sensor, HeadTarget _headTarget, string unitySensorName) {
 | 
			
		||||
                enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
 | 
			
		||||
                sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
 | 
			
		||||
                sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
 | 
			
		||||
                sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
 | 
			
		||||
                sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
 | 
			
		||||
 | 
			
		||||
@ -526,11 +529,11 @@ namespace Passer.Humanoid {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public virtual void SetSensor2Target() {
 | 
			
		||||
                if (sensor.sensorComponent == null)
 | 
			
		||||
                if (sensor.sensorTransform == null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * headTarget.head.target.transform.rotation;
 | 
			
		||||
                sensor2TargetPositionProp.vector3Value = -headTarget.head.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
 | 
			
		||||
                sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * headTarget.head.target.transform.rotation;
 | 
			
		||||
                sensor2TargetPositionProp.vector3Value = -headTarget.head.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public abstract void Inspector();
 | 
			
		||||
@ -32,7 +32,7 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
        private void InitEditors() {
 | 
			
		||||
            allProps = new TargetProps[] {
 | 
			
		||||
#if hVIVETRACKER
 | 
			
		||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
 | 
			
		||||
                new ViveTracker_Editor.HipsTargetProps(serializedObject, hipsTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hKINECT1
 | 
			
		||||
@ -47,9 +47,9 @@ namespace Passer {
 | 
			
		||||
#if hORBBEC
 | 
			
		||||
                new Astra_Editor.HipsTargetProps(serializedObject, hipsTarget),
 | 
			
		||||
#endif
 | 
			
		||||
//#if hNEURON
 | 
			
		||||
//                new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
 | 
			
		||||
//#endif
 | 
			
		||||
#if hNEURON
 | 
			
		||||
                new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
 | 
			
		||||
#endif
 | 
			
		||||
#if hOPTITRACK
 | 
			
		||||
                new Optitrack_Editor.HipsTargetProps(serializedObject, hipsTarget),
 | 
			
		||||
#endif
 | 
			
		||||
@ -276,13 +276,12 @@ namespace Passer {
 | 
			
		||||
                    humanoid.pose.UpdatePose(humanoid);
 | 
			
		||||
                else {
 | 
			
		||||
                    humanoid.pose.Show(humanoid);
 | 
			
		||||
                    humanoid.CopyRigToTargets();
 | 
			
		||||
                    humanoid.MatchTargetsToAvatar();
 | 
			
		||||
                    hipsTarget.CopyRigToTarget();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // update the target rig from the current hips target
 | 
			
		||||
            humanoid.CopyTargetsToRig();
 | 
			
		||||
            hipsTarget.CopyTargetToRig();
 | 
			
		||||
            // update the avatar bones to match the target rig
 | 
			
		||||
            humanoid.UpdateMovements();
 | 
			
		||||
            // match the target rig with the new avatar pose
 | 
			
		||||
@ -298,8 +297,7 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
        public abstract class TargetProps {
 | 
			
		||||
            public SerializedProperty enabledProp;
 | 
			
		||||
            //public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensorComponentProp;
 | 
			
		||||
            public SerializedProperty sensorTransformProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetPositionProp;
 | 
			
		||||
            public SerializedProperty sensor2TargetRotationProp;
 | 
			
		||||
 | 
			
		||||
@ -308,8 +306,7 @@ namespace Passer {
 | 
			
		||||
 | 
			
		||||
            public TargetProps(SerializedObject serializedObject, TorsoSensor _sensor, HipsTarget _hipsTarget, string unitySensorName) {
 | 
			
		||||
                enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
 | 
			
		||||
                //sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
 | 
			
		||||
                sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
 | 
			
		||||
                sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
 | 
			
		||||
                sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
 | 
			
		||||
                sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
 | 
			
		||||
 | 
			
		||||
@ -320,11 +317,11 @@ namespace Passer {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public virtual void SetSensor2Target() {
 | 
			
		||||
                if (sensor.sensorComponent == null)
 | 
			
		||||
                if (sensor.sensorTransform == null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * hipsTarget.hips.target.transform.rotation;
 | 
			
		||||
                sensor2TargetPositionProp.vector3Value = -hipsTarget.hips.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
 | 
			
		||||
                sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * hipsTarget.hips.target.transform.rotation;
 | 
			
		||||
                sensor2TargetPositionProp.vector3Value = -hipsTarget.hips.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public abstract void Inspector();
 | 
			
		||||
@ -7,8 +7,7 @@
 | 
			
		||||
        "PhotonVoice",
 | 
			
		||||
        "PhotonVoice.PUN",
 | 
			
		||||
        "PhotonRealtime",
 | 
			
		||||
        "PhotonVoice.API",
 | 
			
		||||
        "SteamVR"
 | 
			
		||||
        "PhotonVoice.API"
 | 
			
		||||
    ],
 | 
			
		||||
    "includePlatforms": [
 | 
			
		||||
        "Editor"
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,6 @@ namespace Passer {
 | 
			
		||||
    /// by selecting the appropriate sites in the dialog:
 | 
			
		||||
    /// 
 | 
			
		||||
    /// \image html BuildSitesDialog.png
 | 
			
		||||
    /// \image rtf BuildSitesDialog.png
 | 
			
		||||
    /// 
 | 
			
		||||
    /// When the Build button is pressed, all sites will be build and become available in the Assets/SiteBuilds folder
 | 
			
		||||
    /// with a submap for each platform (like Windows, Android...)
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,6 @@ using UnityEngine;
 | 
			
		||||
namespace Passer {
 | 
			
		||||
    using Humanoid;
 | 
			
		||||
 | 
			
		||||
    [CanEditMultipleObjects]
 | 
			
		||||
    [CustomEditor(typeof(Handle), true)]
 | 
			
		||||
    public class Handle_Editor : Editor {
 | 
			
		||||
 | 
			
		||||
@ -43,14 +42,9 @@ namespace Passer {
 | 
			
		||||
            //if (HumanoidPreferences.help)
 | 
			
		||||
            //    EditorGUILayout.HelpBox("Component to specify behaviour when grabbing the GameObject", MessageType.None);
 | 
			
		||||
 | 
			
		||||
            SerializedProperty handProp = serializedObject.FindProperty(nameof(Handle.hand));
 | 
			
		||||
            handProp.intValue = (int)(Handle.Hand)EditorGUILayout.EnumPopup("Hand", (Handle.Hand)handProp.intValue);
 | 
			
		||||
 | 
			
		||||
            SerializedProperty grabTypeProp = serializedObject.FindProperty(nameof(Handle.grabType));
 | 
			
		||||
            grabTypeProp.intValue = (int)(Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", (Handle.GrabType)grabTypeProp.intValue);
 | 
			
		||||
 | 
			
		||||
            SerializedProperty rangeProp = serializedObject.FindProperty(nameof(Handle.range));
 | 
			
		||||
            rangeProp.floatValue = EditorGUILayout.FloatField("Range", rangeProp.floatValue);
 | 
			
		||||
            handle.hand = (Handle.Hand)EditorGUILayout.EnumPopup("Hand", handle.hand);
 | 
			
		||||
            handle.grabType = (Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", handle.grabType);
 | 
			
		||||
            handle.range = EditorGUILayout.FloatField("Range", handle.range);
 | 
			
		||||
 | 
			
		||||
            HandPoseInspector(handle);
 | 
			
		||||
            CheckHandTarget(handle);
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@ using UnityEngine;
 | 
			
		||||
namespace Passer {
 | 
			
		||||
    using Humanoid;
 | 
			
		||||
 | 
			
		||||
    [CustomEditor(typeof(ControllerInput), true)]
 | 
			
		||||
    [CustomEditor(typeof(ControllerInput))]
 | 
			
		||||
    public class ControllerInput_Editor : Editor {
 | 
			
		||||
        protected ControllerInput controllerInput;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -76,20 +76,17 @@ namespace Passer.Humanoid {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void AttachPrefab(Socket socket, SerializedProperty attachedTransformProp, GameObject prefab) {
 | 
			
		||||
            SerializedProperty attachedHandleProp = serializedObject.FindProperty("attachedHandle");
 | 
			
		||||
 | 
			
		||||
            if (attachedTransformProp.objectReferenceValue != null)
 | 
			
		||||
                ReleaseObject(socket, attachedTransformProp);
 | 
			
		||||
 | 
			
		||||
            GameObject obj = Instantiate(prefab, socket.transform.position, socket.transform.rotation);
 | 
			
		||||
            obj.name = prefab.name; // Remove the (Clone)
 | 
			
		||||
 | 
			
		||||
            socket.Attach(obj.transform, false);
 | 
			
		||||
            socket.Attach(obj.transform);
 | 
			
		||||
            if (socket.attachedTransform == null)
 | 
			
		||||
                Debug.LogWarning("Could not attach transform");
 | 
			
		||||
            else {
 | 
			
		||||
                attachedTransformProp.objectReferenceValue = obj;
 | 
			
		||||
                attachedHandleProp.objectReferenceValue = socket.attachedHandle;
 | 
			
		||||
                //Handle handle = socket.attachedHandle;
 | 
			
		||||
                //if (handle == null)
 | 
			
		||||
                //    Handle.Create(obj, socket);                
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@ -1,7 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 53c8571aa9e542643b485a80320a9a70
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,7 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: ef89ebf080626664e9353fa0565b680e
 | 
			
		||||
DefaultImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@ -1,24 +1,22 @@
 | 
			
		||||
Installation
 | 
			
		||||
============
 | 
			
		||||
You can import the Humanoid Control Free package in Unity directly with the Package Manager git package importer.
 | 
			
		||||
Import this package in Unity directly with the Package Manager git package importer.
 | 
			
		||||
 | 
			
		||||
See [Unity: Installing from a Git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
 | 
			
		||||
 | 
			
		||||
Use the link from 'Clone with HTTP' (for example: https://git.passer.life/HumanoidControl/HumanoidControl_Free.git)
 | 
			
		||||
Use the link from 'Clone with HTTP' (for example: https://http://gitlab.passervr.com/passer/unity/humanoidcontrol4_free.git)
 | 
			
		||||
In this way you can always retrieve the latest version by pressing the `Update` button in the Package Manager.
 | 
			
		||||
 | 
			
		||||
Optionally, you can use a tag to retrieve a specific version. For example:https://git.passer.life/HumanoidControl/HumanoidControl_Free.git#4.1.0.
 | 
			
		||||
Optionally, you can use a tag to retrieve a specific version. For example:http://gitlab.passervr.com/passer/unity/humanoidcontrol4_free.git#4.1.0.
 | 
			
		||||
This will give you a stable version which does not change. Updating can be done by retrieving the package with a link to a new release.
 | 
			
		||||
 | 
			
		||||
ChangeLog and Releases
 | 
			
		||||
======================
 | 
			
		||||
All releases with UnityPackages and links for the Unity Package Manager: [Tags page](https://git.passer.life/HumanoidControl/HumanoidControl_Free/tags).
 | 
			
		||||
 | 
			
		||||
An RSS/Atom feed with all releases can be found on the [Tags page](https://git.passer.life/HumanoidControl/HumanoidControl_Free/tags). Click on the _RSS Feed_ icon in the top-right corner to retrieve the feed.
 | 
			
		||||
You will find all releases with UnityPackages and links for the Unity Package Manager in the [Releases](https://gitlab.passervr.com/passer/unity/humanoidcontrol4_free/-/releases)
 | 
			
		||||
 | 
			
		||||
Documentation
 | 
			
		||||
=============
 | 
			
		||||
For the latest version of the documentation, see [PasserVR HumanoidControl Documentation](https://docs.humanoidcontrol.com/)
 | 
			
		||||
See [PasserVR HumanoidControl Documentation](https://passervr.com/apis/HumanoidControl/Unity/index.html)
 | 
			
		||||
 | 
			
		||||
Video
 | 
			
		||||
=====
 | 
			
		||||
 | 
			
		||||
@ -1,7 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 9bd4d529ee013784db3923a2bdbc5bef
 | 
			
		||||
TextScriptImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,19 +0,0 @@
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
    /// \page AnimatorDoc Animator
 | 
			
		||||
    /// 
 | 
			
		||||
    /// Animations can be used when other trackers are not tracking or not available. They 
 | 
			
		||||
    /// can be enabled using the Animator option in the Input section of the Humanoid 
 | 
			
		||||
    /// Control script.
 | 
			
		||||
    ///
 | 
			
		||||
    /// By default, the animator uses a builtin procedural animation. This is overridden 
 | 
			
		||||
    /// when setting the Runtime Animator Controller parameter which is standard
 | 
			
		||||
    /// [Unity Animator Controller](https://docs.unity3d.com/Manual/class-AnimatorController.html).
 | 
			
		||||
    ///
 | 
			
		||||
    /// Targets
 | 
			
		||||
    /// =======
 | 
			
		||||
    /// When the Animation option is enabled on the Humanoid Control script, 
 | 
			
		||||
    /// it is possible to select whether procedural animation should be used for each target. 
 | 
			
		||||
    /// If Procedural Animation is deselected the animation controlled by the Runtime Animator Controller
 | 
			
		||||
    /// set in the Humanoid Control script will be used.
 | 
			
		||||
    /// If the Runtime Animator Controller is not set, no animation will be used.
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 900575d4e62003c41b95e2470e3eb96d
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,134 +0,0 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Tracking {
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// The representation of a tracked body
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// The bone hierarchy will be created below this transform at runtime. 
 | 
			
		||||
    public abstract class BodySkeleton : TrackerComponent {
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Determines whether the skeleton should be rendered
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool show = false;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The list of tracked bones
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected List<TrackedBone> bones;
 | 
			
		||||
        //protected static Material boneWhite;
 | 
			
		||||
 | 
			
		||||
        #region Start
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// This function is used to intialize the tracked bones.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected abstract void InitializeSkeleton();
 | 
			
		||||
 | 
			
		||||
        //        protected TrackedBone AddBone(string name, Transform parent) {
 | 
			
		||||
        //            GameObject boneGO = new GameObject(name);
 | 
			
		||||
        //            boneGO.transform.SetParent(parent, false);
 | 
			
		||||
 | 
			
		||||
        //            AddBoneRenderer(boneGO);
 | 
			
		||||
 | 
			
		||||
        //            TrackedBone bone = new TrackedBone() {
 | 
			
		||||
        //                transform = boneGO.transform
 | 
			
		||||
        //            };
 | 
			
		||||
        //            return bone;
 | 
			
		||||
        //        }
 | 
			
		||||
 | 
			
		||||
        //        protected void AddBoneRenderer(GameObject boneGO) {
 | 
			
		||||
        //            LineRenderer boneRenderer = boneGO.AddComponent<LineRenderer>();
 | 
			
		||||
        //            boneRenderer.startWidth = 0.01F;
 | 
			
		||||
        //            boneRenderer.endWidth = 0.01F;
 | 
			
		||||
        //            boneRenderer.useWorldSpace = false;
 | 
			
		||||
        //            boneRenderer.SetPosition(0, Vector3.zero);
 | 
			
		||||
        //            boneRenderer.SetPosition(1, Vector3.zero);
 | 
			
		||||
        //            boneRenderer.generateLightingData = true;
 | 
			
		||||
        //            boneRenderer.material = boneWhite;
 | 
			
		||||
        //        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Update
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the rendering of the bones
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected void UpdateSkeletonRender() {
 | 
			
		||||
            if (bones == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            // Render Skeleton
 | 
			
		||||
            foreach (TrackedBone bone in bones) {
 | 
			
		||||
                if (bone == null)
 | 
			
		||||
                    continue;
 | 
			
		||||
                LineRenderer boneRenderer = bone.transform.GetComponent<LineRenderer>();
 | 
			
		||||
                if (boneRenderer != null) {
 | 
			
		||||
                    Vector3 localParentPosition = bone.transform.InverseTransformPoint(bone.transform.parent.position);
 | 
			
		||||
                    boneRenderer.SetPosition(1, localParentPosition);
 | 
			
		||||
                    boneRenderer.enabled = show;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected bool rendered;
 | 
			
		||||
        protected void EnableRenderer() {
 | 
			
		||||
            if (rendered || !show)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            Renderer[] renderers = this.GetComponentsInChildren<Renderer>();
 | 
			
		||||
            foreach (Renderer renderer in renderers) {
 | 
			
		||||
                if (!(renderer is LineRenderer))
 | 
			
		||||
                    renderer.enabled = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            rendered = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected void DisableRenderer() {
 | 
			
		||||
            if (!rendered)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            Renderer[] renderers = this.GetComponentsInChildren<Renderer>();
 | 
			
		||||
            foreach (Renderer renderer in renderers) {
 | 
			
		||||
                if (!(renderer is LineRenderer))
 | 
			
		||||
                    renderer.enabled = false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            rendered = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Update
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the transform of the tracked bone
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="boneId">The requested bone</param>
 | 
			
		||||
        /// <returns>The tracked bone transform or *null* if it does not exist</returns>
 | 
			
		||||
        public Transform GetBoneTransform(Humanoid.Tracking.Bone boneId) {
 | 
			
		||||
            TrackedBone trackedBone = GetBone(boneId);
 | 
			
		||||
            if (trackedBone == null)
 | 
			
		||||
                return null;
 | 
			
		||||
            return trackedBone.transform;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the tracked bone
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="boneId">The requested bone</param>
 | 
			
		||||
        /// <returns>The tracked bone or *null* if it does not exist</returns>
 | 
			
		||||
        public TrackedBone GetBone(Humanoid.Tracking.Bone boneId) {
 | 
			
		||||
            if (bones == null)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            if (boneId == Humanoid.Tracking.Bone.Count)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            return bones[(int)boneId];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,209 +0,0 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
    using Passer.Tracking;
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// A custom sensor used on the arm of a humanoid
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// This tracking option supports a custom developed ControllerComponent or HandSkeleton for the hand and/or arm.
 | 
			
		||||
    [System.Serializable]
 | 
			
		||||
    public class CustomArm : Passer.Humanoid.ArmSensor {
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The name of this sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override string name => "Custom Sensor";
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// THe tracker for this sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
#if hCUSTOM
 | 
			
		||||
        public override HumanoidTracker tracker => humanoid.custom;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The tracker controller to use for this arm
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected ControllerComponent controllerComponent;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The bone on the arm controlled by the sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public ArmBones attachedBone = ArmBones.Hand;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The controller input for this humanoid
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected Controller controllerInput;
 | 
			
		||||
 | 
			
		||||
        #region Manage
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the arm targets based on the current sensor position and rotation
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void SetSensor2Target() {
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
 | 
			
		||||
            if (targetBone == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensor2TargetRotation = Quaternion.Inverse(sensorComponent.transform.rotation) * targetBone.target.transform.rotation;
 | 
			
		||||
            sensor2TargetPosition = -targetBone.target.transform.InverseTransformPoint(sensorComponent.transform.position);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the sensor position and rotation based on the current position of the arm targets.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_">Not used</param>
 | 
			
		||||
        public override void UpdateSensorTransformFromTarget(Transform _) {
 | 
			
		||||
            if (handTarget == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
 | 
			
		||||
            base.UpdateSensorTransformFromTarget(targetBone.target.transform);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Manage
 | 
			
		||||
 | 
			
		||||
        #region Start
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Prepares the arm for tracking with the tracked controller and/or skeleton
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_humanoid">The humanoid for which this arm is tracked</param>
 | 
			
		||||
        /// <param name="targetTransform">The transform of the hand target</param>
 | 
			
		||||
        /// This will find and initialize the controllerInput for the given humanoid.
 | 
			
		||||
        /// It will initialize the sensor2TargetPosition and sensor2TargetRotation values.
 | 
			
		||||
        /// It will determine whether the sensor should be shown and rendered.
 | 
			
		||||
        /// It will start the tracking for the controller and/or hand skeleton.
 | 
			
		||||
        public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
 | 
			
		||||
            base.Start(_humanoid, targetTransform);
 | 
			
		||||
 | 
			
		||||
            if (tracker == null || !tracker.enabled || !enabled)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            controllerComponent = sensorComponent as ControllerComponent;
 | 
			
		||||
            controllerInput = Controllers.GetController(0);
 | 
			
		||||
 | 
			
		||||
            handSkeleton = sensorComponent as HandSkeleton;
 | 
			
		||||
 | 
			
		||||
            SetSensor2Target();
 | 
			
		||||
            ShowSensor(handTarget.humanoid.showRealObjects && target.showRealObjects);
 | 
			
		||||
 | 
			
		||||
            if (controllerComponent != null) {
 | 
			
		||||
                if (tracker.trackerComponent != null)
 | 
			
		||||
                    controllerComponent.StartComponent(tracker.trackerComponent.transform, handTarget.isLeft);
 | 
			
		||||
                else
 | 
			
		||||
                    controllerComponent.StartComponent(controllerComponent.transform.parent, handTarget.isLeft);
 | 
			
		||||
            }
 | 
			
		||||
            if (handSkeleton != null) {
 | 
			
		||||
                if (tracker.trackerComponent != null)
 | 
			
		||||
                    handSkeleton.StartComponent(tracker.trackerComponent.transform);
 | 
			
		||||
                else
 | 
			
		||||
                    handSkeleton.StartComponent(handSkeleton.transform.parent);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Start
 | 
			
		||||
 | 
			
		||||
        #region Update
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the arm target based on the status of the tracked controller and/or skeleton
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void Update() {
 | 
			
		||||
            status = Tracker.Status.Unavailable;
 | 
			
		||||
            if (tracker == null || !tracker.enabled || !enabled)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensorComponent.UpdateComponent();
 | 
			
		||||
            status = sensorComponent.status;
 | 
			
		||||
            if (status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
 | 
			
		||||
 | 
			
		||||
            UpdateTarget(targetBone.target, sensorComponent);
 | 
			
		||||
 | 
			
		||||
            UpdateControllerInput();
 | 
			
		||||
 | 
			
		||||
            UpdateHandFromSkeleton();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region Controller
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the Controller Input for this side
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        protected void UpdateControllerInput() {
 | 
			
		||||
            if (handTarget.isLeft)
 | 
			
		||||
                UpdateControllerInput(controllerInput.left);
 | 
			
		||||
            else
 | 
			
		||||
                UpdateControllerInput(controllerInput.right);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates one side of the ControllerInput from the values of the tracked ControllerComponent
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="controllerSide">The controller side to update</param>
 | 
			
		||||
        /// This function does nothing when the controller is not available or not tracking.
 | 
			
		||||
        protected virtual void UpdateControllerInput(ControllerSide controllerSide) {
 | 
			
		||||
            if (controllerSide == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if (controllerComponent == null || controllerComponent.status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            controllerSide.stickHorizontal += controllerComponent.primaryAxis.x;
 | 
			
		||||
            controllerSide.stickVertical += controllerComponent.primaryAxis.y;
 | 
			
		||||
            controllerSide.stickButton |= (controllerComponent.primaryAxis.z > 0.5F);
 | 
			
		||||
            controllerSide.stickTouch = true;
 | 
			
		||||
 | 
			
		||||
            controllerSide.buttons[0] |= controllerComponent.button1 > 0.5F;
 | 
			
		||||
            controllerSide.buttons[1] |= controllerComponent.button2 > 0.5F;
 | 
			
		||||
            controllerSide.buttons[2] |= controllerComponent.button3 > 0.5F;
 | 
			
		||||
            controllerSide.buttons[3] |= controllerComponent.button4 > 0.5F;
 | 
			
		||||
 | 
			
		||||
            controllerSide.trigger1 += controllerComponent.trigger1;
 | 
			
		||||
            controllerSide.trigger2 += controllerComponent.trigger2;
 | 
			
		||||
 | 
			
		||||
            controllerSide.option |= controllerComponent.option > 0.5F;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Controller
 | 
			
		||||
 | 
			
		||||
        #region Skeleton
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// This function uses the tracked HandSkeleton to update the pose of the hand
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// This function does nothing when the hand skeleton is not available or not tracking.
 | 
			
		||||
        protected override void UpdateHandFromSkeleton() {
 | 
			
		||||
            if (handSkeleton == null || handSkeleton.status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            Transform wristBone = handSkeleton.GetWristBone();
 | 
			
		||||
            handTarget.hand.target.transform.position = wristBone.transform.position;
 | 
			
		||||
            if (handTarget.isLeft)
 | 
			
		||||
                handTarget.hand.target.transform.rotation = wristBone.transform.rotation * Quaternion.Euler(-90, 0, 90);
 | 
			
		||||
            else
 | 
			
		||||
                handTarget.hand.target.transform.rotation = wristBone.transform.rotation * Quaternion.Euler(-90, 0, -90);
 | 
			
		||||
 | 
			
		||||
            UpdateThumbFromSkeleton();
 | 
			
		||||
            UpdateIndexFingerFromSkeleton();
 | 
			
		||||
            UpdateMiddleFingerFromSkeleton();
 | 
			
		||||
            UpdateRingFingerFromSkeleton();
 | 
			
		||||
            UpdateLittleFingerFromSkeleton();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Skeleton
 | 
			
		||||
 | 
			
		||||
        #endregion Update
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: b1d7b6728893ceb4bb7e73e43cace60b
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,79 +0,0 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Passer.Tracking;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// A custom sensor used on the head of a humanoid.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// This tracking option supports a custom developed SensorComponent for the head.
 | 
			
		||||
    [System.Serializable]
 | 
			
		||||
    public class CustomHead : HeadSensor {
 | 
			
		||||
        public override string name => "Custom Sensor";
 | 
			
		||||
 | 
			
		||||
#if hCUSTOM
 | 
			
		||||
        public override HumanoidTracker tracker => humanoid.custom;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        //private static readonly Vector3 defaultLocalTrackerPosition = Vector3.zero;
 | 
			
		||||
        //private static readonly Quaternion defaultLocalTrackerRotation = Quaternion.identity;
 | 
			
		||||
 | 
			
		||||
        #region Manage
 | 
			
		||||
 | 
			
		||||
        #endregion Manage
 | 
			
		||||
 | 
			
		||||
        #region Start
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Prepares the head for tracking with the tracked sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_humanoid">The humanoid for which this head is tracked</param>
 | 
			
		||||
        /// <param name="targetTransform">The transform of the head target</param>
 | 
			
		||||
        /// It will initialize the sensor2TargetPosition and sensor2TargetRotation values.
 | 
			
		||||
        /// It will determine whether the sensor should be shown and rendered.
 | 
			
		||||
        /// It will start the tracking of the sensor.
 | 
			
		||||
        public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
 | 
			
		||||
            base.Start(_humanoid, targetTransform);
 | 
			
		||||
 | 
			
		||||
            if (tracker == null || !tracker.enabled || !enabled)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            SetSensor2Target();
 | 
			
		||||
            ShowSensor(headTarget.humanoid.showRealObjects && target.showRealObjects);
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent != null) {
 | 
			
		||||
                if (tracker.trackerComponent != null)
 | 
			
		||||
                    sensorComponent.StartComponent(tracker.trackerComponent.transform);
 | 
			
		||||
                else
 | 
			
		||||
                    sensorComponent.StartComponent(sensorComponent.transform.parent);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Start
 | 
			
		||||
 | 
			
		||||
        #region Update
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the head target based on the status of the tracke sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void Update() {
 | 
			
		||||
            status = Tracker.Status.Unavailable;
 | 
			
		||||
            if (tracker == null || !tracker.enabled || !enabled)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensorComponent.UpdateComponent();
 | 
			
		||||
            status = sensorComponent.status;
 | 
			
		||||
            if (status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            UpdateTarget(headTarget.head.target, sensorComponent);
 | 
			
		||||
 | 
			
		||||
            UpdateNeckTargetFromHead();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Update
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 33addd0b8cb0bbb41b80554896116e1e
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,105 +0,0 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
    using Passer.Tracking;
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// A custom sensor used on the leg of a humanoid.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// This tracking option supports a custom developed SensorComponent on the leg or foot.
 | 
			
		||||
    [System.Serializable]
 | 
			
		||||
    public class CustomLeg : LegSensor {
 | 
			
		||||
 | 
			
		||||
        public override string name => "Custom Sensor";
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The bone on the leg controlled by the sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public LegBones attachedBone = LegBones.Foot;
 | 
			
		||||
 | 
			
		||||
#if hCUSTOM
 | 
			
		||||
        public override HumanoidTracker tracker => humanoid.custom;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        #region Manage
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Updates the leg targets based on the current sensor position and rotation
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void SetSensor2Target() {
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = footTarget.GetTargetBone(attachedBone);
 | 
			
		||||
            if (targetBone == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensor2TargetRotation = Quaternion.Inverse(sensorComponent.transform.rotation) * targetBone.target.transform.rotation;
 | 
			
		||||
            sensor2TargetPosition = -targetBone.target.transform.InverseTransformPoint(sensorComponent.transform.position);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the sensor position and rotation based on the current position of the leg targets
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_">Not used</param>
 | 
			
		||||
        public override void UpdateSensorTransformFromTarget(Transform _) {
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = footTarget.GetTargetBone(attachedBone);
 | 
			
		||||
            base.UpdateSensorTransformFromTarget(targetBone.target.transform);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Manage
 | 
			
		||||
 | 
			
		||||
        #region Start
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Prepares the leg for tracking with the sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_humanoid">The humanoid for which this leg is tracked</param>
 | 
			
		||||
        /// <param name="targetTransform">The transform of the foot target</param>
 | 
			
		||||
        /// It will initialze the sensor2TargetPosition and sensor2TargetRotation values.
 | 
			
		||||
        /// It will determine whether the sensor should be shown and rendered.
 | 
			
		||||
        /// It will start the tracking of the sensor.
 | 
			
		||||
        public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
 | 
			
		||||
            base.Start(_humanoid, targetTransform);
 | 
			
		||||
 | 
			
		||||
            SetSensor2Target();
 | 
			
		||||
            ShowSensor(footTarget.humanoid.showRealObjects && target.showRealObjects);
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent != null) {
 | 
			
		||||
                if (tracker.trackerComponent != null)
 | 
			
		||||
                    sensorComponent.StartComponent(tracker.trackerComponent.transform);
 | 
			
		||||
                else
 | 
			
		||||
                    sensorComponent.StartComponent(sensorComponent.transform.parent);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Start
 | 
			
		||||
 | 
			
		||||
        #region Update
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the leg target based on the status of the tracked sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void Update() {
 | 
			
		||||
            status = Tracker.Status.Unavailable;
 | 
			
		||||
            if (tracker == null || !tracker.enabled || !enabled)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensorComponent.UpdateComponent();
 | 
			
		||||
            status = sensorComponent.status;
 | 
			
		||||
            if (status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = footTarget.GetTargetBone(attachedBone);
 | 
			
		||||
 | 
			
		||||
            UpdateTarget(targetBone.target, sensorComponent);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Update
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: cb5d7cb45eac0e6468fa4b91fc6a1480
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,105 +0,0 @@
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
    using Passer.Tracking;
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// A custom sensor used on the torso of a humanoid.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// This tracking option supports a custom developed SensorComponent for the torso.
 | 
			
		||||
    [System.Serializable]
 | 
			
		||||
    public class CustomTorso : TorsoSensor {
 | 
			
		||||
 | 
			
		||||
        public override string name => "Custom Sensor";
 | 
			
		||||
 | 
			
		||||
#if hCUSTOM
 | 
			
		||||
        public override HumanoidTracker tracker => humanoid.custom;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The bone on the torso controlled by the sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public TorsoBones attachedBone = TorsoBones.Hips;
 | 
			
		||||
 | 
			
		||||
        #region Manage
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the torso targets based on the current sensor position and rotation
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void SetSensor2Target() {
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = hipsTarget.GetTargetBone(attachedBone);
 | 
			
		||||
            if (targetBone == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensor2TargetRotation = Quaternion.Inverse(sensorComponent.transform.rotation) * targetBone.target.transform.rotation;
 | 
			
		||||
            sensor2TargetPosition = -targetBone.target.transform.InverseTransformPoint(sensorComponent.transform.position);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the sensor position and rotation based on the current position of the torso targets
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_">Not used</param>
 | 
			
		||||
        public override void UpdateSensorTransformFromTarget(Transform _) {
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = hipsTarget.GetTargetBone(attachedBone);
 | 
			
		||||
            base.UpdateSensorTransformFromTarget(targetBone.target.transform);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Manage
 | 
			
		||||
 | 
			
		||||
        #region Start
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Prepares the torso for tracking with the sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="_humanoid">The humanoid for which this torso is tracked</param>
 | 
			
		||||
        /// <param name="targetTransform">The transform of the hips target</param>
 | 
			
		||||
        /// It will initialze the sensor2TargetPosition and sensor2TargetRotation values.
 | 
			
		||||
        /// It will determine whether the sensor should be shown and rendered.
 | 
			
		||||
        /// It will start the tracking of the sensor.
 | 
			
		||||
        public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
 | 
			
		||||
            base.Start(_humanoid, targetTransform);
 | 
			
		||||
 | 
			
		||||
            SetSensor2Target();
 | 
			
		||||
            ShowSensor(hipsTarget.humanoid.showRealObjects && target.showRealObjects);
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent != null) {
 | 
			
		||||
                if (tracker.trackerComponent != null)
 | 
			
		||||
                    sensorComponent.StartComponent(tracker.trackerComponent.transform);
 | 
			
		||||
                else
 | 
			
		||||
                    sensorComponent.StartComponent(sensorComponent.transform.parent);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Start
 | 
			
		||||
 | 
			
		||||
        #region Update
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Updates the torso targets based on the status of the tracked sensor
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public override void Update() {
 | 
			
		||||
            status = Tracker.Status.Unavailable;
 | 
			
		||||
            if (tracker == null || !tracker.enabled || !enabled)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if (sensorComponent == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            sensorComponent.UpdateComponent();
 | 
			
		||||
            status = sensorComponent.status;
 | 
			
		||||
            if (status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            HumanoidTarget.TargetedBone targetBone = hipsTarget.GetTargetBone(attachedBone);
 | 
			
		||||
 | 
			
		||||
            UpdateTarget(targetBone.target, sensorComponent);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Update   
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: d0a97dd438bd4674fb64e76753a4bbc9
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
@ -1,203 +0,0 @@
 | 
			
		||||
using Passer.Tracking;
 | 
			
		||||
 | 
			
		||||
namespace Passer.Humanoid {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// A tracker wich can be used for custom tracking solutions
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// This tracking option supports custom trackers and sensors for a humanoid.
 | 
			
		||||
    /// We support two types of tracking
 | 
			
		||||
    /// - using a BodySkeleton
 | 
			
		||||
    /// - using SensorComponent
 | 
			
		||||
    /// 
 | 
			
		||||
    /// BodySkeleton
 | 
			
		||||
    /// ------------
 | 
			
		||||
    /// This option is most suited for full body tracking hardware.
 | 
			
		||||
    /// An example implementation is the PerceptionNeuron extension found in the %Humanoid Control Pro edition.
 | 
			
		||||
    /// 
 | 
			
		||||
    /// For this, you need to implement a class derived from the Passer::Tracking::BodySkeleton class.
 | 
			
		||||
    /// For the Perception Neuron extension, this new class is Passer::Tracking::PerceptionNeuron.
 | 
			
		||||
    /// This class should be used for the to the CustomTracker::bodySkeleton parameter:
 | 
			
		||||
    /// \image html CustomTrackerBodySkeleton.png
 | 
			
		||||
    /// \image rtf CustomTrackerBodySkeleton.png
 | 
			
		||||
    /// In the new class, you should override the Passer::Tracking::BodySkeleton::Start 
 | 
			
		||||
    /// and  Passer::Tracking::BodySkeleton::Update functions
 | 
			
		||||
    /// and implement the functionality to correctly start the tracking and retrieving the new body pose.
 | 
			
		||||
    /// This will ensure that the tracking is started and updated at the right moment.
 | 
			
		||||
    /// In the update function, you can asssign the tracking result to the correct tracking bones
 | 
			
		||||
    /// of %Humanoid Control.
 | 
			
		||||
    /// You can retrieve the %Humanoid Control TrackedBone using the BodySkeleton::GetBone function.
 | 
			
		||||
    /// Then you can update the position and/or the rotation of the bone.
 | 
			
		||||
    /// 
 | 
			
		||||
    /// *Important*: a confidence value between 0 and 1 should also be set for the bone's position and/or rotation.
 | 
			
		||||
    /// The default confidence is 0 and in that case, the tracking information will not be used.
 | 
			
		||||
    /// Next to that, the Passer::Tracking::BodySkeleton::status should reflect the current tracking status of the device.
 | 
			
		||||
    ///  
 | 
			
		||||
    /// Example of updating one bone:
 | 
			
		||||
    /// \code
 | 
			
		||||
    /// protected void UpdateBone(Bone boneId) {
 | 
			
		||||
    ///     TrackedBone bone = GetBone(boneId);
 | 
			
		||||
    ///         if (bone == null)
 | 
			
		||||
    ///             return;
 | 
			
		||||
    ///
 | 
			
		||||
    ///     // Get Perception Neuron tracking information
 | 
			
		||||
    ///     SensorBone neuronBone = device.GetBone(0, boneId);
 | 
			
		||||
    /// 
 | 
			
		||||
    ///     // Assign the tracking position
 | 
			
		||||
    ///     bone.transform.position = neuronBone.position;
 | 
			
		||||
    ///     // Set the position Confidence
 | 
			
		||||
    ///     bone.positionConfidence = neuronBone.positionConfidence;
 | 
			
		||||
    ///     
 | 
			
		||||
    ///     // Assign the tracking rotation
 | 
			
		||||
    ///     bone.transform.rotation = neuronBone.rotation;;
 | 
			
		||||
    ///     // Set the rotation Confidence
 | 
			
		||||
    ///     bone.rotationConfidence = neuronBone.rotationConfidence;
 | 
			
		||||
    /// }
 | 
			
		||||
    /// \endcode
 | 
			
		||||
    ///
 | 
			
		||||
    /// SensorComponents
 | 
			
		||||
    /// ================
 | 
			
		||||
    /// This option is most suited for tracking devices which can be mounted on the body.
 | 
			
		||||
    /// An example implementation is the ViveTracker imnplementation found in the %Humanoid Control Pro edition.
 | 
			
		||||
    /// 
 | 
			
		||||
    /// For this, you need to implement a class derived from the SensorComponent class.
 | 
			
		||||
    /// For the ViveTracker, this is the Passer::Tracking::ViveTrackerComponent.
 | 
			
		||||
    /// This class should be used on the Head, Hand, Hips and/or Foot Targets in the Sensor::sensorComponent
 | 
			
		||||
    /// parameter. Where applicable, selecting the bone in the dropdown determine to which bone the device is attached.
 | 
			
		||||
    /// \image html CustomTrackerSensorComponent.png
 | 
			
		||||
    /// \image rtf CustomTrackerSensorComponent.png
 | 
			
		||||
    /// In the new class, you should override the SensorComponent::StartComponent and SensorComponent::UpdateComponent functions
 | 
			
		||||
    /// and implement the functionality to correctly start the tracking and retrieve the actual pose of the device.
 | 
			
		||||
    /// This will ensure that the tracking is started and updated at the right moment.
 | 
			
		||||
    /// 
 | 
			
		||||
    /// In the overridden SensorUpdate function, you should update the Transform of the SensorComponent.
 | 
			
		||||
    /// 
 | 
			
		||||
    /// *Important*: a confidence value between 0 and 1 should also be set for the device.
 | 
			
		||||
    /// The default confidence is 0 and in that case, the tracking information will not be used.
 | 
			
		||||
    /// Next to that, the SensorComponent::status should reflect the current tracking status of the device.
 | 
			
		||||
    /// Example of updating the device rotation and position:
 | 
			
		||||
    /// \code
 | 
			
		||||
    /// public override void UpdateComponent() {
 | 
			
		||||
    ///     if (actionPose.poseIsValid) {
 | 
			
		||||
    ///         transform.localPosition = actionPose.localPosition;
 | 
			
		||||
    ///         transform.localRotation = actionPose.localRotation;
 | 
			
		||||
    ///     
 | 
			
		||||
    ///         status = Tracker.Status.Tracking;
 | 
			
		||||
    ///         positionConfidence = 0.99F;
 | 
			
		||||
    ///         rotationConfidence = 0.99F;
 | 
			
		||||
    ///     }
 | 
			
		||||
    ///     else {
 | 
			
		||||
    ///         status = Tracker.Status.Present;
 | 
			
		||||
    ///         positionConfidence = 0F;
 | 
			
		||||
    ///         rotationConfidence = 0F;
 | 
			
		||||
    ///     }
 | 
			
		||||
    /// }
 | 
			
		||||
    /// \endcode
 | 
			
		||||
    [System.Serializable]
 | 
			
		||||
	public class CustomTracker : HumanoidTracker {
 | 
			
		||||
 | 
			
		||||
        /// \copydoc HumanoidTracker::name
 | 
			
		||||
        public override string name => "Custom Tracker";
 | 
			
		||||
 | 
			
		||||
        #region Manage
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// A skeleton for the body
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// When this is set, the tracking will be taken from this skeleton
 | 
			
		||||
        public BodySkeleton bodySkeleton;
 | 
			
		||||
 | 
			
		||||
        #endregion Manage
 | 
			
		||||
 | 
			
		||||
        #region Update
 | 
			
		||||
 | 
			
		||||
        public override void UpdateTracker() {
 | 
			
		||||
            base.UpdateTracker();
 | 
			
		||||
 | 
			
		||||
            if (bodySkeleton != null) {
 | 
			
		||||
                status = bodySkeleton.status;
 | 
			
		||||
 | 
			
		||||
                UpdateBodyFromSkeleton();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected void UpdateBodyFromSkeleton() {
 | 
			
		||||
            if (bodySkeleton == null || bodySkeleton.status != Tracker.Status.Tracking)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            UpdateTorso();
 | 
			
		||||
            UpdateLeftArm();
 | 
			
		||||
            UpdateRightArm();
 | 
			
		||||
            UpdateLeftLeg();
 | 
			
		||||
            UpdateRightLeg();
 | 
			
		||||
 | 
			
		||||
            humanoid.CopyRigToTargets();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void UpdateTorso() {
 | 
			
		||||
            UpdateBone(humanoid.hipsTarget.hips.target, Tracking.Bone.Hips);
 | 
			
		||||
            UpdateBoneRotation(humanoid.hipsTarget.spine.target, Tracking.Bone.Spine);
 | 
			
		||||
            UpdateBoneRotation(humanoid.hipsTarget.chest.target, Tracking.Bone.Chest);
 | 
			
		||||
            UpdateBoneRotation(humanoid.headTarget.head.target, Tracking.Bone.Head);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void UpdateLeftArm() {
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftHandTarget.shoulder.target, Tracking.Bone.LeftShoulder);
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftHandTarget.upperArm.target, Tracking.Bone.LeftUpperArm);
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftHandTarget.forearm.target, Tracking.Bone.LeftForearm);
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftHandTarget.hand.target, Tracking.Bone.LeftHand);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void UpdateRightArm() {
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightHandTarget.shoulder.target, Tracking.Bone.RightShoulder);
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightHandTarget.upperArm.target, Tracking.Bone.RightUpperArm);
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightHandTarget.forearm.target, Tracking.Bone.RightForearm);
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightHandTarget.hand.target, Tracking.Bone.RightHand);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void UpdateLeftLeg() {
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftFootTarget.upperLeg.target, Tracking.Bone.LeftUpperLeg);
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftFootTarget.lowerLeg.target, Tracking.Bone.LeftLowerLeg);
 | 
			
		||||
            UpdateBoneRotation(humanoid.leftFootTarget.foot.target, Tracking.Bone.LeftFoot);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void UpdateRightLeg() {
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightFootTarget.upperLeg.target, Tracking.Bone.RightUpperLeg);
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightFootTarget.lowerLeg.target, Tracking.Bone.RightLowerLeg);
 | 
			
		||||
            UpdateBoneRotation(humanoid.rightFootTarget.foot.target, Tracking.Bone.RightFoot);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void UpdateBone(HumanoidTarget.TargetTransform target, Tracking.Bone boneId) {
 | 
			
		||||
            TrackedBone trackedBone = bodySkeleton.GetBone(boneId);
 | 
			
		||||
            if (trackedBone == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            float confidence = trackedBone.rotationConfidence;
 | 
			
		||||
            if (confidence > 0) {
 | 
			
		||||
                target.confidence.rotation = confidence;
 | 
			
		||||
                target.transform.rotation = bodySkeleton.transform.rotation * trackedBone.transform.rotation;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            confidence = trackedBone.positionConfidence;
 | 
			
		||||
            if (confidence > 0) {
 | 
			
		||||
                target.confidence.position = confidence;
 | 
			
		||||
                target.transform.position = bodySkeleton.transform.TransformPoint(trackedBone.transform.position);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void UpdateBoneRotation(HumanoidTarget.TargetTransform target, Tracking.Bone boneId) {
 | 
			
		||||
            TrackedBone trackedBone = bodySkeleton.GetBone(boneId);
 | 
			
		||||
            if (trackedBone == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            float confidence = trackedBone.rotationConfidence;
 | 
			
		||||
            if (confidence > 0) {
 | 
			
		||||
                target.confidence.rotation = confidence;
 | 
			
		||||
                target.transform.rotation = bodySkeleton.transform.rotation * trackedBone.transform.rotation;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion Update
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: a17001cc5e526574f94bf4961b36c64a
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@ -1,97 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: ab7fa14a16d2d4d46a58646bef481bfc
 | 
			
		||||
ModelImporter:
 | 
			
		||||
  serializedVersion: 19301
 | 
			
		||||
  internalIDToNameTable: []
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  materials:
 | 
			
		||||
    materialImportMode: 1
 | 
			
		||||
    materialName: 0
 | 
			
		||||
    materialSearch: 1
 | 
			
		||||
    materialLocation: 1
 | 
			
		||||
  animations:
 | 
			
		||||
    legacyGenerateAnimations: 4
 | 
			
		||||
    bakeSimulation: 0
 | 
			
		||||
    resampleCurves: 1
 | 
			
		||||
    optimizeGameObjects: 0
 | 
			
		||||
    motionNodeName: 
 | 
			
		||||
    rigImportErrors: 
 | 
			
		||||
    rigImportWarnings: 
 | 
			
		||||
    animationImportErrors: 
 | 
			
		||||
    animationImportWarnings: 
 | 
			
		||||
    animationRetargetingWarnings: 
 | 
			
		||||
    animationDoRetargetingWarnings: 0
 | 
			
		||||
    importAnimatedCustomProperties: 0
 | 
			
		||||
    importConstraints: 0
 | 
			
		||||
    animationCompression: 1
 | 
			
		||||
    animationRotationError: 0.5
 | 
			
		||||
    animationPositionError: 0.5
 | 
			
		||||
    animationScaleError: 0.5
 | 
			
		||||
    animationWrapMode: 0
 | 
			
		||||
    extraExposedTransformPaths: []
 | 
			
		||||
    extraUserProperties: []
 | 
			
		||||
    clipAnimations: []
 | 
			
		||||
    isReadable: 0
 | 
			
		||||
  meshes:
 | 
			
		||||
    lODScreenPercentages: []
 | 
			
		||||
    globalScale: 1
 | 
			
		||||
    meshCompression: 0
 | 
			
		||||
    addColliders: 0
 | 
			
		||||
    useSRGBMaterialColor: 1
 | 
			
		||||
    sortHierarchyByName: 1
 | 
			
		||||
    importVisibility: 1
 | 
			
		||||
    importBlendShapes: 1
 | 
			
		||||
    importCameras: 1
 | 
			
		||||
    importLights: 1
 | 
			
		||||
    fileIdsGeneration: 2
 | 
			
		||||
    swapUVChannels: 0
 | 
			
		||||
    generateSecondaryUV: 0
 | 
			
		||||
    useFileUnits: 1
 | 
			
		||||
    keepQuads: 0
 | 
			
		||||
    weldVertices: 1
 | 
			
		||||
    preserveHierarchy: 0
 | 
			
		||||
    skinWeightsMode: 0
 | 
			
		||||
    maxBonesPerVertex: 4
 | 
			
		||||
    minBoneWeight: 0.001
 | 
			
		||||
    meshOptimizationFlags: -1
 | 
			
		||||
    indexFormat: 0
 | 
			
		||||
    secondaryUVAngleDistortion: 8
 | 
			
		||||
    secondaryUVAreaDistortion: 15.000001
 | 
			
		||||
    secondaryUVHardAngle: 88
 | 
			
		||||
    secondaryUVPackMargin: 4
 | 
			
		||||
    useFileScale: 1
 | 
			
		||||
  tangentSpace:
 | 
			
		||||
    normalSmoothAngle: 60
 | 
			
		||||
    normalImportMode: 0
 | 
			
		||||
    tangentImportMode: 3
 | 
			
		||||
    normalCalculationMode: 4
 | 
			
		||||
    legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
 | 
			
		||||
    blendShapeNormalImportMode: 1
 | 
			
		||||
    normalSmoothingSource: 0
 | 
			
		||||
  referencedClips: []
 | 
			
		||||
  importAnimation: 1
 | 
			
		||||
  humanDescription:
 | 
			
		||||
    serializedVersion: 3
 | 
			
		||||
    human: []
 | 
			
		||||
    skeleton: []
 | 
			
		||||
    armTwist: 0.5
 | 
			
		||||
    foreArmTwist: 0.5
 | 
			
		||||
    upperLegTwist: 0.5
 | 
			
		||||
    legTwist: 0.5
 | 
			
		||||
    armStretch: 0.05
 | 
			
		||||
    legStretch: 0.05
 | 
			
		||||
    feetSpacing: 0
 | 
			
		||||
    globalScale: 1
 | 
			
		||||
    rootMotionBoneName: 
 | 
			
		||||
    hasTranslationDoF: 0
 | 
			
		||||
    hasExtraRoot: 0
 | 
			
		||||
    skeletonHasParents: 1
 | 
			
		||||
  lastHumanDescriptionAvatarSource: {instanceID: 0}
 | 
			
		||||
  autoGenerateAvatarMappingIfUnspecified: 1
 | 
			
		||||
  animationType: 2
 | 
			
		||||
  humanoidOversampling: 1
 | 
			
		||||
  avatarSetup: 0
 | 
			
		||||
  additionalBone: 0
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user