Renamed HumanoidFree folder to HumanoidControl
This commit is contained in:
parent
513092ca16
commit
c252ba8b51
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df6593e3fca102a49b812d8cb5da504d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e4a0bea205acfb4b93560112b9763e7
|
||||
timeCreated: 1534854189
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f62d4bbf100b274592d52298ebe8e69
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,73 +0,0 @@
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
public class PoseEvent_Editor : Event_Editor {
|
||||
|
||||
public static void EventInspector(
|
||||
SerializedProperty eventSourceProp, PoseEventList eventSource,
|
||||
ref int selectedEventSourceIx, ref int selectedEventIx) {
|
||||
|
||||
//UnityEventBase unityEventBase = eventSource.events[selectedEventIx].GetUnityEventBase();
|
||||
|
||||
EventInspector(eventSourceProp, ref selectedEventSourceIx, ref selectedEventIx,
|
||||
PoseMethodCheck, InitPoseEvent);
|
||||
}
|
||||
|
||||
protected static void InitPoseEvent(SerializedProperty eventProp) {
|
||||
}
|
||||
|
||||
protected static bool PoseMethodCheck(MethodInfo method, out string label) {
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
if (parameters.Length == 0 && method.ReturnType == typeof(void)) {
|
||||
label = method.Name + " ()";
|
||||
return true;
|
||||
}
|
||||
else if (parameters.Length == 1 && (
|
||||
parameters[0].ParameterType == typeof(bool) ||
|
||||
parameters[0].ParameterType == typeof(Pose)
|
||||
)) {
|
||||
|
||||
label = method.Name + " (" + parameters[0].ParameterType.Name + ")";
|
||||
return true;
|
||||
}
|
||||
|
||||
label = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void DetailsInspector(SerializedProperty eventProp, string label) {
|
||||
if (eventProp == null)
|
||||
return;
|
||||
|
||||
DetailsTypeInspector(eventProp);
|
||||
|
||||
PoseDetailsInspector(eventProp, label);
|
||||
}
|
||||
|
||||
protected static SerializedProperty DetailsTypeInspector(SerializedProperty eventProp) {
|
||||
GUIContent text = new GUIContent(
|
||||
"Event Type",
|
||||
"Never: the function is never called\n" +
|
||||
"OnStart: when the Pose becomes non-null\n" +
|
||||
"OnEnd: when the Pose becomes null\n" +
|
||||
"WhileActive: while Pose is non-null\n" +
|
||||
"WhileInactive: while Pose is null\n" +
|
||||
"OnChange: when the Pose changes\n" +
|
||||
"Continuous: the function is called for every frame"
|
||||
);
|
||||
SerializedProperty eventTypeProp = eventProp.FindPropertyRelative("eventType");
|
||||
eventTypeProp.intValue = (int)(EventHandler.Type)EditorGUILayout.EnumPopup(text, (EventHandler.Type)eventTypeProp.intValue);
|
||||
return eventTypeProp;
|
||||
}
|
||||
|
||||
protected static void PoseDetailsInspector(SerializedProperty eventProp, string label) {
|
||||
SerializedProperty poseEventProp = eventProp.FindPropertyRelative("poseEvent");
|
||||
EditorGUILayout.PropertyField(poseEventProp, new GUIContent("Pose"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 653b503ea0d528445ac96090359b5660
|
||||
timeCreated: 1551348784
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6b8b322e155656428b6810f3a55a454
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,39 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
[CustomEditor(typeof(RealWorldConfiguration))]
|
||||
public class RealWorldConfiguration_Editor : Editor {
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
serializedObject.Update();
|
||||
SerializedProperty trackerList = serializedObject.FindProperty("trackers");
|
||||
for (int i = 0; i < trackerList.arraySize; i++) {
|
||||
SerializedProperty trackerProp = trackerList.GetArrayElementAtIndex(i);
|
||||
|
||||
TrackingSpaceInspector(trackerProp);
|
||||
}
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
bool foldout = true;
|
||||
protected virtual void TrackingSpaceInspector(SerializedProperty trackerProp) {
|
||||
SerializedProperty trackerIdProp = trackerProp.FindPropertyRelative("trackerId");
|
||||
TrackerId trackerId = (TrackerId) trackerIdProp.intValue;
|
||||
foldout = EditorGUILayout.Foldout(foldout, trackerId.ToString());
|
||||
if (foldout) {
|
||||
EditorGUI.indentLevel++;
|
||||
SerializedProperty positionProp = trackerProp.FindPropertyRelative("position");
|
||||
positionProp.vector3Value = EditorGUILayout.Vector3Field("Position", positionProp.vector3Value);
|
||||
|
||||
SerializedProperty rotationProp = trackerProp.FindPropertyRelative("rotation");
|
||||
Vector3 angles = rotationProp.quaternionValue.eulerAngles;
|
||||
angles = EditorGUILayout.Vector3Field("Rotation", angles);
|
||||
rotationProp.quaternionValue = Quaternion.Euler(angles);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 826b17e430aa1be489863039889c74fa
|
||||
timeCreated: 1562138586
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ff42c1682253654b8aa326ff4572d28
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,184 +0,0 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
public class UnityXR_Editor : Tracker_Editor {
|
||||
|
||||
#if pUNITYXR
|
||||
|
||||
#region Tracker
|
||||
|
||||
public class TrackerProps : HumanoidControl_Editor.HumanoidTrackerProps {
|
||||
|
||||
#if hOCHAND
|
||||
readonly private SerializedProperty oculusHandTrackingProp;
|
||||
#endif
|
||||
#if hVIVEHAND
|
||||
readonly private SerializedProperty viveHandTrackingProp;
|
||||
#endif
|
||||
|
||||
|
||||
public TrackerProps(SerializedObject serializedObject, HumanoidControl_Editor.HumanoidTargetObjs targetObjs, UnityXRTracker _unityXR)
|
||||
: base(serializedObject, targetObjs, _unityXR, nameof(HumanoidControl.unityXR)) {
|
||||
tracker = _unityXR;
|
||||
|
||||
#if hOCHAND
|
||||
oculusHandTrackingProp = serializedObject.FindProperty("unityXR.oculusHandTracking");
|
||||
CheckQuestManifest();
|
||||
#endif
|
||||
#if hVIVEHAND
|
||||
viveHandTrackingProp = serializedObject.FindProperty("unityXR.viveHandTracking");
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void Inspector(HumanoidControl humanoid) {
|
||||
Inspector(humanoid, "Unity XR");
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
TrackerInspector(humanoid, humanoid.unityXR);
|
||||
HandTrackingInspector(humanoid);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
protected void HandTrackingInspector(HumanoidControl humanoid) {
|
||||
OculusHandTrackingInspector();
|
||||
ViveHandTrackingInspector(humanoid);
|
||||
}
|
||||
|
||||
protected void OculusHandTrackingInspector() {
|
||||
#if hOCHAND
|
||||
GUIContent labelText = new GUIContent(
|
||||
"Oculus Hand Tracking",
|
||||
"Enables hand tracking on the Oculus Quest"
|
||||
);
|
||||
oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected virtual void CheckQuestManifest() {
|
||||
string manifestPath = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
|
||||
FileInfo fileInfo = new FileInfo(manifestPath);
|
||||
fileInfo.Directory.Create();
|
||||
bool manifestAvailable = File.Exists(manifestPath);
|
||||
if (manifestAvailable)
|
||||
return;
|
||||
|
||||
string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
||||
string questManifestPath = Application.dataPath + humanoidPath + "Extensions/Oculus/QuestManifest.xml";
|
||||
File.Copy(questManifestPath, manifestPath);
|
||||
}
|
||||
|
||||
|
||||
protected void ViveHandTrackingInspector(HumanoidControl humanoid) {
|
||||
#if hVIVEHAND
|
||||
GUIContent labelText = new GUIContent(
|
||||
"Vive Hand Tracking",
|
||||
"Enables hand tracking on the HTC Vive"
|
||||
);
|
||||
viveHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, viveHandTrackingProp.boolValue);
|
||||
// When using vive hand tracking, the GestureProvider should be added to the UnityXR component
|
||||
// before the scene starts. So we need to add it in the edito
|
||||
// and we need to have the unityXR component in the scene
|
||||
if (viveHandTrackingProp.boolValue == true) {
|
||||
humanoid.unityXR.CheckTracker(humanoid, UnityXR.Get);
|
||||
ViveHandSkeleton.CheckGestureProvider(humanoid.unityXR.trackerComponent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Head
|
||||
|
||||
public class HeadTargetProps : HeadTarget_Editor.TargetProps {
|
||||
|
||||
readonly SerializedProperty hmdProp;
|
||||
|
||||
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
||||
: base(serializedObject, headTarget.unityXR, headTarget, nameof(HeadTarget.unityXR)) {
|
||||
|
||||
hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".hmd");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
if (!headTarget.humanoid.unityXR.enabled)
|
||||
return;
|
||||
|
||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(headTarget.unityXR, headTarget);
|
||||
headTarget.unityXR.enabled = enabledProp.boolValue;
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.hmd, typeof(UnityXRHmd), true);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
headTarget.unityXR.CheckSensor(headTarget);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hand
|
||||
|
||||
public class HandTargetProps : HandTarget_Editor.TargetProps {
|
||||
|
||||
SerializedProperty controllerProp;
|
||||
|
||||
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
||||
: base(serializedObject, handTarget.unityXR, handTarget, "unityXR") {
|
||||
|
||||
controllerProp = serializedObject.FindProperty("unityXR.controller");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
if (!handTarget.humanoid.unityXR.enabled)
|
||||
return;
|
||||
|
||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(handTarget.unityXR, handTarget);
|
||||
handTarget.unityXR.enabled = enabledProp.boolValue;
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
if (handTarget.unityXR.controller == null) {
|
||||
// Controller does not exist
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
EditorGUILayout.LabelField("Controller", GUILayout.Width(120));
|
||||
if (GUILayout.Button("Show")) {
|
||||
handTarget.unityXR.CheckSensor(handTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
controllerProp.objectReferenceValue = (UnityXRController)EditorGUILayout.ObjectField("Controller", controllerProp.objectReferenceValue, typeof(UnityXRController), true);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
handTarget.unityXR.CheckSensor(handTarget);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b70e5e81de46964eaf3d2a996040d77
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df0862b2428c1fb4d93138841484e18f
|
||||
timeCreated: 1453541563
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5a9fdaf93a979643ab970df490cc3ff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
Binary file not shown.
Before Width: | Height: | Size: 363 B |
@ -1,47 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 508725d3dffb9554e9f7786086b83bdb
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
Binary file not shown.
Before Width: | Height: | Size: 355 B |
@ -1,47 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a43f4693504f0654a851c5e588edcc79
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3494f4616fd63994c91a41e85e928559
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,20 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Pawn;
|
||||
|
||||
public class HumanoidNetworking_Editor : Editor {
|
||||
|
||||
protected virtual void SyncFingerSwingInspector() {
|
||||
SerializedProperty syncFingerSwingProp = serializedObject.FindProperty("_syncFingerSwing");
|
||||
syncFingerSwingProp.boolValue = EditorGUILayout.Toggle("Sync Finger Swing", syncFingerSwingProp.boolValue);
|
||||
}
|
||||
|
||||
protected virtual void SyncTrackingInspector() {
|
||||
SerializedProperty syncTrackingProp = serializedObject.FindProperty("_syncTracking");
|
||||
syncTrackingProp.boolValue = EditorGUILayout.Toggle("Sync Tracking Space", syncTrackingProp.boolValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02025295d2b71a147abec30e10edc361
|
||||
timeCreated: 1504014208
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,83 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
#if !UNITY_2019_1_OR_NEWER
|
||||
using UnityEngine.Networking;
|
||||
#endif
|
||||
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class OnLoadHumanoidPlayer {
|
||||
static OnLoadHumanoidPlayer() {
|
||||
//HumanoidPreferencesIMGUIRegister.reload = true;
|
||||
}
|
||||
|
||||
public static string GetHumanoidPlayerPrefabPath() {
|
||||
string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
||||
string prefabPathWithoutScripts = humanoidPath.Substring(0, humanoidPath.Length - 8);
|
||||
string prefabPath = "Assets" + prefabPathWithoutScripts + "Prefabs/Networking/Resources/HumanoidPlayer.prefab";
|
||||
return prefabPath;
|
||||
}
|
||||
|
||||
public static GameObject GetHumanoidPlayerPrefab(string prefabPath) {
|
||||
GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
|
||||
return prefab;
|
||||
}
|
||||
|
||||
public static void UpdateHumanoidPrefab(GameObject prefab, string prefabPath) {
|
||||
if (!Application.isPlaying) {
|
||||
Debug.Log("UpdateHumanoidPrefab " + Application.isFocused + " " + Application.isBatchMode + " " + Application.isEditor);
|
||||
if (Application.isFocused && !Application.isBatchMode && Application.isEditor) {
|
||||
Debug.Log("delaying save " + prefab);
|
||||
HumanoidPlayer_Editor.prefabsToSave.Push(prefab);
|
||||
HumanoidPlayer_Editor.prefabPaths.Push(prefabPath);
|
||||
EditorApplication.delayCall += HumanoidPlayer_Editor.DelayedSave;
|
||||
}
|
||||
else {
|
||||
Debug.Log("updating " + prefab);
|
||||
PrefabUtility.SaveAsPrefabAsset(prefab, prefabPath);
|
||||
PrefabUtility.UnloadPrefabContents(prefab);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[CustomEditor(typeof(HumanoidPlayer))]
|
||||
public class HumanoidPlayer_Editor : HumanoidNetworking_Editor {
|
||||
#if hNW_UNET
|
||||
public override void OnInspectorGUI() {
|
||||
serializedObject.Update();
|
||||
|
||||
SendRateInspector();
|
||||
DebugLevelInspector();
|
||||
SmoothingInspector();
|
||||
SyncFingerSwingInspector();
|
||||
CreateLocalRemotesInspector();
|
||||
SyncTrackingInspector();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
#endif
|
||||
public static Stack<GameObject> prefabsToSave = new Stack<GameObject>();
|
||||
public static Stack<string> prefabPaths = new Stack<string>();
|
||||
|
||||
|
||||
//private void OnSceneGUI() {
|
||||
public static void DelayedSave() {
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
|
||||
if (prefabsToSave.Count > 0) {
|
||||
GameObject prefab = prefabsToSave.Pop();
|
||||
Debug.Log("Delayed save of prefab " + prefab);
|
||||
string path = prefabPaths.Pop();
|
||||
PrefabUtility.SaveAsPrefabAsset(prefab, path);
|
||||
PrefabUtility.UnloadPrefabContents(prefab);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2509f5610a14b84ebf59b2f57fff792
|
||||
timeCreated: 1563434259
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,46 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[CustomEditor(typeof(NetworkingSpawner))]
|
||||
public class NetworkingSpawner_Editor : NetworkingStarter_Editor {
|
||||
private SerializedProperty humanoidPrefabProp;
|
||||
private SerializedProperty spawnPointsProp;
|
||||
private SerializedProperty spawnMethodProp;
|
||||
|
||||
public override void OnEnable() {
|
||||
base.OnEnable();
|
||||
|
||||
humanoidPrefabProp = serializedObject.FindProperty("humanoidPrefab");
|
||||
spawnPointsProp = serializedObject.FindProperty("spawnPoints");
|
||||
spawnMethodProp = serializedObject.FindProperty("spawnMethod");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
base.OnInspectorGUI();
|
||||
GUIContent label;
|
||||
|
||||
label = new GUIContent(
|
||||
"Humanoid Prefab",
|
||||
"The Humanoid Prefab that will be spawned when networking has started"
|
||||
);
|
||||
EditorGUILayout.PropertyField(humanoidPrefabProp, label);
|
||||
|
||||
label = new GUIContent(
|
||||
"Spawn Points",
|
||||
"The possible spawning points for the Humanoid"
|
||||
);
|
||||
EditorGUILayout.PropertyField(spawnPointsProp, label, true);
|
||||
|
||||
label = new GUIContent(
|
||||
"Spawn Mode",
|
||||
"The order in which the spawn points are chosen"
|
||||
);
|
||||
EditorGUILayout.PropertyField(spawnMethodProp, label);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79e13e41ebe67724cb80251b3df3a108
|
||||
timeCreated: 1519718995
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,118 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
[HelpURL("http://passervr.com/documentation/humanoid-control/object-tracker/")]
|
||||
[CustomEditor(typeof(ObjectTracker))]
|
||||
public class ObjectTracker_Editor : Editor {
|
||||
public enum Side {
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
|
||||
protected ObjectTracker objectTracker;
|
||||
|
||||
#region Enable
|
||||
public void OnEnable() {
|
||||
objectTracker = (ObjectTracker)target;
|
||||
|
||||
//if (objectTracker.targetTransform == null)
|
||||
// objectTracker.targetTransform = objectTracker.transform;
|
||||
// HumanoidControl humanoid = objectTracker.humanoid;
|
||||
// if (humanoid != null) {
|
||||
//#if hOCULUS
|
||||
// objectTracker.oculusTouch.tracker = humanoid.oculus;
|
||||
//#endif
|
||||
// }
|
||||
|
||||
//#if hOCULUS
|
||||
// if (objectTracker.oculusTouch.target == null)
|
||||
// objectTracker.oculusTouch.target = objectTracker;
|
||||
//#endif
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
|
||||
public void OnDisable() {
|
||||
if (!Application.isPlaying) {
|
||||
serializedObject.Update();
|
||||
|
||||
SetSensor2Object();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetSensor2Object() {
|
||||
SensorComponent sensorComponent = objectTracker.sensorComponent;
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
SerializedProperty sensor2ObjectRotationProp = serializedObject.FindProperty("sensor2ObjectRotation");
|
||||
sensor2ObjectRotationProp.quaternionValue = Quaternion.Inverse(sensorComponent.transform.rotation) * objectTracker.transform.rotation;
|
||||
|
||||
SerializedProperty sensor2ObjectPositionProp = serializedObject.FindProperty("sensor2ObjectPosition");
|
||||
sensor2ObjectPositionProp.vector3Value = -InverseTransformPointUnscaled(objectTracker.transform, sensorComponent.transform.position);
|
||||
}
|
||||
|
||||
private static Vector3 InverseTransformPointUnscaled(Transform transform, Vector3 position) {
|
||||
var worldToLocalMatrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one).inverse;
|
||||
return worldToLocalMatrix.MultiplyPoint3x4(position);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
ObjectTracker objectTracker = (ObjectTracker)target;
|
||||
serializedObject.Update();
|
||||
|
||||
SerializedProperty sensorComponentProp = serializedObject.FindProperty("sensorComponent");
|
||||
sensorComponentProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor Component", sensorComponentProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||
|
||||
Settings(objectTracker);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#region Settings
|
||||
|
||||
private static bool showSettings = false;
|
||||
public static void Settings(ObjectTracker objectTracker) {
|
||||
showSettings = EditorGUILayout.Foldout(showSettings, "Settings", true);
|
||||
if (showSettings) {
|
||||
EditorGUI.indentLevel++;
|
||||
objectTracker.showRealObjects = EditorGUILayout.Toggle("Show Real Objects", objectTracker.showRealObjects);
|
||||
ShowTrackers(objectTracker, objectTracker.showRealObjects);
|
||||
// Work in progress
|
||||
//objectTracker.physics = EditorGUILayout.Toggle("Physics", objectTracker.physics);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ShowTrackers(ObjectTracker objectTracker, bool shown) {
|
||||
objectTracker.ShowTrackers(shown);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Scene
|
||||
//private Vector3 objectPosition;
|
||||
//private Quaternion objectLocalRotation;
|
||||
public void OnSceneGUI() {
|
||||
ObjectTracker objectTracker = (ObjectTracker)target;
|
||||
|
||||
//if (!Application.isPlaying)
|
||||
// objectTracker.UpdateSensorsFromTarget();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b979cd5e42542cd4ab5c1a7ed93050fc
|
||||
timeCreated: 1470140284
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56054ec822d4e1145b92272d074b4223
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[CustomEditor(typeof(BallHandle))]
|
||||
public class BallHandle_Editor : Handle_Editor {
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
EditorGUILayout.HelpBox("BallHandle is depreciated, use Handle with Grab Type=Ball Grab instead.", MessageType.Warning);
|
||||
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31353aacf17411740836d02dbd7c2221
|
||||
timeCreated: 1547654508
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[CustomEditor(typeof(BarHandle))]
|
||||
public class BarHandle_Editor : Handle_Editor {
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
EditorGUILayout.HelpBox("BarHandle is depreciated, use Handle with Grab Type=Bar Grab instead.", MessageType.Warning);
|
||||
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 805b823334ccde549aca31ee8d7509d8
|
||||
timeCreated: 1506938796
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c6ae40433109fe41a121ce43a60540c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1 +0,0 @@
|
||||
// This file is intentionally empty
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d949b2c3b0af78f42ba4bb69313ff32a
|
||||
timeCreated: 1515774271
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,322 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Passer;
|
||||
using Passer.Humanoid.Tracking;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[CustomEditor(typeof(Pose))]
|
||||
public class Pose_Editor : Editor {
|
||||
private Pose pose;
|
||||
|
||||
#region Enable
|
||||
public void OnEnable() {
|
||||
pose = (Pose)target;
|
||||
if (pose.bonePoses == null)
|
||||
pose.bonePoses = new List<BonePose>();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
public void OnDisable() {
|
||||
pose.Cleanup();
|
||||
}
|
||||
#endregion
|
||||
|
||||
private enum Reference {
|
||||
HumanoidLocal,
|
||||
BoneLocal
|
||||
}
|
||||
|
||||
#region Inspector
|
||||
public override void OnInspectorGUI() {
|
||||
for (int i = 0; i < pose.bonePoses.Count; i++) {
|
||||
BonePose bonePoses = pose.bonePoses[i];
|
||||
if (bonePoses == null)
|
||||
continue;
|
||||
|
||||
if (bonePoses.boneRef.type == BoneType.SideBones && bonePoses.boneRef.side == Side.AnySide) {
|
||||
EditorGUILayout.HelpBox("Configure AnySide like Left Side", MessageType.Info);
|
||||
}
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bonePoses.boneRef.type = (BoneType)EditorGUILayout.EnumPopup(bonePoses.boneRef.type, GUILayout.Width(159));
|
||||
Bone oldBoneId = bonePoses.boneRef.boneId;
|
||||
SideBone oldSideBoneId = bonePoses.boneRef.sideBoneId;
|
||||
BoneSelector(ref bonePoses.boneRef);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (bonePoses.boneRef.boneId != oldBoneId || bonePoses.boneRef.sideBoneId != oldSideBoneId)
|
||||
PresetReferenceBone(bonePoses.boneRef, ref bonePoses.referenceBoneRef);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Reference", GUILayout.MaxWidth(65));
|
||||
bonePoses.referenceBoneRef.type = (BoneType)EditorGUILayout.EnumPopup(bonePoses.referenceBoneRef.type, GUILayout.Width(90));
|
||||
|
||||
BoneSelector(ref bonePoses.referenceBoneRef); EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bonePoses.setTranslation = EditorGUILayout.ToggleLeft("Translation", bonePoses.setTranslation, GUILayout.MaxWidth(131));
|
||||
if (bonePoses.setTranslation)
|
||||
bonePoses.translation = EditorGUILayout.Vector3Field("", bonePoses.translation);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bonePoses.setRotation = EditorGUILayout.ToggleLeft("Rotation", bonePoses.setRotation, GUILayout.MaxWidth(131));
|
||||
if (bonePoses.setRotation) {
|
||||
Vector3 eulerAngles = EditorGUILayout.Vector3Field("", bonePoses.rotation.eulerAngles);
|
||||
if (eulerAngles != bonePoses.rotation.eulerAngles)
|
||||
bonePoses.rotation.eulerAngles = eulerAngles;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bonePoses.setScale = EditorGUILayout.ToggleLeft("Scale", bonePoses.setScale, GUILayout.MaxWidth(131));
|
||||
if (bonePoses.setScale)
|
||||
bonePoses.scale = EditorGUILayout.Vector3Field("", bonePoses.scale);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
Buttons();
|
||||
EditorUtility.SetDirty(pose);
|
||||
}
|
||||
|
||||
private void PresetReferenceBone(BoneReference bone, ref BoneReference referenceBone) {
|
||||
if (referenceBone.boneId != Bone.None)
|
||||
return;
|
||||
|
||||
if (bone.isFacialBone)
|
||||
referenceBone.centerBoneId = CenterBone.Head;
|
||||
if (bone.isHandBone) {
|
||||
referenceBone.sideBoneId = SideBone.Hand;
|
||||
referenceBone.type = BoneType.SideBones;
|
||||
}
|
||||
}
|
||||
|
||||
private void BoneSelector(ref BoneReference bone) {
|
||||
switch (bone.type) {
|
||||
case BoneType.AllBones:
|
||||
bone.boneId = (Bone)EditorGUILayout.EnumPopup(bone.boneId);
|
||||
return;
|
||||
case BoneType.CenterBones:
|
||||
CenterBone centerBone = (CenterBone)EditorGUILayout.EnumPopup(bone.centerBoneId);
|
||||
if (centerBone != CenterBone.Unknown)
|
||||
bone.centerBoneId = centerBone;
|
||||
return;
|
||||
case BoneType.SideBones:
|
||||
if (bone.boneId == Bone.None) {
|
||||
SideBone sideBoneId = bone.sideBoneId;
|
||||
bone.sideBoneId = (SideBone)EditorGUILayout.EnumPopup(sideBoneId);
|
||||
}
|
||||
else {
|
||||
bone.sideBoneId = (SideBone)EditorGUILayout.EnumPopup(bone.sideBoneId);
|
||||
}
|
||||
bone.side = (Side)EditorGUILayout.EnumPopup(bone.side, GUILayout.Width(80));
|
||||
return;
|
||||
case BoneType.FaceBones:
|
||||
bone.faceBoneId = (FacialBone)EditorGUILayout.EnumPopup(bone.faceBoneId);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#region Buttons
|
||||
private void Buttons() {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
AddBoneButton();
|
||||
ClearAllButton();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
private void AddBoneButton() {
|
||||
if (GUILayout.Button("Add Bone")) {
|
||||
//PoseBone newBone = new PoseBone();
|
||||
//PoseBone newBone = ScriptableObject.CreateInstance<PoseBone>();
|
||||
//pose.bones.Add(newBone);
|
||||
pose.AddBone(Bone.None);
|
||||
}
|
||||
}
|
||||
private void ClearAllButton() {
|
||||
if (GUILayout.Button("Clear All")) {
|
||||
pose.bonePoses = new List<BonePose>();
|
||||
//pose.boneArray = new BonePose[0];
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public static void PoseMixerInspector(PoseMixer poseMixer, HumanoidControl humanoid, Side side = Side.AnySide) {
|
||||
int i = 0;
|
||||
foreach (MixedPose pose in poseMixer.mixedPoses) {
|
||||
Pose oldPose = pose.pose;
|
||||
HumanoidPoseInspector(poseMixer, pose, i, humanoid, side);
|
||||
if (pose.pose != oldPose && pose.pose == null) {
|
||||
// We deleted a pose, let's undo it's effect
|
||||
pose.value = 0;
|
||||
pose.pose = oldPose;
|
||||
poseMixer.ShowPose(humanoid);
|
||||
pose.pose = null;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
Pose addPose = (Pose)EditorGUILayout.ObjectField(null, typeof(Pose), false, GUILayout.Width(200));
|
||||
if (addPose != null) {
|
||||
MixedPose newPose = poseMixer.Add();
|
||||
newPose.pose = addPose;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static MixedPose HumanoidPoseInspector(PoseMixer poseMixer, MixedPose mixedPose, int poseIx, HumanoidControl humanoid, Side side = Side.AnySide) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
if (poseMixer.poseMode == PoseMixer.PoseMode.Set)
|
||||
mixedPose.pose = (Pose)EditorGUILayout.ObjectField(mixedPose.pose, typeof(Pose), false, GUILayout.Width(200));
|
||||
else
|
||||
mixedPose.pose = (Pose)EditorGUILayout.ObjectField(mixedPose.pose, typeof(Pose), false);
|
||||
if (mixedPose.pose != null) {
|
||||
if (mixedPose.isEdited) {
|
||||
EditorGUILayout.Slider(mixedPose.value, 0, 1);
|
||||
poseMixer.SetPoseValue(poseIx, 1);
|
||||
}
|
||||
else if (poseMixer.poseMode == PoseMixer.PoseMode.Set)
|
||||
{
|
||||
float value = EditorGUILayout.Slider(mixedPose.value, 0, 1);
|
||||
if (value != mixedPose.value) {
|
||||
poseMixer.SetPoseValue(poseIx, value);
|
||||
}
|
||||
}
|
||||
if (!Application.isPlaying || side == Side.AnySide) {
|
||||
bool isEdited = EditorGUILayout.Toggle(mixedPose.isEdited, "button", GUILayout.Width(19));
|
||||
if (mixedPose.isEdited != isEdited)
|
||||
SceneView.RepaintAll();
|
||||
mixedPose.isEdited = isEdited;
|
||||
}
|
||||
else {
|
||||
EditorGUILayout.FloatField(mixedPose.score);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (mixedPose.isEdited) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(" ", GUILayout.Width(200));
|
||||
mixedPose.additive = EditorGUILayout.ToggleLeft("Additive", mixedPose.additive);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
return mixedPose;
|
||||
}
|
||||
|
||||
#region Scene
|
||||
|
||||
static int boneIndex = -1;
|
||||
public static void UpdateScene(HumanoidControl humanoid, ITarget target, PoseMixer poseMixer, ref BonePose selectedBone, Side side = Side.AnySide) {
|
||||
//if (!Application.isPlaying)
|
||||
// poseMixer.ShowPose(humanoid);
|
||||
|
||||
MixedPose currentPose = poseMixer.GetEditedPose();
|
||||
if (currentPose == null || !currentPose.isEdited) {
|
||||
UnityEditor.Tools.hidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
UnityEditor.Tools.hidden = true;
|
||||
|
||||
HumanoidTarget.TargetedBone[] bones = target.GetBones();
|
||||
int[] controlIds = new int[bones.Length];
|
||||
Bone[] boneIds = new Bone[bones.Length];
|
||||
|
||||
for (int i = 0; i < bones.Length; i++) {
|
||||
if (bones[i] == null || bones[i].bone == null || bones[i].bone.transform == null)
|
||||
continue;
|
||||
|
||||
Handles.FreeMoveHandle(bones[i].bone.transform.position, bones[i].bone.transform.rotation, 0.002F, Vector3.zero, DotHandleCapSaveID);
|
||||
controlIds[i] = lastControlID;
|
||||
boneIds[i] = bones[i].boneId;
|
||||
}
|
||||
|
||||
FindSelectedHandle(controlIds, boneIds, ref boneIndex);
|
||||
if (boneIndex == -1)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetedBone = FindTargetedBone(bones, boneIds[boneIndex]);
|
||||
if (targetedBone == null || targetedBone.bone.transform == null)
|
||||
return;
|
||||
|
||||
GUIStyle style = new GUIStyle();
|
||||
style.normal.textColor = Color.yellow;
|
||||
Handles.Label(targetedBone.bone.transform.position + Vector3.up * 0.01F, targetedBone.name, style);
|
||||
Handles.color = Color.white;
|
||||
|
||||
switch (UnityEditor.Tools.current) {
|
||||
case Tool.Move:
|
||||
selectedBone = currentPose.pose.CheckBone(boneIds[boneIndex], true);
|
||||
Vector3 handlePosition = Handles.PositionHandle(targetedBone.target.transform.position, targetedBone.bone.transform.rotation);
|
||||
targetedBone.target.transform.position = handlePosition;
|
||||
selectedBone.setTranslation = true;
|
||||
selectedBone.SetReferenceLocal(humanoid, side);
|
||||
selectedBone.UpdateTranslation(humanoid, side);
|
||||
break;
|
||||
case Tool.Rotate:
|
||||
selectedBone = currentPose.pose.CheckBone(boneIds[boneIndex], true);
|
||||
Quaternion handleRotation = Handles.RotationHandle(targetedBone.target.transform.rotation, targetedBone.bone.transform.position);
|
||||
targetedBone.target.transform.rotation = handleRotation;
|
||||
selectedBone.setRotation = true;
|
||||
selectedBone.SetReferenceLocal(humanoid, side);
|
||||
selectedBone.UpdateRotation(humanoid, side);
|
||||
break;
|
||||
case Tool.Scale:
|
||||
//Handles.ScaleHandle(selectedBone.transform.localScale, selectedBone.transform.position, selectedBone.transform.rotation, HandleUtility.GetHandleSize(selectedBone.transform.position));
|
||||
// need to all morphScale first...
|
||||
break;
|
||||
}
|
||||
|
||||
Handles.BeginGUI();
|
||||
ResetBoneButton(selectedBone, humanoid);
|
||||
Handles.EndGUI();
|
||||
|
||||
}
|
||||
|
||||
private static void ResetBoneButton(BonePose selectedBone, HumanoidControl humanoid) {
|
||||
if (GUILayout.Button("Reset Bone", GUILayout.Width(100))) {
|
||||
Debug.Log("Got it to work.");
|
||||
selectedBone.setRotation = false;
|
||||
selectedBone.rotation = Quaternion.identity;
|
||||
HumanoidTarget.TargetedBone targetedBone = humanoid.GetBone(selectedBone.boneRef.boneId);
|
||||
targetedBone.target.transform.localRotation = selectedBone.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
private static HumanoidTarget.TargetedBone FindTargetedBone(HumanoidTarget.TargetedBone[] bones, Tracking.Bone boneId) {
|
||||
foreach (HumanoidTarget.TargetedBone bone in bones) {
|
||||
if (bone.boneId == boneId)
|
||||
return bone;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static int lastControlID;
|
||||
public static void DotHandleCapSaveID(int controlID, Vector3 position, Quaternion rotation, float size, EventType et) {
|
||||
lastControlID = controlID;
|
||||
Handles.DotHandleCap(controlID, position, rotation, size, et);
|
||||
}
|
||||
|
||||
private static void FindSelectedHandle(int[] controlIds, Tracking.Bone[] boneIds, ref int boneIndex) {
|
||||
for (int i = 0; i < controlIds.Length; i++) {
|
||||
if (controlIds[i] != 0 && controlIds[i] == GUIUtility.hotControl) {
|
||||
boneIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd1c837f43b04f543ad17a72adb65579
|
||||
timeCreated: 1515774608
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer {
|
||||
using Humanoid;
|
||||
using Humanoid.Tracking;
|
||||
using Passer.Tracking;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class HumanoidConfiguration : MonoBehaviour {
|
||||
static HumanoidConfiguration() {
|
||||
//Configuration_Editor.GlobalDefine("pHUMANOID");
|
||||
#if hLEAP
|
||||
LeapDevice.LoadDlls();
|
||||
#endif
|
||||
#if hORBBEC
|
||||
AstraDevice.LoadDlls();
|
||||
#endif
|
||||
#if hNEURON
|
||||
NeuronDevice.LoadDlls();
|
||||
#endif
|
||||
}
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
|
||||
// Have we loaded the prefs yet
|
||||
public static Configuration configuration;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
*/
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 336932db5f7f6174ea2950adf102b57b
|
||||
timeCreated: 1534854134
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fc3a8cb7c606f146abada798999e35a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,605 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer {
|
||||
using Humanoid;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(FootTarget), true)]
|
||||
public class FootTarget_Editor : Editor {
|
||||
private FootTarget footTarget;
|
||||
private HumanoidControl humanoid;
|
||||
|
||||
private TargetProps[] allProps;
|
||||
|
||||
#region Enable
|
||||
|
||||
public void OnEnable() {
|
||||
footTarget = (FootTarget)target;
|
||||
|
||||
if (footTarget.humanoid == null)
|
||||
footTarget.humanoid = GetHumanoid(footTarget);
|
||||
humanoid = footTarget.humanoid;
|
||||
if (humanoid == null)
|
||||
return;
|
||||
|
||||
InitEditors();
|
||||
|
||||
footTarget.InitSensors();
|
||||
InitConfiguration(footTarget);
|
||||
InitSettings();
|
||||
InitEvents();
|
||||
}
|
||||
|
||||
private void InitEditors() {
|
||||
allProps = new TargetProps[] {
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
new ViveTracker_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hKINECT1
|
||||
new Kinect1_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hKINECT2
|
||||
new Kinect2_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hKINECT4
|
||||
new Kinect4_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hORBBEC
|
||||
new Astra_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hANTILATENCY
|
||||
new Antilatency_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hCUSTOM
|
||||
new Custom_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
public void OnDisable() {
|
||||
if (humanoid == null) {
|
||||
// This target is not connected to a humanoid, so we delete it
|
||||
DestroyImmediate(footTarget, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
SetSensor2Target();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSensor2Target() {
|
||||
foreach (TargetProps props in allProps)
|
||||
props.SetSensor2Target();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
public override void OnInspectorGUI() {
|
||||
if (footTarget == null || humanoid == null)
|
||||
return;
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
ControllerInspectors(footTarget);
|
||||
ConfigurationInspector(footTarget);
|
||||
SettingsInspector(footTarget);
|
||||
EventsInspector();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
UpdateBones(footTarget);
|
||||
}
|
||||
|
||||
public static FootTarget Inspector(FootTarget footTarget, string name) {
|
||||
if (footTarget == null)
|
||||
return footTarget;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
Transform defaultTargetTransform = footTarget.GetDefaultTarget(footTarget.humanoid);
|
||||
Transform targetTransform = footTarget.transform ?? defaultTargetTransform;
|
||||
|
||||
GUIContent text = new GUIContent(
|
||||
name,
|
||||
"The transform controlling the " + name
|
||||
);
|
||||
targetTransform = (Transform)EditorGUILayout.ObjectField(text, targetTransform, typeof(Transform), true);
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
if (targetTransform == defaultTargetTransform && GUILayout.Button("Show", GUILayout.MaxWidth(60))) {
|
||||
// Call static method CreateTarget on target
|
||||
footTarget = (FootTarget)footTarget.GetType().GetMethod("CreateTarget").Invoke(null, new object[] { footTarget });
|
||||
}
|
||||
else if (targetTransform != footTarget.transform) {
|
||||
footTarget = (FootTarget)footTarget.GetType().GetMethod("SetTarget").Invoke(null, new object[] { footTarget.humanoid, targetTransform, footTarget.isLeft });
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return footTarget;
|
||||
}
|
||||
|
||||
public static HumanoidControl GetHumanoid(HumanoidTarget target) {
|
||||
HumanoidControl foundHumanoid = target.transform.GetComponentInParent<HumanoidControl>();
|
||||
if (foundHumanoid != null)
|
||||
return foundHumanoid;
|
||||
|
||||
HumanoidControl[] humanoids = GameObject.FindObjectsOfType<HumanoidControl>();
|
||||
|
||||
for (int i = 0; i < humanoids.Length; i++)
|
||||
if (humanoids[i].leftFootTarget.transform == target.transform ||
|
||||
humanoids[i].rightFootTarget.transform == target.transform)
|
||||
foundHumanoid = humanoids[i];
|
||||
|
||||
return foundHumanoid;
|
||||
}
|
||||
|
||||
#region Sensors
|
||||
private static bool showControllers = true;
|
||||
private void ControllerInspectors(FootTarget footTarget) {
|
||||
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
||||
if (showControllers) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
foreach (TargetProps props in allProps)
|
||||
props.Inspector();
|
||||
|
||||
if (humanoid.animatorEnabled)
|
||||
footTarget.legAnimator.enabled = EditorGUILayout.ToggleLeft("Procedural Animation", footTarget.legAnimator.enabled, GUILayout.MinWidth(80));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Configuration
|
||||
private void InitConfiguration(FootTarget footTarget) {
|
||||
if (footTarget.humanoid.avatarRig == null)
|
||||
return;
|
||||
|
||||
InitUpperLegConfiguration(footTarget.upperLeg);
|
||||
InitLowerLegConfiguration(footTarget.lowerLeg);
|
||||
InitFootConfiguration(footTarget.foot);
|
||||
InitToesConfiguration(footTarget.toes);
|
||||
}
|
||||
|
||||
private static bool showConfiguration;
|
||||
private void ConfigurationInspector(FootTarget footTarget) {
|
||||
//if (!target.jointLimitations)
|
||||
// return;
|
||||
|
||||
footTarget.RetrieveBones();
|
||||
|
||||
showConfiguration = EditorGUILayout.Foldout(showConfiguration, "Configuration", true);
|
||||
if (showConfiguration) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
UpperLegConfigurationInspector(ref footTarget.upperLeg, footTarget.isLeft);
|
||||
LowerLegConfigurationInspector(ref footTarget.lowerLeg, footTarget.isLeft);
|
||||
FootConfigurationInspector(ref footTarget.foot, footTarget.isLeft);
|
||||
ToesConfigurationInspector(ref footTarget.toes, footTarget.isLeft);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBones(FootTarget target) {
|
||||
if (target.humanoid.avatarRig == null)
|
||||
return;
|
||||
|
||||
UpdateUpperLegBones(target.upperLeg);
|
||||
UpdateLowerLegBones(target.lowerLeg);
|
||||
UpdateFootBones(target.foot);
|
||||
UpdateToesBones(target.toes);
|
||||
}
|
||||
|
||||
#region UpperLeg
|
||||
//private string upperLegXname;
|
||||
//private SerializedProperty upperLegMinX;
|
||||
//private SerializedProperty upperLegMaxX;
|
||||
|
||||
//private string upperLegYname;
|
||||
//private SerializedProperty upperLegMinY;
|
||||
//private SerializedProperty upperLegMaxY;
|
||||
|
||||
//private string upperLegZname;
|
||||
//private SerializedProperty upperLegMinZ;
|
||||
//private SerializedProperty upperLegMaxZ;
|
||||
|
||||
private void InitUpperLegConfiguration(FootTarget.TargetedUpperLegBone upperLeg) {
|
||||
//if (upperLeg.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//upperLegXname = upperLeg.bone.transform.name + "X";
|
||||
//upperLegMinX = serializedObject.FindProperty("upperLeg.bone.minAngles.x");
|
||||
//upperLegMaxX = serializedObject.FindProperty("upperLeg.bone.maxAngles.x");
|
||||
|
||||
//upperLegYname = upperLeg.bone.transform.name + "Y";
|
||||
//upperLegMinY = serializedObject.FindProperty("upperLeg.bone.minAngles.y");
|
||||
//upperLegMaxY = serializedObject.FindProperty("upperLeg.bone.maxAngles.y");
|
||||
|
||||
//upperLegZname = upperLeg.bone.transform.name + "Z";
|
||||
//upperLegMinZ = serializedObject.FindProperty("upperLeg.bone.minAngles.z");
|
||||
//upperLegMaxZ = serializedObject.FindProperty("upperLeg.bone.maxAngles.z");
|
||||
}
|
||||
|
||||
private void UpperLegConfigurationInspector(ref FootTarget.TargetedUpperLegBone upperLeg, bool isLeft) {
|
||||
if (upperLeg.bone.transform != null)
|
||||
GUI.SetNextControlName(upperLeg.bone.transform.name + "00");
|
||||
upperLeg.bone.transform = (Transform)EditorGUILayout.ObjectField("Upper Leg Bone", upperLeg.bone.transform, typeof(Transform), true);
|
||||
if (upperLeg.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
upperLeg.bone.jointLimitations = EditorGUILayout.Toggle("Joint Limitations", upperLeg.bone.jointLimitations);
|
||||
if (upperLeg.bone.jointLimitations) {
|
||||
upperLeg.bone.maxAngle = EditorGUILayout.Slider("Max Angle", upperLeg.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//upperLeg.bone.maxAngle = EditorGUILayout.Slider("Max Angle", upperLeg.bone.maxAngle, 0, 180);
|
||||
//if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
// upperLeg.bone.maxAngle = FootTarget.maxUpperLegAngle;
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
//if (isLeft) {
|
||||
// Target_Editor.BoneAngleInspector(upperLegMinX, upperLegMaxX, FootTarget.minLeftUpperLegAngles.x, FootTarget.maxLeftUpperLegAngles.x, upperLegXname, "X Limits");
|
||||
// Target_Editor.BoneAngleInspector(upperLegMinY, upperLegMaxY, FootTarget.minLeftUpperLegAngles.y, FootTarget.maxLeftUpperLegAngles.y, upperLegYname, "Y Limits");
|
||||
// Target_Editor.BoneAngleInspector(upperLegMinZ, upperLegMaxZ, FootTarget.minLeftUpperLegAngles.z, FootTarget.maxLeftUpperLegAngles.z, upperLegZname, "Z Limits");
|
||||
//} else {
|
||||
// Target_Editor.BoneAngleInspector(upperLegMinX, upperLegMaxX, FootTarget.minRightUpperLegAngles.x, FootTarget.maxRightUpperLegAngles.x, upperLegXname, "X Limits");
|
||||
// Target_Editor.BoneAngleInspector(upperLegMinY, upperLegMaxY, FootTarget.minRightUpperLegAngles.y, FootTarget.maxRightUpperLegAngles.y, upperLegYname, "Y Limits");
|
||||
// Target_Editor.BoneAngleInspector(upperLegMinZ, upperLegMaxZ, FootTarget.minRightUpperLegAngles.z, FootTarget.maxRightUpperLegAngles.z, upperLegZname, "Z Limits");
|
||||
//}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateUpperLegBones(FootTarget.TargetedUpperLegBone upperLeg) {
|
||||
//if (upperLeg.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//upperLeg.bone.minAngles.x = upperLegMinX.floatValue;
|
||||
//upperLeg.bone.maxAngles.x = upperLegMaxX.floatValue;
|
||||
|
||||
//upperLeg.bone.minAngles.y = upperLegMinY.floatValue;
|
||||
//upperLeg.bone.maxAngles.y = upperLegMaxY.floatValue;
|
||||
|
||||
//upperLeg.bone.minAngles.z = upperLegMinZ.floatValue;
|
||||
//upperLeg.bone.maxAngles.z = upperLegMaxZ.floatValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LowerLeg
|
||||
//private string lowerLegYname;
|
||||
//private SerializedProperty lowerLegMinX;
|
||||
//private SerializedProperty lowerLegMaxX;
|
||||
|
||||
private void InitLowerLegConfiguration(FootTarget.TargetedLowerLegBone lowerLeg) {
|
||||
//if (lowerLeg.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//lowerLegYname = lowerLeg.bone.transform.name + "X";
|
||||
//lowerLegMinX = serializedObject.FindProperty("lowerLeg.bone.minAngles.x");
|
||||
//lowerLegMaxX = serializedObject.FindProperty("lowerLeg.bone.maxAngles.x");
|
||||
}
|
||||
|
||||
private void LowerLegConfigurationInspector(ref FootTarget.TargetedLowerLegBone lowerLeg, bool isLeft) {
|
||||
if (lowerLeg.bone.transform != null)
|
||||
GUI.SetNextControlName(lowerLeg.bone.transform.name + "00");
|
||||
lowerLeg.bone.transform = (Transform)EditorGUILayout.ObjectField("Lower Leg Bone", lowerLeg.bone.transform, typeof(Transform), true);
|
||||
if (lowerLeg.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
lowerLeg.bone.jointLimitations = EditorGUILayout.Toggle("Joint Limitations", lowerLeg.bone.jointLimitations);
|
||||
if (lowerLeg.bone.jointLimitations) {
|
||||
lowerLeg.bone.maxAngle = EditorGUILayout.Slider("Max Angle", lowerLeg.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//lowerLeg.bone.maxAngle = EditorGUILayout.Slider("Max Angle", lowerLeg.bone.maxAngle, 0, 180);
|
||||
//if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
// lowerLeg.bone.maxAngle = FootTarget.maxLowerLegAngle;
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
//if (isLeft)
|
||||
// Target_Editor.BoneAngleInspector(lowerLegMinX, lowerLegMaxX, FootTarget.minLeftLowerLegAngles.x, FootTarget.maxLeftLowerLegAngles.x, lowerLegYname, "X Limits");
|
||||
//else
|
||||
// Target_Editor.BoneAngleInspector(lowerLegMinX, lowerLegMaxX, FootTarget.minRightLowerLegAngles.x, FootTarget.maxRightLowerLegAngles.x, lowerLegYname, "X Limits");
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateLowerLegBones(FootTarget.TargetedLowerLegBone lowerLeg) {
|
||||
//if (lowerLeg.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//lowerLeg.bone.minAngles.x = lowerLegMinX.floatValue;
|
||||
//lowerLeg.bone.maxAngles.x = lowerLegMaxX.floatValue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Foot
|
||||
//private string footXname;
|
||||
//private SerializedProperty footMinX;
|
||||
//private SerializedProperty footMaxX;
|
||||
|
||||
//private string footZname;
|
||||
//private SerializedProperty footMinZ;
|
||||
//private SerializedProperty footMaxZ;
|
||||
|
||||
private void InitFootConfiguration(FootTarget.TargetedFootBone foot) {
|
||||
//if (foot.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//footXname = foot.bone.transform.name + "X";
|
||||
//footMinX = serializedObject.FindProperty("foot.bone.minAngles.x");
|
||||
//footMaxX = serializedObject.FindProperty("foot.bone.maxAngles.x");
|
||||
|
||||
//footZname = foot.bone.transform.name + "Z";
|
||||
//footMinZ = serializedObject.FindProperty("foot.bone.minAngles.z");
|
||||
//footMaxZ = serializedObject.FindProperty("foot.bone.maxAngles.z");
|
||||
}
|
||||
|
||||
private void FootConfigurationInspector(ref FootTarget.TargetedFootBone foot, bool isLeft) {
|
||||
if (foot.bone.transform != null)
|
||||
GUI.SetNextControlName(foot.bone.transform.name + "00");
|
||||
foot.bone.transform = (Transform)EditorGUILayout.ObjectField("Foot Bone", foot.bone.transform, typeof(Transform), true);
|
||||
if (foot.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
foot.bone.jointLimitations = EditorGUILayout.Toggle("Joint Limitations", foot.bone.jointLimitations);
|
||||
if (foot.bone.jointLimitations) {
|
||||
foot.bone.maxAngle = EditorGUILayout.Slider("Max Angle", foot.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//foot.bone.maxAngle = EditorGUILayout.Slider("Max Angle", foot.bone.maxAngle, 0, 180);
|
||||
//if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
// foot.bone.maxAngle = FootTarget.maxFootAngle;
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
//if (isLeft) {
|
||||
// Target_Editor.BoneAngleInspector(footMinX, footMaxX, FootTarget.minLeftFootAngles.x, FootTarget.maxLeftFootAngles.x, footXname, "X Limits");
|
||||
// Target_Editor.BoneAngleInspector(footMinZ, footMaxZ, FootTarget.minLeftFootAngles.z, FootTarget.maxLeftFootAngles.z, footZname, "Z Limits");
|
||||
//} else {
|
||||
// Target_Editor.BoneAngleInspector(footMinX, footMaxX, FootTarget.minRightFootAngles.x, FootTarget.maxRightFootAngles.x, footXname, "X Limits");
|
||||
// Target_Editor.BoneAngleInspector(footMinZ, footMaxZ, FootTarget.minRightFootAngles.z, FootTarget.maxRightFootAngles.z, footZname, "Z Limtis");
|
||||
//}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFootBones(FootTarget.TargetedFootBone foot) {
|
||||
//if (foot.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//foot.bone.minAngles.x = footMinX.floatValue;
|
||||
//foot.bone.maxAngles.x = footMaxX.floatValue;
|
||||
|
||||
//foot.bone.minAngles.z = footMinZ.floatValue;
|
||||
//foot.bone.maxAngles.z = footMaxZ.floatValue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Toes
|
||||
//private string toesXname;
|
||||
//private SerializedProperty toesMinX;
|
||||
//private SerializedProperty toesMaxX;
|
||||
|
||||
private void InitToesConfiguration(FootTarget.TargetedToesBone toes) {
|
||||
//if (toes.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//toesXname = toes.bone.transform.name + "X";
|
||||
//toesMinX = serializedObject.FindProperty("toes.bone.minAngles.x");
|
||||
//toesMaxX = serializedObject.FindProperty("toes.bone.maxAngles.x");
|
||||
}
|
||||
|
||||
private void ToesConfigurationInspector(ref FootTarget.TargetedToesBone toes, bool isLeft) {
|
||||
if (toes.bone.transform != null)
|
||||
GUI.SetNextControlName(toes.bone.transform.name + "00");
|
||||
toes.bone.transform = (Transform)EditorGUILayout.ObjectField("Toes Bone", toes.bone.transform, typeof(Transform), true);
|
||||
if (toes.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
toes.bone.jointLimitations = EditorGUILayout.Toggle("Joint Limitations", toes.bone.jointLimitations);
|
||||
if (toes.bone.jointLimitations) {
|
||||
toes.bone.maxAngle = EditorGUILayout.Slider("Max Angle", toes.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//toes.bone.maxAngle = EditorGUILayout.Slider("Max Angle", toes.bone.maxAngle, 0, 180);
|
||||
//if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
// toes.bone.maxAngle = FootTarget.maxToesAngle;
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
//if (isLeft)
|
||||
// Target_Editor.BoneAngleInspector(toesMinX, toesMaxX, FootTarget.minLeftToesAngles.x, FootTarget.maxLeftToesAngles.x, toesXname, "X Limits");
|
||||
//else
|
||||
// Target_Editor.BoneAngleInspector(toesMinX, toesMaxX, FootTarget.minRightToesAngles.x, FootTarget.maxRightToesAngles.x, toesXname, "X Limits");
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateToesBones(FootTarget.TargetedToesBone toes) {
|
||||
//if (toes.bone.transform == null)
|
||||
// return;
|
||||
|
||||
//toes.bone.minAngles.x = toesMinX.floatValue;
|
||||
//toes.bone.maxAngles.x = toesMaxX.floatValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
private SerializedProperty rotationSpeedLimitationProp;
|
||||
private SerializedProperty slidePreventionProp;
|
||||
|
||||
private void InitSettings() {
|
||||
rotationSpeedLimitationProp = serializedObject.FindProperty("rotationSpeedLimitation");
|
||||
slidePreventionProp = serializedObject.FindProperty("slidePrevention");
|
||||
}
|
||||
|
||||
private static bool showSettings;
|
||||
private void SettingsInspector(FootTarget footTarget) {
|
||||
showSettings = EditorGUILayout.Foldout(showSettings, "Settings", true);
|
||||
if (showSettings) {
|
||||
EditorGUI.indentLevel++;
|
||||
//footTarget.jointLimitations = EditorGUILayout.Toggle("Joint Limitations", footTarget.jointLimitations);
|
||||
bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", footTarget.showRealObjects);
|
||||
if (showRealObjects != footTarget.showRealObjects) {
|
||||
footTarget.ShowControllers(showRealObjects);
|
||||
footTarget.showRealObjects = showRealObjects;
|
||||
}
|
||||
rotationSpeedLimitationProp.boolValue = EditorGUILayout.Toggle("Rotation Speed Limitation", rotationSpeedLimitationProp.boolValue);
|
||||
slidePreventionProp.boolValue = EditorGUILayout.Toggle("Slide Prevention", slidePreventionProp.boolValue);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
protected SerializedProperty groundEventProp;
|
||||
|
||||
protected virtual void InitEvents() {
|
||||
groundEventProp = serializedObject.FindProperty("groundEvent");
|
||||
}
|
||||
|
||||
protected int selectedEventSource = -1;
|
||||
protected int selectedEvent;
|
||||
|
||||
protected bool showEvents;
|
||||
protected virtual void EventsInspector() {
|
||||
showEvents = EditorGUILayout.Foldout(showEvents, "Events", true);
|
||||
if (showEvents) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
GameObjectEvent_Editor.EventInspector(groundEventProp, footTarget.groundEvent, ref selectedEventSource, ref selectedEvent);
|
||||
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
|
||||
////Labels
|
||||
//EditorGUILayout.BeginVertical(GUILayout.MinWidth(110));
|
||||
|
||||
//GUILayout.Space(3);
|
||||
//EditorGUILayout.LabelField("Ground", GUILayout.Width(110));
|
||||
|
||||
//EditorGUILayout.EndVertical();
|
||||
|
||||
//// Buttons
|
||||
//string[] buttonTexts = new string[1];
|
||||
//buttonTexts[0] = Event.GetInputButtonLabel(footTarget.groundEvent.gameObjectEvent);
|
||||
|
||||
//int oldFontSize = GUI.skin.button.fontSize;
|
||||
//GUI.skin.button.fontSize = 9;
|
||||
//selectedEventSource = GUILayout.SelectionGrid(selectedEventSource, buttonTexts, 1);
|
||||
//GUI.skin.button.fontSize = oldFontSize;
|
||||
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
//// Details
|
||||
//GUIStyle style = new GUIStyle(GUI.skin.label) {
|
||||
// fontStyle = FontStyle.Bold
|
||||
//};
|
||||
//EditorGUILayout.LabelField("Details", style, GUILayout.ExpandWidth(true));
|
||||
|
||||
//EditorGUI.indentLevel++;
|
||||
//EventDetails(selectedEventSource);
|
||||
//EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
//protected void EventDetails(int selectedInputEvent) {
|
||||
// switch (selectedInputEvent) {
|
||||
// case 0:
|
||||
// GameObjectEvent_Editor.DetailsInspector(groundEventProp, "Ground");
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Scene
|
||||
|
||||
public void OnSceneGUI() {
|
||||
if (footTarget == null || humanoid == null)
|
||||
return;
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
|
||||
if (humanoid.pose != null) {
|
||||
if (humanoid.editPose)
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
footTarget.CopyRigToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current foot target
|
||||
footTarget.CopyTargetToRig();
|
||||
// update the avatar bones from the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
// and update all target to match the target rig
|
||||
humanoid.CopyRigToTargets();
|
||||
|
||||
// Update the sensors to match the updated targets
|
||||
humanoid.UpdateSensorsFromTargets();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
public FootTarget footTarget;
|
||||
public LegSensor sensor;
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, LegSensor _sensor, FootTarget _footTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
footTarget = _footTarget;
|
||||
sensor = _sensor;
|
||||
|
||||
sensor.Init(footTarget);
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
if (sensor.sensorTransform == null)
|
||||
return;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac547295e0b7c04409774d0b733e940b
|
||||
timeCreated: 1462298140
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,759 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Tracking;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(HandTarget), true)]
|
||||
public class HandTarget_Editor : Editor {
|
||||
private HandTarget handTarget;
|
||||
private Passer.Humanoid.HumanoidControl humanoid;
|
||||
|
||||
private TargetProps[] allProps;
|
||||
|
||||
#region Enable
|
||||
|
||||
public void OnEnable() {
|
||||
handTarget = (HandTarget)target;
|
||||
|
||||
if (handTarget.humanoid == null)
|
||||
handTarget.humanoid = GetHumanoid(handTarget);
|
||||
humanoid = handTarget.humanoid;
|
||||
if (humanoid == null)
|
||||
return;
|
||||
|
||||
humanoid.InitTargets();
|
||||
|
||||
InitEditors();
|
||||
|
||||
handTarget.InitTarget();
|
||||
|
||||
InitConfiguration(handTarget);
|
||||
InitSettings();
|
||||
InitEvents();
|
||||
|
||||
InitHandPose(handTarget);
|
||||
|
||||
if (!Application.isPlaying)
|
||||
SetSensor2Target();
|
||||
}
|
||||
|
||||
private void InitEditors() {
|
||||
allProps = new TargetProps[] {
|
||||
#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),
|
||||
#endif
|
||||
#endif
|
||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
||||
// new Oculus_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
//#endif
|
||||
#if hWINDOWSMR && UNITY_WSA_10_0
|
||||
new WindowsMR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#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
|
||||
#if hHYDRA
|
||||
new Hydra_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hKINECT1
|
||||
new Kinect1_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hKINECT2
|
||||
new Kinect2_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hKINECT4
|
||||
new Kinect4_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hORBBEC
|
||||
new Astra_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hANTILATENCY
|
||||
new Antilatency_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hHI5
|
||||
new Hi5_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hCUSTOM
|
||||
new Custom_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
public void OnDisable() {
|
||||
if (humanoid == null) {
|
||||
// This target is not connected to a humanoid, so we delete it
|
||||
DestroyImmediate(handTarget, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
SetSensor2Target();
|
||||
}
|
||||
|
||||
handTarget.poseMixer.Cleanup();
|
||||
if (!Application.isPlaying)
|
||||
handTarget.poseMixer.ShowPose(humanoid, handTarget.isLeft ? Side.Left : Side.Right);
|
||||
handTarget.UpdateMovements(humanoid);
|
||||
}
|
||||
|
||||
private void SetSensor2Target() {
|
||||
foreach (TargetProps props in allProps)
|
||||
props.SetSensor2Target();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
if (handTarget == null || humanoid == null)
|
||||
return;
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
ControllerInspectors(handTarget);
|
||||
if (humanoid != null) {
|
||||
SubTargetsInspector(handTarget);
|
||||
ConfigurationInspector(handTarget);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
HandPoseInspector(handTarget);
|
||||
serializedObject.Update();
|
||||
}
|
||||
SettingsInspector(handTarget);
|
||||
|
||||
TouchedObjectInspector(handTarget);
|
||||
GrabbedObjectInspector(handTarget);
|
||||
|
||||
EventsInspector();
|
||||
|
||||
InteractionPointerButton(handTarget);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
//serializedObject.Update();
|
||||
//serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
public static HandTarget Inspector(HandTarget handTarget, string name) {
|
||||
if (handTarget == null)
|
||||
return handTarget;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
Transform defaultTargetTransform = handTarget.GetDefaultTarget(handTarget.humanoid);
|
||||
Transform targetTransform = handTarget.transform ?? defaultTargetTransform;
|
||||
|
||||
GUIContent text = new GUIContent(
|
||||
name,
|
||||
"The transform controlling the " + name
|
||||
);
|
||||
targetTransform = (Transform)EditorGUILayout.ObjectField(text, targetTransform, typeof(Transform), true);
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
if (targetTransform == defaultTargetTransform && GUILayout.Button("Show", GUILayout.MaxWidth(60))) {
|
||||
// Call static method CreateTarget on target
|
||||
handTarget = (HandTarget)handTarget.GetType().GetMethod("CreateTarget").Invoke(null, new object[] { handTarget });
|
||||
}
|
||||
else if (targetTransform != handTarget.transform) {
|
||||
handTarget = (HandTarget)handTarget.GetType().GetMethod("SetTarget").Invoke(null, new object[] { handTarget.humanoid, targetTransform, handTarget.isLeft });
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return handTarget;
|
||||
}
|
||||
|
||||
public static HumanoidControl GetHumanoid(HumanoidTarget target) {
|
||||
HumanoidControl foundHumanoid = target.transform.GetComponentInParent<HumanoidControl>();
|
||||
if (foundHumanoid != null)
|
||||
return foundHumanoid;
|
||||
|
||||
HumanoidControl[] humanoids = GameObject.FindObjectsOfType<HumanoidControl>();
|
||||
|
||||
for (int i = 0; i < humanoids.Length; i++)
|
||||
if (humanoids[i].leftHandTarget.transform == target.transform ||
|
||||
humanoids[i].rightHandTarget.transform == target.transform)
|
||||
foundHumanoid = humanoids[i];
|
||||
|
||||
return foundHumanoid;
|
||||
}
|
||||
|
||||
#region Sensors
|
||||
|
||||
public bool showControllers = true;
|
||||
private void ControllerInspectors(HandTarget handTarget) {
|
||||
showControllers = EditorGUILayout.Foldout(showControllers, "Sensors/Controllers", true);
|
||||
if (showControllers) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
foreach (TargetProps props in allProps)
|
||||
props.Inspector();
|
||||
|
||||
if (humanoid != null && humanoid.animatorEnabled)
|
||||
handTarget.armAnimator.enabled = EditorGUILayout.ToggleLeft("Procedural animation", handTarget.armAnimator.enabled, GUILayout.MinWidth(80));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Morph Targets
|
||||
|
||||
//float thumbCurl = 0;
|
||||
|
||||
|
||||
private bool showSubTargets;
|
||||
private void SubTargetsInspector(HandTarget handTarget) {
|
||||
showSubTargets = EditorGUILayout.Foldout(showSubTargets, "Sub Targets", true);
|
||||
if (showSubTargets) {
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
float thumbCurl = handTarget.fingers.thumb.CalculateCurl();
|
||||
EditorGUILayout.Slider("Thumb Curl", thumbCurl, -0.5F, 1);
|
||||
float indexCurl = handTarget.fingers.index.CalculateCurl();
|
||||
EditorGUILayout.Slider("Index Finger Curl", indexCurl, -0.1F, 1);
|
||||
float middleCurl = handTarget.fingers.middle.CalculateCurl();
|
||||
EditorGUILayout.Slider("Middle Finger Curl", middleCurl, -0.1F, 1);
|
||||
float ringCurl = handTarget.fingers.ring.CalculateCurl();
|
||||
EditorGUILayout.Slider("Ring Finger Curl", ringCurl, -0.1F, 1);
|
||||
float littleCurl = handTarget.fingers.little.CalculateCurl();
|
||||
EditorGUILayout.Slider("Little Finger Curl", littleCurl, -0.1F, 1);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Configuration
|
||||
private void InitConfiguration(HandTarget handTarget) {
|
||||
InitShoulderConfiguration(handTarget.shoulder);
|
||||
InitUpperArmConfiguration(handTarget.upperArm);
|
||||
InitForearmConfiguration(handTarget.forearm);
|
||||
InitHandConfiguration(handTarget.hand);
|
||||
}
|
||||
|
||||
private bool showConfiguration;
|
||||
private bool showFingerConfiguration;
|
||||
private void ConfigurationInspector(HandTarget handTarget) {
|
||||
//if (!target.jointLimitations)
|
||||
//return;
|
||||
|
||||
//handTarget.RetrieveBones();
|
||||
|
||||
showConfiguration = EditorGUILayout.Foldout(showConfiguration, "Configuration", true);
|
||||
if (showConfiguration) {
|
||||
EditorGUI.indentLevel++;
|
||||
ShoulderConfigurationInspector(ref handTarget.shoulder, handTarget.isLeft);
|
||||
UpperArmConfigurationInspector(ref handTarget.upperArm, handTarget.isLeft);
|
||||
ForearmConfigurationInspector(ref handTarget.forearm, handTarget.isLeft);
|
||||
HandConfigurationInspector(ref handTarget.hand, handTarget.isLeft);
|
||||
showFingerConfiguration = EditorGUILayout.Foldout(showFingerConfiguration, "Fingers", true);
|
||||
if (showFingerConfiguration) {
|
||||
EditorGUI.indentLevel++;
|
||||
FingersConfigurationInspector(handTarget);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#region Shoulder
|
||||
private SerializedProperty shoulderArmJointLimitations;
|
||||
private SerializedProperty shoulderArmLimitationAngle;
|
||||
|
||||
private void InitShoulderConfiguration(HandTarget.TargetedShoulderBone shoulder) {
|
||||
shoulderArmJointLimitations = serializedObject.FindProperty("shoulder.bone.jointLimitations");
|
||||
shoulderArmLimitationAngle = serializedObject.FindProperty("shoulder.bone.maxAngle");
|
||||
}
|
||||
|
||||
private void ShoulderConfigurationInspector(ref HandTarget.TargetedShoulderBone shoulder, bool isLeft) {
|
||||
if (shoulder.bone.transform != null)
|
||||
GUI.SetNextControlName(shoulder.bone.transform.name + "00");
|
||||
shoulder.bone.transform = (Transform)EditorGUILayout.ObjectField("Shoulder Bone", shoulder.bone.transform, typeof(Transform), true);
|
||||
if (shoulder.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
shoulderArmJointLimitations.boolValue = EditorGUILayout.Toggle("Joint Limitations", shoulder.bone.jointLimitations);
|
||||
if (shoulder.bone.jointLimitations) {
|
||||
shoulderArmLimitationAngle.floatValue = EditorGUILayout.Slider("Max Angle", shoulder.bone.maxAngle, 0, 180);
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateShoulderBones(HandTarget.TargetedShoulderBone shoulder) {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UpperArm
|
||||
private SerializedProperty upperArmJointLimitations;
|
||||
private SerializedProperty upperArmLimitationAngle;
|
||||
|
||||
private void InitUpperArmConfiguration(HandTarget.TargetedUpperArmBone upperArm) {
|
||||
upperArmJointLimitations = serializedObject.FindProperty("upperArm.bone.jointLimitations");
|
||||
upperArmLimitationAngle = serializedObject.FindProperty("upperArm.bone.maxAngle");
|
||||
}
|
||||
|
||||
private void UpperArmConfigurationInspector(ref HandTarget.TargetedUpperArmBone upperArm, bool isLeft) {
|
||||
if (upperArm.bone.transform != null)
|
||||
GUI.SetNextControlName(upperArm.bone.transform.name + "00");
|
||||
upperArm.bone.transform = (Transform)EditorGUILayout.ObjectField("Upper Arm Bone", upperArm.bone.transform, typeof(Transform), true);
|
||||
if (upperArm.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
upperArmJointLimitations.boolValue = EditorGUILayout.Toggle("Joint Limitations", upperArm.bone.jointLimitations);
|
||||
if (upperArm.bone.jointLimitations) {
|
||||
upperArmLimitationAngle.floatValue = EditorGUILayout.Slider("Max Angle", upperArm.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateUpperArmBones(HandTarget.TargetedUpperArmBone upperArm) {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Forearm
|
||||
private SerializedProperty forearmJointLimitations;
|
||||
private SerializedProperty forearmLimitationAngle;
|
||||
|
||||
private void InitForearmConfiguration(HandTarget.TargetedForearmBone forearm) {
|
||||
forearmJointLimitations = serializedObject.FindProperty("forearm.bone.jointLimitations");
|
||||
forearmLimitationAngle = serializedObject.FindProperty("forearm.bone.maxAngle");
|
||||
}
|
||||
|
||||
private void ForearmConfigurationInspector(ref HandTarget.TargetedForearmBone forearm, bool isLeft) {
|
||||
if (forearm.bone.transform != null)
|
||||
GUI.SetNextControlName(forearm.bone.transform.name + "00");
|
||||
forearm.bone.transform = (Transform)EditorGUILayout.ObjectField("Forearm Bone", forearm.bone.transform, typeof(Transform), true);
|
||||
if (forearm.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
forearmJointLimitations.boolValue = EditorGUILayout.Toggle("Joint Limitations", forearm.bone.jointLimitations);
|
||||
if (forearm.bone.jointLimitations) {
|
||||
forearmLimitationAngle.floatValue = EditorGUILayout.Slider("Max Angle", forearm.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateForearmBones(HandTarget.TargetedForearmBone forearm) {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Hand
|
||||
private SerializedProperty handJointLimitations;
|
||||
private SerializedProperty handLimitationAngle;
|
||||
|
||||
private void InitHandConfiguration(HandTarget.TargetedHandBone hand) {
|
||||
handJointLimitations = serializedObject.FindProperty("hand.bone.jointLimitations");
|
||||
handLimitationAngle = serializedObject.FindProperty("hand.bone.maxAngle");
|
||||
}
|
||||
|
||||
|
||||
private void HandConfigurationInspector(ref HandTarget.TargetedHandBone hand, bool isLeft) {
|
||||
hand.bone.transform = (Transform)EditorGUILayout.ObjectField("Hand Bone", hand.bone.transform, typeof(Transform), true);
|
||||
if (hand.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
handJointLimitations.boolValue = EditorGUILayout.Toggle("Joint Limitations", hand.bone.jointLimitations);
|
||||
if (hand.bone.jointLimitations) {
|
||||
handLimitationAngle.floatValue = EditorGUILayout.Slider("Max Angle", hand.bone.maxAngle, 0, 180);
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fingers
|
||||
SerializedProperty proximalMinX;
|
||||
SerializedProperty proximalMaxX;
|
||||
private void InitFingerConfiguration(FingersTarget fingers) {
|
||||
}
|
||||
|
||||
private void FingersConfigurationInspector(HandTarget handTarget) {
|
||||
FingerConfigurationInspector(handTarget, handTarget.fingers.thumb, 0, "Proximal Thumb Bone");
|
||||
FingerConfigurationInspector(handTarget, handTarget.fingers.index, 1, "Proximal Index Bone");
|
||||
FingerConfigurationInspector(handTarget, handTarget.fingers.middle, 2, "Proximal Middle Bone");
|
||||
FingerConfigurationInspector(handTarget, handTarget.fingers.ring, 3, "Proximal Ring Bone");
|
||||
FingerConfigurationInspector(handTarget, handTarget.fingers.little, 4, "Proximal Little Bone");
|
||||
}
|
||||
|
||||
private void FingerConfigurationInspector(HandTarget handTarget, FingersTarget.TargetedFinger digit, int fingerIndex, string label) {
|
||||
Transform proximalBone = (Transform)EditorGUILayout.ObjectField(label, digit.proximal.bone.transform, typeof(Transform), true);
|
||||
if (proximalBone == null || proximalBone != digit.proximal.bone.transform) {
|
||||
if (proximalBone == null)
|
||||
proximalBone = FingersTarget.GetFingerBone(handTarget, (Finger)fingerIndex, Humanoid.Tracking.FingerBones.Proximal);
|
||||
if (proximalBone != null && proximalBone.childCount == 1) {
|
||||
digit.intermediate.bone.transform = proximalBone.GetChild(0);
|
||||
if (digit.intermediate.bone.transform != null && digit.intermediate.bone.transform.childCount == 1)
|
||||
digit.distal.bone.transform = digit.intermediate.bone.transform.GetChild(0);
|
||||
else
|
||||
digit.distal.bone.transform = null;
|
||||
}
|
||||
else
|
||||
digit.intermediate.bone.transform = null;
|
||||
}
|
||||
digit.proximal.bone.transform = proximalBone;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
|
||||
private SerializedProperty physicsProp;
|
||||
private SerializedProperty rotationSpeedLimitationProp;
|
||||
private SerializedProperty touchInteractionProp;
|
||||
|
||||
private void InitSettings() {
|
||||
// Cannot use serializedPropery because showRealObjects is a getter/setter
|
||||
//showRealObjectsProp = serializedObject.FindProperty("showRealObjects");
|
||||
|
||||
physicsProp = serializedObject.FindProperty("physics");
|
||||
rotationSpeedLimitationProp = serializedObject.FindProperty("rotationSpeedLimitation");
|
||||
touchInteractionProp = serializedObject.FindProperty("touchInteraction");
|
||||
}
|
||||
|
||||
public bool showSettings;
|
||||
private void SettingsInspector(HandTarget handTarget) {
|
||||
showSettings = EditorGUILayout.Foldout(showSettings, "Settings", true);
|
||||
if (showSettings) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
rotationSpeedLimitationProp.boolValue = EditorGUILayout.Toggle("Rotation Speed Limitation", rotationSpeedLimitationProp.boolValue);
|
||||
handTarget.rotationSpeedLimitation = rotationSpeedLimitationProp.boolValue;
|
||||
|
||||
touchInteractionProp.boolValue = EditorGUILayout.Toggle("Touch Interaction", touchInteractionProp.boolValue);
|
||||
handTarget.touchInteraction = touchInteractionProp.boolValue;
|
||||
|
||||
physicsProp.boolValue = EditorGUILayout.Toggle("Physics", physicsProp.boolValue);
|
||||
handTarget.physics = physicsProp.boolValue;
|
||||
if (handTarget.humanoid.physics) {
|
||||
handTarget.strength = EditorGUILayout.FloatField("Strength", handTarget.strength);
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HandPose
|
||||
|
||||
public static BonePose selectedBone = null;
|
||||
private string[] poseNames;
|
||||
|
||||
private void InitHandPose(HandTarget handTarget) {
|
||||
}
|
||||
|
||||
private bool showHandPoses = false;
|
||||
private void HandPoseInspector(HandTarget handTarget) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
showHandPoses = EditorGUILayout.Foldout(showHandPoses, "Hand Pose", true);
|
||||
|
||||
GetPoseNames();
|
||||
EditorGUILayout.BeginHorizontal(GUILayout.Width(300));
|
||||
|
||||
if (handTarget.poseMixer.poseMode == PoseMixer.PoseMode.Set) {
|
||||
handTarget.poseMixer.poseMode = (PoseMixer.PoseMode)EditorGUILayout.EnumPopup(handTarget.poseMixer.poseMode, GUILayout.Width(100));
|
||||
int poseIx = EditorGUILayout.Popup(handTarget.poseMixer.currentPoseIx, poseNames);
|
||||
if (poseIx != handTarget.poseMixer.currentPoseIx) {
|
||||
handTarget.poseMixer.currentPoseIx = poseIx;
|
||||
handTarget.poseMixer.SetPoseValue(poseIx);
|
||||
}
|
||||
}
|
||||
else if (Application.isPlaying) {
|
||||
handTarget.poseMixer.poseMode = (PoseMixer.PoseMode)EditorGUILayout.EnumPopup(handTarget.poseMixer.poseMode, GUILayout.Width(100));
|
||||
EditorGUILayout.ObjectField(handTarget.poseMixer.detectedPose, typeof(Pose), true);
|
||||
}
|
||||
else
|
||||
handTarget.poseMixer.poseMode = (PoseMixer.PoseMode)EditorGUILayout.EnumPopup(handTarget.poseMixer.poseMode, GUILayout.MinWidth(100));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (showHandPoses) {
|
||||
EditorGUI.indentLevel++;
|
||||
Pose_Editor.PoseMixerInspector(handTarget.poseMixer, humanoid, handTarget.side);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
handTarget.poseMixer.ShowPose(humanoid, handTarget.isLeft ? Side.Left : Side.Right);
|
||||
handTarget.UpdateMovements(humanoid);
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPoseNames() {
|
||||
poseNames = new string[handTarget.poseMixer.mixedPoses.Count];//.Length];
|
||||
for (int i = 0; i < poseNames.Length; i++) {
|
||||
if (handTarget.poseMixer.mixedPoses[i].pose == null)
|
||||
poseNames[i] = "";
|
||||
else
|
||||
poseNames[i] = handTarget.poseMixer.mixedPoses[i].pose.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
|
||||
private void TouchedObjectInspector(HandTarget handTarget) {
|
||||
handTarget.touchedObject = (GameObject)EditorGUILayout.ObjectField("Touched Object", handTarget.touchedObject, typeof(GameObject), true);
|
||||
}
|
||||
|
||||
private void GrabbedObjectInspector(HandTarget handTarget) {
|
||||
SerializedProperty grabbedObjectProp = serializedObject.FindProperty("grabbedObject");
|
||||
if (Application.isPlaying) {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.ObjectField("Grabbed Object", grabbedObjectProp.objectReferenceValue, typeof(GameObject), false);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
else {
|
||||
SerializedProperty grabbedPrefabProp = serializedObject.FindProperty("grabbedPrefab");
|
||||
GameObject grabbedPrefab = (GameObject)EditorGUILayout.ObjectField("Grabbed Prefab", grabbedPrefabProp.objectReferenceValue, typeof(GameObject), false);
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.ObjectField("Grabbed Object", grabbedObjectProp.objectReferenceValue, typeof(GameObject), false);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (grabbedPrefab != grabbedPrefabProp.objectReferenceValue) {
|
||||
if (grabbedPrefab != null)
|
||||
GrabPrefab(handTarget, grabbedObjectProp, grabbedPrefab);
|
||||
else {
|
||||
LetGoObject(handTarget, grabbedObjectProp);
|
||||
}
|
||||
}
|
||||
serializedObject.Update();
|
||||
grabbedPrefabProp.objectReferenceValue = grabbedPrefab;
|
||||
}
|
||||
}
|
||||
|
||||
private void GrabPrefab(HandTarget handTarget, SerializedProperty grabbedObjectProp, GameObject prefab) {
|
||||
if (grabbedObjectProp.objectReferenceValue != null)
|
||||
LetGoObject(handTarget, grabbedObjectProp);
|
||||
|
||||
GameObject obj = Instantiate(prefab, handTarget.transform.position, handTarget.transform.rotation);
|
||||
|
||||
//HandInteraction.NetworkedGrab(handTarget, obj, false);
|
||||
handTarget.Grab(obj, false);
|
||||
if (handTarget.grabbedObject == null)
|
||||
Debug.LogWarning("Could not grab object");
|
||||
else {
|
||||
grabbedObjectProp.objectReferenceValue = obj;
|
||||
Handle handle = handTarget.grabbedHandle;
|
||||
if (handle == null) {
|
||||
Handle.Create(obj, handTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LetGoObject(HandTarget handTarget, SerializedProperty grabbedObjectProp) {
|
||||
GameObject grabbedObject = (GameObject)grabbedObjectProp.objectReferenceValue;
|
||||
handTarget.LetGo();
|
||||
DestroyImmediate(grabbedObject, true);
|
||||
grabbedObjectProp.objectReferenceValue = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
protected SerializedProperty touchEventProp;
|
||||
protected SerializedProperty grabEventProp;
|
||||
protected SerializedProperty poseEventProp;
|
||||
|
||||
protected virtual void InitEvents() {
|
||||
touchEventProp = serializedObject.FindProperty("touchEvent");
|
||||
grabEventProp = serializedObject.FindProperty("grabEvent");
|
||||
poseEventProp = serializedObject.FindProperty("poseEvent");
|
||||
}
|
||||
|
||||
protected int selectedEvent = -1;
|
||||
protected int selectedSubEvent;
|
||||
|
||||
protected bool showEvents;
|
||||
protected virtual void EventsInspector() {
|
||||
showEvents = EditorGUILayout.Foldout(showEvents, "Events", true);
|
||||
if (showEvents) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
IntEvent_Editor.EventInspector(poseEventProp, handTarget.poseEvent, ref selectedEvent, ref selectedSubEvent);
|
||||
GameObjectEvent_Editor.EventInspector(touchEventProp, handTarget.touchEvent, ref selectedEvent, ref selectedSubEvent);
|
||||
GameObjectEvent_Editor.EventInspector(grabEventProp, handTarget.grabEvent, ref selectedEvent, ref selectedSubEvent);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Buttons
|
||||
|
||||
private void InteractionPointerButton(HandTarget handTarget) {
|
||||
InteractionPointer interactionPointer = handTarget.transform.GetComponentInChildren<InteractionPointer>();
|
||||
if (interactionPointer != null)
|
||||
return;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Add Interaction Pointer"))
|
||||
AddInteractionPointer();
|
||||
if (GUILayout.Button("Add Teleporter"))
|
||||
AddTeleporter();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private void AddInteractionPointer() {
|
||||
InteractionPointer pointer = InteractionPointer.Add(handTarget.transform, InteractionPointer.PointerType.Ray);
|
||||
if (handTarget.isLeft) {
|
||||
pointer.transform.localPosition = new Vector3(-0.21F, -0.02F, 0.01F);
|
||||
pointer.transform.localRotation = Quaternion.Euler(-180, 90, 180);
|
||||
}
|
||||
else {
|
||||
pointer.transform.localPosition = new Vector3(0.21F, -0.02F, 0.01F);
|
||||
pointer.transform.localRotation = Quaternion.Euler(-180, -90, -180);
|
||||
}
|
||||
pointer.active = false;
|
||||
|
||||
ControllerInput controllerInput = humanoid.GetComponent<ControllerInput>();
|
||||
if (controllerInput != null) {
|
||||
controllerInput.SetEventHandler(handTarget.isLeft, ControllerInput.SideButton.Button1, pointer.Activation);
|
||||
|
||||
controllerInput.SetEventHandler(handTarget.isLeft, ControllerInput.SideButton.Trigger1, pointer.Click);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTeleporter() {
|
||||
Teleporter teleporter = Teleporter.Add(handTarget.transform);
|
||||
if (handTarget.isLeft) {
|
||||
teleporter.transform.localPosition = new Vector3(-0.21F, -0.02F, 0.01F);
|
||||
teleporter.transform.localRotation = Quaternion.Euler(-180, 90, 180);
|
||||
}
|
||||
else {
|
||||
teleporter.transform.localPosition = new Vector3(0.21F, -0.02F, 0.01F);
|
||||
teleporter.transform.localRotation = Quaternion.Euler(-180, -90, -180);
|
||||
}
|
||||
|
||||
ControllerInput controllerInput = humanoid.GetComponent<ControllerInput>();
|
||||
if (controllerInput != null) {
|
||||
//ControllerEventHandlers button1Input = controllerInput.GetInputEvent(handTarget.isLeft, ControllerInput.SideButton.Button1);
|
||||
//ControllerEvent_Editor.SetBoolMethod(controllerInput.gameObject, button1Input, EventHandler.Type.OnChange, teleporter.Activation);
|
||||
//ControllerEvent_Editor.SetEventHandlerBool(button1Input, EventHandler.Type.OnChange, teleporter, "Activation");
|
||||
controllerInput.SetEventHandler(handTarget.isLeft, ControllerInput.SideButton.Button1, teleporter.Activation);
|
||||
|
||||
//ControllerEventHandlers trigger1Input = controllerInput.GetInputEvent(handTarget.isLeft, ControllerInput.SideButton.Trigger1);
|
||||
//ControllerEvent_Editor.SetBoolMethod(controllerInput.gameObject, trigger1Input, EventHandler.Type.OnChange, teleporter.Click);
|
||||
//ControllerEvent_Editor.SetEventHandlerBool(trigger1Input, EventHandler.Type.OnChange, teleporter, "Click");
|
||||
controllerInput.SetEventHandler(handTarget.isLeft, ControllerInput.SideButton.Trigger1, teleporter.Click);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Scene
|
||||
|
||||
protected void OnSceneGUI() {
|
||||
HandTarget handTarget = (HandTarget)target;
|
||||
if (humanoid == null)
|
||||
return;
|
||||
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
|
||||
Pose_Editor.UpdateScene(humanoid, handTarget.fingers, handTarget.poseMixer, ref selectedBone, handTarget.isLeft ? Side.Left : Side.Right);
|
||||
|
||||
handTarget.poseMixer.ShowPose(humanoid, handTarget.side);
|
||||
if (humanoid.pose != null) {
|
||||
if (humanoid.editPose)
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
handTarget.CopyRigToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current hand target
|
||||
handTarget.CopyTargetToRig();
|
||||
// update the avatar bones from the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
// and update all targets to match the target rig
|
||||
humanoid.CopyRigToTargets();
|
||||
|
||||
// Update the sensors to match the updated targets
|
||||
humanoid.UpdateSensorsFromTargets();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
public HandTarget handTarget;
|
||||
public Humanoid.ArmSensor sensor;
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, Humanoid.ArmSensor _sensor, HandTarget _handTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
handTarget = _handTarget;
|
||||
sensor = _sensor;
|
||||
|
||||
sensor.Init(handTarget);
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
sensor.SetSensor2Target();
|
||||
}
|
||||
|
||||
public abstract void Inspector();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 955a1901726a9264580f54fc555a0378
|
||||
timeCreated: 1459000174
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,542 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(HeadTarget), true)]
|
||||
public class HeadTarget_Editor : Editor {
|
||||
private HeadTarget headTarget;
|
||||
private HumanoidControl humanoid;
|
||||
|
||||
private TargetProps[] allProps;
|
||||
|
||||
#region Enable
|
||||
|
||||
public void OnEnable() {
|
||||
headTarget = (HeadTarget)target;
|
||||
|
||||
if (headTarget.humanoid == null)
|
||||
headTarget.humanoid = GetHumanoid(headTarget);
|
||||
humanoid = headTarget.humanoid;
|
||||
|
||||
InitEditors();
|
||||
|
||||
headTarget.InitSensors();
|
||||
InitSensors();
|
||||
#if hFACE
|
||||
FaceTarget_Editor.OnEnable(serializedObject, headTarget);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitEditors() {
|
||||
allProps = new TargetProps[] {
|
||||
#if pUNITYXR
|
||||
new UnityXR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
|
||||
#if hVIVETRACKER
|
||||
//new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#endif
|
||||
#if hWINDOWSMR && UNITY_WSA_10_0
|
||||
new WindowsMR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#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
|
||||
#if hKINECT1
|
||||
new Kinect1_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hKINECT2
|
||||
new Kinect2_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hKINECT4
|
||||
new Kinect4_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hORBBEC
|
||||
new Astra_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hTOBII
|
||||
new Tobii_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hARKIT
|
||||
new ArKit_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hDLIB
|
||||
new Dlib_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hPUPIL
|
||||
new Tracking.Pupil.Pupil_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hANTILATENCY
|
||||
new Antilatency_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hCUSTOM
|
||||
new Custom_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
public void OnDisable() {
|
||||
if (humanoid == null) {
|
||||
// This target is not connected to a humanoid, so we delete it
|
||||
DestroyImmediate(headTarget, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
SetSensor2Target();
|
||||
}
|
||||
|
||||
#if hFACE
|
||||
FaceTarget_Editor.OnDisable(serializedObject, headTarget);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void SetSensor2Target() {
|
||||
if (allProps != null)
|
||||
foreach (TargetProps props in allProps)
|
||||
props.SetSensor2Target();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
if (headTarget == null || humanoid == null)
|
||||
return;
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
SensorInspectors(headTarget);
|
||||
if (headTarget.humanoid != null) {
|
||||
#if hFACE
|
||||
SerializedProperty faceTargetProp = serializedObject.FindProperty("face");
|
||||
FaceTarget_Editor.OnInspectorGUI(faceTargetProp, headTarget);
|
||||
#endif
|
||||
ConfigurationInspector(headTarget);
|
||||
|
||||
#if hFACE
|
||||
FaceTarget_Editor.ExpressionsInspector(headTarget.face);
|
||||
#endif
|
||||
}
|
||||
|
||||
PoseInspector();
|
||||
SettingsInspector(headTarget);
|
||||
#if hFACE
|
||||
FaceTarget_Editor.FocusObjectInspector(headTarget.face);
|
||||
#endif
|
||||
EventsInspector();
|
||||
GazeInteractionButton(headTarget);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private static HumanoidControl GetHumanoid(HumanoidTarget target) {
|
||||
HumanoidControl foundHumanoid = target.transform.GetComponentInParent<HumanoidControl>();
|
||||
if (foundHumanoid != null)
|
||||
return foundHumanoid;
|
||||
|
||||
HumanoidControl[] humanoids = GameObject.FindObjectsOfType<HumanoidControl>();
|
||||
|
||||
for (int i = 0; i < humanoids.Length; i++)
|
||||
if (humanoids[i].headTarget.transform == target.transform)
|
||||
foundHumanoid = humanoids[i];
|
||||
|
||||
return foundHumanoid;
|
||||
}
|
||||
|
||||
#region Sensors
|
||||
#if hFACE
|
||||
private SerializedProperty microphoneEnabledProp;
|
||||
#endif
|
||||
private void InitSensors() {
|
||||
#if hFACE
|
||||
microphoneEnabledProp = serializedObject.FindProperty("microphone.enabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
private bool showControllers = true;
|
||||
private void SensorInspectors(HeadTarget headTarget) {
|
||||
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
||||
if (showControllers) {
|
||||
EditorGUI.indentLevel++;
|
||||
FirstPersonCameraInspector(headTarget);
|
||||
ScreenInspector(headTarget);
|
||||
|
||||
foreach (TargetProps props in allProps)
|
||||
props.Inspector();
|
||||
|
||||
AnimatorInspector(headTarget);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void FirstPersonCameraInspector(HeadTarget headTarget) {
|
||||
#if pUNITYXR || hLEGACYXR
|
||||
if (headTarget.unityXR == null)
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
EditorGUI.BeginDisabledGroup(headTarget.humanoid.openVR.enabled && headTarget.viveTracker.enabled);
|
||||
#endif
|
||||
#if pUNITYXR || hLEGACYXR
|
||||
bool wasEnabled
|
||||
= headTarget.unityXR.enabled;
|
||||
#endif
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
#if hLEGACYXR
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
if (headTarget.humanoid.openVR.enabled && headTarget.viveTracker.enabled)
|
||||
headTarget.unity.enabled = false;
|
||||
#endif
|
||||
#endif
|
||||
#pragma warning disable 219
|
||||
bool enabled
|
||||
#if pUNITYXR || hLEGACYXR
|
||||
= EditorGUILayout.ToggleLeft(headTarget.unityXR.name, headTarget.unityXR.enabled, GUILayout.MinWidth(80));
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
Undo.RecordObject(headTarget, enabled ? "Enabled " : "Disabled " + headTarget.unityXR.name);
|
||||
headTarget.unityXR.enabled = enabled;
|
||||
}
|
||||
#else
|
||||
= false;
|
||||
#endif
|
||||
#pragma warning restore 219
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
#if hFACE
|
||||
if (enabled) { // && microphoneEnabledProp != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
microphoneEnabledProp.boolValue = EditorGUILayout.ToggleLeft("Microphone", microphoneEnabledProp.boolValue);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if pUNITYXR
|
||||
//if (!Application.isPlaying) {
|
||||
// //Passer.Tracking.UnityXRHmd.CheckCamera(headTarget);
|
||||
// if (!wasEnabled && headTarget.unity.enabled) {
|
||||
// Passer.Tracking.UnityXRHmd.AddCamera(headTarget.unity);
|
||||
// }
|
||||
// else if (wasEnabled && !headTarget.unity.enabled) {
|
||||
// Passer.Tracking.UnityXRHmd.RemoveCamera(headTarget.unity);
|
||||
// }
|
||||
//}
|
||||
#endif
|
||||
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
EditorGUI.EndDisabledGroup();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
private void ScreenInspector(HeadTarget headTarget) {
|
||||
if (headTarget.virtual3d && headTarget.humanoid.showRealObjects) {
|
||||
if (headTarget.screenTransform == null)
|
||||
CreateScreen(headTarget);
|
||||
headTarget.screenTransform.gameObject.SetActive(true);
|
||||
}
|
||||
else if (headTarget.screenTransform != null)
|
||||
headTarget.screenTransform.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void CreateScreen(HeadTarget headTarget) {
|
||||
GameObject realWorld = HumanoidControl.GetRealWorld(headTarget.humanoid.transform);
|
||||
|
||||
headTarget.screenTransform = realWorld.transform.Find("Screen");
|
||||
if (headTarget.screenTransform == null) {
|
||||
GameObject screenObj = GameObject.CreatePrimitive(PrimitiveType.Cube); //new GameObject("Screen");
|
||||
screenObj.name = "Screen";
|
||||
headTarget.screenTransform = screenObj.transform;
|
||||
headTarget.screenTransform.parent = realWorld.transform;
|
||||
headTarget.screenTransform.localPosition = headTarget.transform.position + headTarget.transform.forward;
|
||||
headTarget.screenTransform.rotation = headTarget.transform.rotation * Quaternion.AngleAxis(180, Vector3.up);
|
||||
headTarget.screenTransform.localScale = new Vector3(0.476F, 0.2677F, 0.02F); // 21.5 inch 16:9 screen size
|
||||
}
|
||||
}
|
||||
|
||||
private void AnimatorInspector(HeadTarget headTarget) {
|
||||
if (headTarget.humanoid == null)
|
||||
return;
|
||||
|
||||
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator)+ "." +nameof(HeadTarget.headAnimator.enabled));
|
||||
if (animatorProp != null && headTarget.humanoid.animatorEnabled) {
|
||||
|
||||
GUIContent text = new GUIContent(
|
||||
"Procedural Animation",
|
||||
"Controls the head when no tracking is active"
|
||||
);
|
||||
animatorProp.boolValue = EditorGUILayout.ToggleLeft("Procedural Animation", animatorProp.boolValue, GUILayout.MinWidth(80));
|
||||
if (headTarget.headAnimator.enabled) {
|
||||
EditorGUI.indentLevel++;
|
||||
#if hFACE
|
||||
headTarget.face.behaviour.enabled = EditorGUILayout.ToggleLeft("Eye Behaviour", headTarget.face.behaviour.enabled);
|
||||
#endif
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Configuration
|
||||
private bool showConfiguration;
|
||||
private bool showLeftEye;
|
||||
private bool showRightEye;
|
||||
private void ConfigurationInspector(HeadTarget headTarget) {
|
||||
if (headTarget.humanoid == null)
|
||||
return;
|
||||
|
||||
showConfiguration = EditorGUILayout.Foldout(showConfiguration, "Configuration", true);
|
||||
if (showConfiguration) {
|
||||
EditorGUI.indentLevel++;
|
||||
#if hFACE
|
||||
SerializedProperty faceProp = serializedObject.FindProperty("face");
|
||||
FaceTarget_Editor.ConfigurationInspector(faceProp, headTarget.face);
|
||||
#endif
|
||||
HeadConfigurationInspector(ref headTarget.head);
|
||||
NeckConfigurationInspector(ref headTarget.neck);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void HeadConfigurationInspector(ref HeadTarget.TargetedHeadBone head) {
|
||||
head.bone.transform = (Transform)EditorGUILayout.ObjectField("Head", head.bone.transform, typeof(Transform), true);
|
||||
if (head.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
head.bone.maxAngle = EditorGUILayout.Slider("Max Angle", head.bone.maxAngle, 0, 180);
|
||||
if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
head.bone.maxAngle = HeadTarget.maxHeadAngle;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void NeckConfigurationInspector(ref HeadTarget.TargetedNeckBone neck) {
|
||||
neck.bone.transform = (Transform)EditorGUILayout.ObjectField("Neck", neck.bone.transform, typeof(Transform), true);
|
||||
if (neck.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
neck.bone.maxAngle = EditorGUILayout.Slider("Max Angle", neck.bone.maxAngle, 0, 180);
|
||||
if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
neck.bone.maxAngle = HeadTarget.maxNeckAngle;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pose
|
||||
private void PoseInspector() {
|
||||
if (!Application.isPlaying && humanoid.pose != null && humanoid.editPose)
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
|
||||
private bool showSettings;
|
||||
private void SettingsInspector(HeadTarget headTarget) {
|
||||
showSettings = EditorGUILayout.Foldout(showSettings, "Settings", true);
|
||||
if (showSettings) {
|
||||
EditorGUI.indentLevel++;
|
||||
CollisionFaderInspector();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void CollisionFaderInspector() {
|
||||
SerializedProperty collisionFaderProp = serializedObject.FindProperty("collisionFader");
|
||||
collisionFaderProp.boolValue = EditorGUILayout.Toggle("Collision Fader", collisionFaderProp.boolValue);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
protected int selectedEventSource = -1;
|
||||
protected int selectedEvent;
|
||||
|
||||
protected bool showEvents;
|
||||
protected virtual void EventsInspector() {
|
||||
showEvents = EditorGUILayout.Foldout(showEvents, "Events", true);
|
||||
if (showEvents) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
TrackingEventInspector();
|
||||
AudioEventInspector();
|
||||
#if hFACE
|
||||
FocusEventInspector();
|
||||
BlinkEventInspector();
|
||||
#endif
|
||||
InsideColliderInspector();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
protected void TrackingEventInspector() {
|
||||
SerializedProperty trackingEventProp = serializedObject.FindProperty("trackingEvent");
|
||||
BoolEvent_Editor.EventInspector(trackingEventProp, headTarget.trackingEvent, ref selectedEventSource, ref selectedEvent);
|
||||
}
|
||||
|
||||
protected void AudioEventInspector() {
|
||||
SerializedProperty audioEventProp = serializedObject.FindProperty("audioEvent");
|
||||
FloatEvent_Editor.EventInspector(audioEventProp, headTarget.audioEvent, ref selectedEventSource, ref selectedEvent);
|
||||
}
|
||||
#if hFACE
|
||||
protected void FocusEventInspector() {
|
||||
SerializedProperty focusEventProp = serializedObject.FindProperty("focusEvent");
|
||||
GameObjectEvent_Editor.EventInspector(focusEventProp, headTarget.focusEvent, ref selectedEventSource, ref selectedEvent);
|
||||
}
|
||||
|
||||
protected void BlinkEventInspector() {
|
||||
SerializedProperty blinkEventProp = serializedObject.FindProperty("blinkEvent");
|
||||
BoolEvent_Editor.EventInspector(blinkEventProp, headTarget.blinkEvent, ref selectedEventSource, ref selectedEvent);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected void InsideColliderInspector() {
|
||||
SerializedProperty insideColliderEventProp = serializedObject.FindProperty("insideColliderEvent");
|
||||
BoolEvent_Editor.EventInspector(insideColliderEventProp, headTarget.insideColliderEvent, ref selectedEventSource, ref selectedEvent);
|
||||
}
|
||||
|
||||
// protected void EventDetails(int selectedEvent) {
|
||||
// switch (selectedEvent) {
|
||||
// case 0:
|
||||
// FloatEvent_Editor.DetailsInspector(headTarget.audioEvent, audioEventProp, "Audio");
|
||||
// break;
|
||||
//#if hFACE
|
||||
// case 1:
|
||||
// GameObjectEvent_Editor.DetailsInspector(focusEventProp, "Focus");
|
||||
// break;
|
||||
// case 2:
|
||||
// BoolEvent_Editor.DetailsInspector(blinkEventProp, "Blink");
|
||||
// break;
|
||||
//#endif
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Buttons
|
||||
private void GazeInteractionButton(HeadTarget headTarget) {
|
||||
InteractionPointer interactionPointer = headTarget.transform.GetComponentInChildren<InteractionPointer>();
|
||||
if (interactionPointer != null)
|
||||
return;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Add Interaction Pointer"))
|
||||
AddInteractionPointer();
|
||||
if (GUILayout.Button("Add Teleporter"))
|
||||
AddTeleporter();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private void AddInteractionPointer() {
|
||||
}
|
||||
|
||||
private void AddTeleporter() {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Scene
|
||||
|
||||
public void OnSceneGUI() {
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
if (headTarget == null || headTarget.humanoid == null)
|
||||
return;
|
||||
|
||||
#if hFACE
|
||||
FaceTarget_Editor.UpdateScene(headTarget.face);
|
||||
#endif
|
||||
if (humanoid.pose != null) {
|
||||
if (humanoid.editPose)
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
headTarget.CopyRigToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current head target
|
||||
headTarget.CopyTargetToRig();
|
||||
// update the avatar bones from the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
// and update all targets to match the target rig
|
||||
humanoid.CopyRigToTargets();
|
||||
|
||||
// Update the sensors to match the updated targets
|
||||
humanoid.UpdateSensorsFromTargets();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
public HeadTarget headTarget;
|
||||
public HeadSensor sensor;
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, HeadSensor _sensor, HeadTarget _headTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
headTarget = _headTarget;
|
||||
sensor = _sensor;
|
||||
|
||||
sensor.Init(headTarget);
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
if (sensor.sensorTransform == null)
|
||||
return;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 798d81711f6d98440ba31bbffdcf72f6
|
||||
timeCreated: 1455896583
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,330 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer {
|
||||
using Humanoid;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(HipsTarget), true)]
|
||||
public class HipsTarget_Editor : Editor {
|
||||
private HipsTarget hipsTarget;
|
||||
private HumanoidControl humanoid;
|
||||
|
||||
private TargetProps[] allProps;
|
||||
|
||||
#region Enable
|
||||
|
||||
public void OnEnable() {
|
||||
hipsTarget = (HipsTarget)target;
|
||||
|
||||
if (hipsTarget.humanoid == null)
|
||||
hipsTarget.humanoid = GetHumanoid(hipsTarget);
|
||||
humanoid = hipsTarget.humanoid;
|
||||
if (humanoid == null)
|
||||
return;
|
||||
|
||||
InitEditors();
|
||||
|
||||
hipsTarget.InitSensors();
|
||||
InitConfiguration(hipsTarget);
|
||||
InitSettings();
|
||||
}
|
||||
|
||||
private void InitEditors() {
|
||||
allProps = new TargetProps[] {
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
new ViveTracker_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hKINECT1
|
||||
new Kinect1_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hKINECT2
|
||||
new Kinect2_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hKINECT4
|
||||
new Kinect4_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hORBBEC
|
||||
new Astra_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hCUSTOM
|
||||
new Custom_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
public void OnDisable() {
|
||||
if (humanoid == null) {
|
||||
// This target is not connected to a humanoid, so we delete it
|
||||
DestroyImmediate(hipsTarget, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
SetSensor2Target();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSensor2Target() {
|
||||
foreach (TargetProps props in allProps)
|
||||
props.SetSensor2Target();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
if (hipsTarget == null || humanoid == null)
|
||||
return;
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
SensorInspectors(hipsTarget);
|
||||
ConfigurationInspector(hipsTarget);
|
||||
SettingsInspector();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
public static HumanoidControl GetHumanoid(HumanoidTarget target) {
|
||||
HumanoidControl foundHumanoid = target.transform.GetComponentInParent<HumanoidControl>();
|
||||
if (foundHumanoid != null)
|
||||
return foundHumanoid;
|
||||
|
||||
HumanoidControl[] humanoids = GameObject.FindObjectsOfType<HumanoidControl>();
|
||||
|
||||
for (int i = 0; i < humanoids.Length; i++)
|
||||
if (humanoids[i].hipsTarget.transform == target.transform)
|
||||
foundHumanoid = humanoids[i];
|
||||
|
||||
return foundHumanoid;
|
||||
}
|
||||
|
||||
#region Sensors
|
||||
|
||||
public bool showSensors = true;
|
||||
private void SensorInspectors(HipsTarget hipsTarget) {
|
||||
showSensors = EditorGUILayout.Foldout(showSensors, "Controllers", true);
|
||||
if (showSensors) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
foreach (TargetProps props in allProps)
|
||||
props.Inspector();
|
||||
|
||||
AnimatorInspector(hipsTarget);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void AnimatorInspector(HipsTarget hipsTarget) {
|
||||
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HipsTarget.torsoAnimator) + "." + nameof(HipsTarget.torsoAnimator.enabled));
|
||||
if (animatorProp == null || hipsTarget.humanoid == null || !hipsTarget.humanoid.animatorEnabled)
|
||||
return;
|
||||
|
||||
GUIContent text = new GUIContent(
|
||||
"Procedural Animation",
|
||||
"Controls the hips when no tracking is active"
|
||||
);
|
||||
animatorProp.boolValue = EditorGUILayout.ToggleLeft(text, animatorProp.boolValue, GUILayout.MinWidth(80));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Configuration
|
||||
private void InitConfiguration(HipsTarget target) {
|
||||
if (target.humanoid.avatarRig == null)
|
||||
return;
|
||||
|
||||
InitChestConfiguration(target.chest);
|
||||
InitSpineConfiguration(target.spine);
|
||||
InitHipsConfiguration(target.hips);
|
||||
}
|
||||
|
||||
private bool showConfiguration;
|
||||
private void ConfigurationInspector(HipsTarget hipsTarget) {
|
||||
hipsTarget.RetrieveBones();
|
||||
|
||||
showConfiguration = EditorGUILayout.Foldout(showConfiguration, "Configuration", true);
|
||||
if (showConfiguration) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
ChestConfigurationInspector(ref hipsTarget.chest);
|
||||
SpineConfigurationInspector(ref hipsTarget.spine);
|
||||
HipsConfigurationInspector(ref hipsTarget.hips);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBones(HipsTarget target) {
|
||||
if (target.humanoid.avatarRig == null)
|
||||
return;
|
||||
|
||||
UpdateHipsBones(target.hips);
|
||||
UpdateSpineBones(target.spine);
|
||||
UpdateChestBones(target.chest);
|
||||
}
|
||||
|
||||
#region Chest
|
||||
private void InitChestConfiguration(HipsTarget.TargetedChestBone upperLeg) {
|
||||
}
|
||||
|
||||
private void ChestConfigurationInspector(ref HipsTarget.TargetedChestBone chest) {
|
||||
chest.bone.transform = (Transform)EditorGUILayout.ObjectField("Chest", chest.bone.transform, typeof(Transform), true);
|
||||
if (chest.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
chest.bone.maxAngle = EditorGUILayout.Slider("Max Angle", chest.bone.maxAngle, 0, 180);
|
||||
if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
chest.bone.maxAngle = HipsTarget.maxChestAngle;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateChestBones(HipsTarget.TargetedChestBone chest) {
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Spine
|
||||
private void InitSpineConfiguration(HipsTarget.TargetedSpineBone spine) {
|
||||
}
|
||||
|
||||
private void SpineConfigurationInspector(ref HipsTarget.TargetedSpineBone spine) {
|
||||
spine.bone.transform = (Transform)EditorGUILayout.ObjectField("Spine", spine.bone.transform, typeof(Transform), true);
|
||||
if (spine.bone.transform != null) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
spine.bone.maxAngle = EditorGUILayout.Slider("Max Angle", spine.bone.maxAngle, 0, 180);
|
||||
if (GUILayout.Button("R", GUILayout.Width(20))) {
|
||||
spine.bone.maxAngle = HipsTarget.maxSpineAngle;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSpineBones(HipsTarget.TargetedSpineBone spine) {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Hips
|
||||
private void InitHipsConfiguration(HipsTarget.TargetedHipsBone hips) {
|
||||
}
|
||||
|
||||
private void HipsConfigurationInspector(ref HipsTarget.TargetedHipsBone hips) {
|
||||
hips.bone.transform = (Transform)EditorGUILayout.ObjectField("Hips", hips.bone.transform, typeof(Transform), true);
|
||||
}
|
||||
|
||||
private void UpdateHipsBones(HipsTarget.TargetedHipsBone hips) {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
|
||||
protected SerializedProperty bodyRotationProp;
|
||||
|
||||
protected void InitSettings() {
|
||||
SerializedProperty animatorProp = serializedObject.FindProperty("torsoAnimator");
|
||||
bodyRotationProp = animatorProp.FindPropertyRelative("bodyRotation");
|
||||
}
|
||||
|
||||
public bool showSettings;
|
||||
protected void SettingsInspector() {
|
||||
showSettings = EditorGUILayout.Foldout(showSettings, "Settings", true);
|
||||
if (showSettings) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
bodyRotationProp.intValue = (int)(TorsoAnimator.BodyRotation)EditorGUILayout.EnumPopup("Body Rotation", (TorsoAnimator.BodyRotation)bodyRotationProp.intValue);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Scene
|
||||
|
||||
public void OnSceneGUI() {
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
if (hipsTarget == null || humanoid == null)
|
||||
return;
|
||||
|
||||
if (humanoid.pose != null) {
|
||||
if (humanoid.editPose)
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
hipsTarget.CopyRigToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current hips target
|
||||
hipsTarget.CopyTargetToRig();
|
||||
// update the avatar bones to match the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
// and update all targets to match the target rig
|
||||
humanoid.CopyRigToTargets();
|
||||
|
||||
// Update the sensors to match the updated targets
|
||||
humanoid.UpdateSensorsFromTargets();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
public HipsTarget hipsTarget;
|
||||
public TorsoSensor sensor;
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, TorsoSensor _sensor, HipsTarget _hipsTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
hipsTarget = _hipsTarget;
|
||||
sensor = _sensor;
|
||||
|
||||
sensor.Init(hipsTarget);
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
if (sensor.sensorTransform == null)
|
||||
return;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fb1134ab171b144884db2408eb884fb
|
||||
timeCreated: 1462300882
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,389 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
public static class HumanoidTarget_Editor {
|
||||
public static Target Inspector(Target target, string name) {
|
||||
if (target == null)
|
||||
return target;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
Transform defaultTargetTransform = null; // target.GetDefaultTarget(target.humanoid);
|
||||
Transform targetTransform = target.transform ?? defaultTargetTransform;
|
||||
targetTransform = (Transform)EditorGUILayout.ObjectField(name, targetTransform, typeof(Transform), true);
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
if (targetTransform == defaultTargetTransform && GUILayout.Button("Show", GUILayout.MaxWidth(60))) {
|
||||
// Call static method CreateTarget on target
|
||||
target = (HumanoidTarget)target.GetType().GetMethod("CreateTarget").Invoke(null, new object[] { target });
|
||||
//} else if (targetTransform != target.transform) {
|
||||
// target = (HumanoidTarget)target.GetType().GetMethod("SetTarget").Invoke(null, new object[] { target.humanoid, targetTransform });
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return target;
|
||||
}
|
||||
|
||||
public static HumanoidTarget Inspector(HumanoidTarget target, string name) {
|
||||
if (target == null)
|
||||
return target;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
Transform defaultTargetTransform = target.GetDefaultTarget(target.humanoid);
|
||||
Transform targetTransform = target.transform ?? defaultTargetTransform;
|
||||
|
||||
GUIContent text = new GUIContent(
|
||||
name,
|
||||
"The transform controlling the " + name
|
||||
);
|
||||
targetTransform = (Transform)EditorGUILayout.ObjectField(text, targetTransform, typeof(Transform), true);
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
if (targetTransform == defaultTargetTransform && GUILayout.Button("Show", GUILayout.MaxWidth(60))) {
|
||||
// Call static method CreateTarget on target
|
||||
target = (HumanoidTarget)target.GetType().GetMethod("CreateTarget").Invoke(null, new object[] { target });
|
||||
} else if (targetTransform != target.transform) {
|
||||
target = (HumanoidTarget)target.GetType().GetMethod("SetTarget").Invoke(null, new object[] { target.humanoid, targetTransform });
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return target;
|
||||
}
|
||||
|
||||
public static bool ControllerInspector(HumanoidSensor controller) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
controller.enabled = EditorGUILayout.ToggleLeft(controller.name, controller.enabled, GUILayout.MinWidth(80));
|
||||
if (controller.enabled && Application.isPlaying)
|
||||
EditorGUILayout.EnumPopup(controller.status);
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return controller.enabled;
|
||||
}
|
||||
|
||||
public static bool ControllerInspector(HumanoidSensor controller, Target target) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GUIContent text = new GUIContent(
|
||||
controller.name,
|
||||
"Activate " + controller.name + " support for this humanoid"
|
||||
);
|
||||
|
||||
bool enabled = EditorGUILayout.ToggleLeft(text, controller.enabled, GUILayout.MinWidth(80));
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
Undo.RecordObject(target, enabled ? "Enabled " : "Disabled " + controller.name);
|
||||
controller.enabled = enabled;
|
||||
}
|
||||
if (Application.isPlaying && enabled)
|
||||
EditorGUILayout.EnumPopup(controller.status);
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void BoneAngleInspector(SerializedProperty minProperty, SerializedProperty maxProperty, float defaultMin, float defaultMax, string boneAxisName, string label) {
|
||||
float min = minProperty.floatValue;
|
||||
float max = maxProperty.floatValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField(label, GUILayout.MinWidth(70));
|
||||
|
||||
min = EditorGUILayout.FloatField(min, GUILayout.Width(65));
|
||||
GUI.SetNextControlName(boneAxisName + "1");
|
||||
EditorGUILayout.MinMaxSlider(ref min, ref max, -180, 180);
|
||||
GUI.SetNextControlName(boneAxisName + "2");
|
||||
max = EditorGUILayout.FloatField(max, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
min = defaultMin;
|
||||
max = defaultMax;
|
||||
GUI.FocusControl(boneAxisName + "1");
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
minProperty.floatValue = min;
|
||||
maxProperty.floatValue = max;
|
||||
}
|
||||
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
|
||||
public static void BoneXAngleInspector(HumanoidTarget.TargetedBone bone, float defaultMin, float defaultMax) {
|
||||
float oldMin = bone.bone.minAngles.x;
|
||||
float oldMax = bone.bone.maxAngles.x;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField("X Limits", GUILayout.MinWidth(70));
|
||||
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "X1");
|
||||
bone.bone.minAngles.x = EditorGUILayout.FloatField(bone.bone.minAngles.x, GUILayout.Width(65));
|
||||
|
||||
EditorGUILayout.MinMaxSlider(ref bone.bone.minAngles.x, ref bone.bone.maxAngles.x, -180, 180);
|
||||
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "X2");
|
||||
bone.bone.maxAngles.x = EditorGUILayout.FloatField(bone.bone.maxAngles.x, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
bone.bone.minAngles.x = defaultMin;
|
||||
bone.bone.maxAngles.x = defaultMax;
|
||||
GUI.FocusControl(bone.bone.transform.name + "X1");
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (bone.bone.maxAngles.x != oldMax || bone.bone.minAngles.x != oldMin)
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
|
||||
public static void BoneYAngleInspector(HumanoidTarget.TargetedBone bone, float defaultMin, float defaultMax) {
|
||||
float oldMin = bone.bone.minAngles.y;
|
||||
float oldMax = bone.bone.maxAngles.y;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField("Y Limits", GUILayout.MinWidth(70));
|
||||
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Y1");
|
||||
bone.bone.minAngles.y = EditorGUILayout.FloatField(bone.bone.minAngles.y, GUILayout.Width(65));
|
||||
|
||||
EditorGUILayout.MinMaxSlider(ref bone.bone.minAngles.y, ref bone.bone.maxAngles.y, -180, 180);
|
||||
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Y2");
|
||||
bone.bone.maxAngles.y = EditorGUILayout.FloatField(bone.bone.maxAngles.y, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
bone.bone.minAngles.y = defaultMin;
|
||||
bone.bone.maxAngles.y = defaultMax;
|
||||
GUI.FocusControl(bone.bone.transform.name + "Y1");
|
||||
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (bone.bone.maxAngles.y != oldMax || bone.bone.minAngles.y != oldMin)
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
|
||||
public static void BoneYAngleInspector(HumanoidTarget.TargetedBone bone, SerializedProperty minProperty, SerializedProperty maxProperty, float defaultMin, float defaultMax) {
|
||||
float min = minProperty.floatValue;
|
||||
float max = maxProperty.floatValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField("Limits Y", GUILayout.MinWidth(70));
|
||||
|
||||
min = EditorGUILayout.FloatField(min, GUILayout.Width(65));
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Y1");
|
||||
EditorGUILayout.MinMaxSlider(ref min, ref max, -180, 180);
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Y2");
|
||||
max = EditorGUILayout.FloatField(max, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
min = defaultMin;
|
||||
max = defaultMax;
|
||||
GUI.FocusControl(bone.bone.transform.name + "Y1");
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
minProperty.floatValue = min;
|
||||
maxProperty.floatValue = max;
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
}
|
||||
|
||||
public static void BoneZAngleInspector(HumanoidTarget.TargetedBone bone, float defaultMin, float defaultMax) {
|
||||
float oldMin = bone.bone.minAngles.z;
|
||||
float oldMax = bone.bone.maxAngles.z;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField("Z Limits", GUILayout.MinWidth(70));
|
||||
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Z1");
|
||||
bone.bone.minAngles.z = EditorGUILayout.FloatField(bone.bone.minAngles.z, GUILayout.Width(65));
|
||||
|
||||
EditorGUILayout.MinMaxSlider(ref bone.bone.minAngles.z, ref bone.bone.maxAngles.z, -180, 180);
|
||||
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Z2");
|
||||
bone.bone.maxAngles.z = EditorGUILayout.FloatField(bone.bone.maxAngles.z, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
bone.bone.minAngles.z = defaultMin;
|
||||
bone.bone.maxAngles.z = defaultMax;
|
||||
GUI.FocusControl(bone.bone.transform.name + "Z1");
|
||||
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (bone.bone.maxAngles.y != oldMax || bone.bone.minAngles.y != oldMin)
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
|
||||
public static void BoneZAngleInspector(HumanoidTarget.TargetedBone bone, SerializedProperty minProperty, SerializedProperty maxProperty, float defaultMin, float defaultMax) {
|
||||
float min = minProperty.floatValue;
|
||||
float max = maxProperty.floatValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField("Limits Z", GUILayout.MinWidth(70));
|
||||
|
||||
min = EditorGUILayout.FloatField(min, GUILayout.Width(65));
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Z1");
|
||||
EditorGUILayout.MinMaxSlider(ref min, ref max, -180, 180);
|
||||
GUI.SetNextControlName(bone.bone.transform.name + "Z2");
|
||||
max = EditorGUILayout.FloatField(max, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
min = defaultMin;
|
||||
max = defaultMax;
|
||||
GUI.FocusControl(bone.bone.transform.name + "Z1");
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
minProperty.floatValue = min;
|
||||
maxProperty.floatValue = max;
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
}
|
||||
|
||||
//public static void DrawTargetBone(HumanoidTarget.TargetedBone bone) {
|
||||
// if (bone.target.transform != null) {
|
||||
// Handles.color = Color.white;
|
||||
// Handles.DrawLine(bone.target.transform.position, bone.target.transform.position + bone.target.transform.rotation * bone.target.normalDirection * bone.bone.length);
|
||||
// }
|
||||
//}
|
||||
|
||||
#region xArcs
|
||||
public static void DrawXArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle) {
|
||||
DrawXArcs(position, rotation, minAngle, maxAngle, rotation * Vector3.down);
|
||||
}
|
||||
public static void DrawXArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 zeroDirection) {
|
||||
Vector3 planeNormal = rotation * Vector3.right;
|
||||
DrawXArcs(position, rotation, minAngle, maxAngle, planeNormal, zeroDirection);
|
||||
}
|
||||
public static void DrawXArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 planeNormal, Vector3 zeroDirection) {
|
||||
DrawArcs(position, rotation, minAngle, maxAngle, planeNormal, zeroDirection, Color.red);
|
||||
}
|
||||
#endregion
|
||||
#region yArcs
|
||||
public static void DrawYArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle) {
|
||||
DrawYArcs(position, rotation, minAngle, maxAngle, rotation * Vector3.forward);
|
||||
}
|
||||
|
||||
public static void DrawYArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 zeroDirection) {
|
||||
Vector3 planeNormal = rotation * Vector3.up;
|
||||
DrawYArcs(position, rotation, minAngle, maxAngle, planeNormal, zeroDirection);
|
||||
}
|
||||
|
||||
public static void DrawYArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 planeNormal, Vector3 zeroDirection) {
|
||||
DrawArcs(position, rotation, minAngle, maxAngle, planeNormal, zeroDirection, Color.green);
|
||||
}
|
||||
#endregion
|
||||
#region zArcs
|
||||
public static void DrawZArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle) {
|
||||
DrawZArcs(position, rotation, minAngle, maxAngle, rotation * Vector3.down);
|
||||
}
|
||||
|
||||
public static void DrawZArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 zeroDirection) {
|
||||
Vector3 planeNormal = rotation * Vector3.forward;
|
||||
DrawZArcs(position, rotation, minAngle, maxAngle, planeNormal, zeroDirection);
|
||||
}
|
||||
|
||||
public static void DrawZArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 planeNormal, Vector3 zeroDirection) {
|
||||
DrawArcs(position, rotation, minAngle, maxAngle, planeNormal, zeroDirection, Color.blue);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static void DrawArcs(Vector3 position, Quaternion rotation, float minAngle, float maxAngle, Vector3 planeNormal, Vector3 zeroDirection, Color color) {
|
||||
color.a = 0.1F;
|
||||
Handles.color = color;
|
||||
Handles.DrawSolidArc(position, planeNormal, zeroDirection, minAngle, HandleUtility.GetHandleSize(position));
|
||||
Handles.DrawSolidArc(position, planeNormal, zeroDirection, maxAngle, HandleUtility.GetHandleSize(position));
|
||||
|
||||
color.a = 1;
|
||||
Handles.color = color;
|
||||
Handles.DrawWireArc(position, planeNormal, zeroDirection, minAngle, HandleUtility.GetHandleSize(position));
|
||||
Handles.DrawWireArc(position, planeNormal, zeroDirection, maxAngle, HandleUtility.GetHandleSize(position));
|
||||
|
||||
Handles.DrawLine(position, position + zeroDirection * HandleUtility.GetHandleSize(position));
|
||||
}
|
||||
|
||||
#region MinMaxSlider
|
||||
|
||||
}
|
||||
|
||||
public class MinMaxSliderAttribute : PropertyAttribute {
|
||||
public readonly string name;
|
||||
public readonly float defaultMin;
|
||||
public readonly float defaultMax;
|
||||
public readonly float minLimit;
|
||||
public readonly float maxLimit;
|
||||
|
||||
public MinMaxSliderAttribute(string _name, float _defaultMin, float _defaultMax, float _minLimit, float _maxLimit) {
|
||||
name = _name;
|
||||
defaultMin = _defaultMin;
|
||||
defaultMax = _defaultMax;
|
||||
minLimit = _minLimit;
|
||||
maxLimit = _maxLimit;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(MinMaxSliderAttribute))]
|
||||
class MinMaxSliderDrawer : PropertyDrawer {
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
|
||||
if (property.propertyType == SerializedPropertyType.Vector2) {
|
||||
Vector2 range = property.vector2Value;
|
||||
float min = range.x;
|
||||
float max = range.y;
|
||||
MinMaxSliderAttribute attr = attribute as MinMaxSliderAttribute;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField(label, GUILayout.MinWidth(70));
|
||||
|
||||
min = EditorGUILayout.FloatField(min, GUILayout.Width(65));
|
||||
GUI.SetNextControlName(attr.name + "1");
|
||||
EditorGUI.MinMaxSlider(position, label, ref min, ref max, attr.minLimit, attr.maxLimit);
|
||||
GUI.SetNextControlName(attr.name + "2");
|
||||
max = EditorGUILayout.FloatField(max, GUILayout.Width(65));
|
||||
|
||||
if (GUILayout.Button("R")) {
|
||||
min = attr.defaultMin;
|
||||
max = attr.defaultMax;
|
||||
GUI.FocusControl(attr.name + "Y1");
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck()) {
|
||||
range.x = min;
|
||||
range.y = max;
|
||||
property.vector2Value = range;
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
} else {
|
||||
EditorGUI.LabelField(position, label, "Use only with Vector2");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e84263607533aa4491faf24bb6dcbe7
|
||||
timeCreated: 1485418477
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,29 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer {
|
||||
|
||||
public static class Target_Editor {
|
||||
public static Target Inspector(Target target, string name) {
|
||||
if (target == null)
|
||||
return target;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
Transform defaultTargetTransform = null; // target.GetDefaultTarget(target.humanoid);
|
||||
Transform targetTransform = target.transform ?? defaultTargetTransform;
|
||||
targetTransform = (Transform)EditorGUILayout.ObjectField(name, targetTransform, typeof(Transform), true);
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
if (targetTransform == defaultTargetTransform && GUILayout.Button("Show", GUILayout.MaxWidth(60))) {
|
||||
// Call static method CreateTarget on target
|
||||
target = (Target)target.GetType().GetMethod("CreateTarget").Invoke(null, new object[] { target });
|
||||
//} else if (targetTransform != target.transform) {
|
||||
// target = (HumanoidTarget)target.GetType().GetMethod("SetTarget").Invoke(null, new object[] { target.humanoid, targetTransform });
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 011af4b4943f20348824525c07b3d646
|
||||
timeCreated: 1553075920
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f05b0c1d8cd1ec743976fd9877495eae
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,90 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[CustomEditor(typeof(AvatarManager))]
|
||||
public class AvatarManager_Editor : Editor {
|
||||
|
||||
public void OnDisable() {
|
||||
AvatarManager avatarManager = (AvatarManager)target;
|
||||
Cleanup(avatarManager);
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
AvatarManager avatarManager = (AvatarManager)target;
|
||||
|
||||
CurrentAvatarInspector(avatarManager);
|
||||
|
||||
if (avatarManager.fpAvatars.Length == 0 || avatarManager.fpAvatars[avatarManager.fpAvatars.Length - 1] != null)
|
||||
avatarManager.fpAvatars = Extend(avatarManager.fpAvatars, avatarManager.fpAvatars.Length + 1);
|
||||
if (avatarManager.tpAvatars.Length < avatarManager.fpAvatars.Length)
|
||||
avatarManager.tpAvatars = Extend(avatarManager.tpAvatars, avatarManager.fpAvatars.Length);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("#", GUILayout.Width(20));
|
||||
EditorGUILayout.LabelField("First Person", GUILayout.MinWidth(100));
|
||||
#if hNW_UNET || hNW_PHOTON || hNW_BOLT || hNW_MIRROR
|
||||
EditorGUILayout.LabelField("Third Person", GUILayout.MinWidth(100));
|
||||
#endif
|
||||
EditorGUILayout.EndHorizontal();
|
||||
for (int i = 0; i < avatarManager.fpAvatars.Length; i++)
|
||||
AvatarInspector(avatarManager, i);
|
||||
|
||||
//if (GUILayout.Button("Add Avatar"))
|
||||
// AddAvatar(avatarManager);
|
||||
|
||||
}
|
||||
|
||||
private void CurrentAvatarInspector(AvatarManager avatarManager) {
|
||||
int lastAvatarIndex = avatarManager.currentAvatarIndex;
|
||||
avatarManager.currentAvatarIndex = EditorGUILayout.IntField("Current Avatar Index", avatarManager.currentAvatarIndex);
|
||||
if (Application.isPlaying && avatarManager.currentAvatarIndex != lastAvatarIndex)
|
||||
avatarManager.SetAvatar(avatarManager.currentAvatarIndex);
|
||||
}
|
||||
|
||||
private void AvatarInspector(AvatarManager avatarManager, int i) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(i.ToString(), GUILayout.Width(20));
|
||||
avatarManager.fpAvatars[i] = (Animator)EditorGUILayout.ObjectField(avatarManager.fpAvatars[i], typeof(Animator), false);
|
||||
#if hNW_UNET || hNW_PHOTON || hNW_BOLT || hNW_MIRROR
|
||||
avatarManager.tpAvatars[i] = (Animator) EditorGUILayout.ObjectField(avatarManager.tpAvatars[i], typeof(Animator), false);
|
||||
#endif
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private void AddAvatar(AvatarManager avatarManager) {
|
||||
avatarManager.fpAvatars = Extend(avatarManager.fpAvatars, avatarManager.fpAvatars.Length + 1);
|
||||
}
|
||||
|
||||
private Animator[] Extend(Animator[] animators, int n) {
|
||||
Animator[] newAnimators = new Animator[n];
|
||||
|
||||
for (int i = 0; i < animators.Length; i++)
|
||||
newAnimators[i] = animators[i];
|
||||
|
||||
return newAnimators;
|
||||
}
|
||||
|
||||
private void Cleanup(AvatarManager avatarManager) {
|
||||
int nNonNullEntries = 0;
|
||||
foreach (Animator animator in avatarManager.fpAvatars) {
|
||||
if (animator != null)
|
||||
nNonNullEntries++;
|
||||
}
|
||||
|
||||
if (nNonNullEntries == avatarManager.fpAvatars.Length)
|
||||
return;
|
||||
|
||||
Animator[] newFpAvatars = new Animator[nNonNullEntries];
|
||||
int j = 0;
|
||||
for (int i = 0; i < avatarManager.fpAvatars.Length; i++) {
|
||||
if (avatarManager.fpAvatars[i] != null) {
|
||||
newFpAvatars[j] = avatarManager.fpAvatars[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
avatarManager.fpAvatars = newFpAvatars;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 801fa352c79178a4f8fda2d82aa10dc6
|
||||
timeCreated: 1513776933
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,24 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
[CustomEditor(typeof(ColoringInteractionPointer), true)]
|
||||
public class ColoringInteractionPointer_Editor : InteractionPointer_Editor {
|
||||
|
||||
#region Inspector
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
base.OnInspectorGUI();
|
||||
|
||||
SerializedProperty validMaterialProp = serializedObject.FindProperty("validMaterial");
|
||||
SerializedProperty invalidMaterialProp = serializedObject.FindProperty("invalidMaterial");
|
||||
|
||||
validMaterialProp.objectReferenceValue = EditorGUILayout.ObjectField("Valid Material", validMaterialProp.objectReferenceValue, typeof(Material), false);
|
||||
invalidMaterialProp.objectReferenceValue = EditorGUILayout.ObjectField("Invalid Material", invalidMaterialProp.objectReferenceValue, typeof(Material), false);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3b109299c0a20c479411a620f00d9d5
|
||||
timeCreated: 1575542779
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
/*
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
[CustomEditor(typeof(HumanoidInteractionPointer), true)]
|
||||
public class HumanoidInteractionPointer_Editor : InteractionPointer_Editor { }
|
||||
}
|
||||
*/
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9aecdda3c9922be46a9d786db6d9f01a
|
||||
timeCreated: 1520436447
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,6 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
[CustomEditor(typeof(Telegrabber))]
|
||||
public class Telegrabber_Editor : InteractionPointer_Editor { }
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2482999d2a9f744893fb4b0707b7fd2
|
||||
timeCreated: 1536833107
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,56 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer {
|
||||
using Passer.Tracking;
|
||||
|
||||
[CustomEditor(typeof(TrackedRigidbody))]
|
||||
public class TrackedRigidbody_Editor : Editor {
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
serializedObject.Update();
|
||||
|
||||
SensorInspector();
|
||||
HybridPhysics.PhysicsMode physicsMode = PhysicsModeInspector();
|
||||
if (physicsMode != HybridPhysics.PhysicsMode.Kinematic) {
|
||||
StrengthInspector();
|
||||
if (physicsMode == HybridPhysics.PhysicsMode.HybridKinematic)
|
||||
KinematicMass();
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void SensorInspector() {
|
||||
SerializedProperty sensorComponentProp = serializedObject.FindProperty("target");
|
||||
Transform sensorTransform = (Transform)sensorComponentProp.objectReferenceValue;
|
||||
SensorComponent sensorComponent =
|
||||
sensorTransform != null ?
|
||||
sensorTransform.GetComponent<SensorComponent>() :
|
||||
null;
|
||||
sensorComponent = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorComponent, typeof(SensorComponent), true);
|
||||
sensorComponentProp.objectReferenceValue =
|
||||
sensorComponent != null ?
|
||||
sensorComponent.transform :
|
||||
null;
|
||||
}
|
||||
|
||||
protected virtual HybridPhysics.PhysicsMode PhysicsModeInspector() {
|
||||
SerializedProperty modeProp = serializedObject.FindProperty("mode");
|
||||
HybridPhysics.PhysicsMode physicsMode = (HybridPhysics.PhysicsMode)EditorGUILayout.EnumPopup("Physics Mode", (HybridPhysics.PhysicsMode)modeProp.intValue);
|
||||
modeProp.intValue = (int)physicsMode;
|
||||
return physicsMode;
|
||||
}
|
||||
|
||||
protected virtual void StrengthInspector() {
|
||||
SerializedProperty strengthProp = serializedObject.FindProperty("strength");
|
||||
strengthProp.floatValue = EditorGUILayout.FloatField("Strength", strengthProp.floatValue);
|
||||
}
|
||||
|
||||
protected virtual void KinematicMass() {
|
||||
SerializedProperty kinematicMassProp = serializedObject.FindProperty("kinematicMass");
|
||||
kinematicMassProp.floatValue = EditorGUILayout.FloatField("Kinematic Mass", kinematicMassProp.floatValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5a9507068fe76b4ab0f7e566de2e97c
|
||||
timeCreated: 1569481259
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,55 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
public class Tracker_Editor : Editor {
|
||||
public static void Inspector(HumanoidControl humanoid, HumanoidTracker tracker, SerializedProperty enabledProp, string resourceName) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
//EditorGUI.BeginChangeCheck();
|
||||
bool wasEnabled = enabledProp.boolValue;
|
||||
enabledProp.boolValue = EditorGUILayout.ToggleLeft(tracker.name, enabledProp.boolValue, GUILayout.MinWidth(80));
|
||||
if (Application.isPlaying && enabledProp.boolValue)
|
||||
EditorGUILayout.EnumPopup(tracker.status);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
PrefabAssetType prefabType = PrefabUtility.GetPrefabAssetType(humanoid);
|
||||
if (prefabType != PrefabAssetType.NotAPrefab)
|
||||
return;
|
||||
|
||||
if (tracker.humanoid == null)
|
||||
tracker.humanoid = humanoid;
|
||||
|
||||
//if (enabledProp.boolValue && resourceName != null)
|
||||
// tracker.AddTracker(humanoid, resourceName);
|
||||
//else if (wasEnabled) {
|
||||
// RemoveTracker(tracker);
|
||||
//}
|
||||
|
||||
//tracker.ShowTracker(humanoid.showRealObjects && enabledProp.boolValue);
|
||||
}
|
||||
|
||||
|
||||
public static void Inspector(HumanoidTracker tracker, SerializedProperty enabledProp) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
//EditorGUI.BeginChangeCheck();
|
||||
enabledProp.boolValue = EditorGUILayout.ToggleLeft(tracker.name, enabledProp.boolValue, GUILayout.MinWidth(80));
|
||||
if (Application.isPlaying && enabledProp.boolValue)
|
||||
EditorGUILayout.EnumPopup(tracker.status);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
protected static void RemoveTracker(HumanoidTracker tracker) {
|
||||
if (tracker.trackerComponent == null)
|
||||
return;
|
||||
DestroyImmediate(tracker.trackerComponent.gameObject, true);
|
||||
}
|
||||
|
||||
public static Transform RemoveTransform(Transform trackerTransform) {
|
||||
if (trackerTransform != null) {
|
||||
DestroyImmediate(trackerTransform.gameObject, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa19d5a5a5c589147a017601069e6e26
|
||||
timeCreated: 1487856438
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf656e8b8b24a4345804416a6861fb3d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
@ -1,37 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f15f0b7c56552b443a87b2cf84b2083c, type: 3}
|
||||
m_Name: DefaultConfiguration
|
||||
m_EditorClassIdentifier:
|
||||
openVRSupport: 1
|
||||
steamVrSupport: 0
|
||||
viveTrackerSupport: 0
|
||||
oculusSupport: 1
|
||||
windowsMRSupport: 1
|
||||
vrtkSupport: 1
|
||||
neuronSupport: 0
|
||||
hi5Support: 0
|
||||
realsenseSupport: 0
|
||||
leapSupport: 0
|
||||
kinect1Support: 0
|
||||
kinect2Support: 0
|
||||
kinect4Support: 0
|
||||
astraSupport: 0
|
||||
hydraSupport: 0
|
||||
arkitSupport: 0
|
||||
tobiiSupport: 0
|
||||
optitrackSupport: 0
|
||||
pupilSupport: 0
|
||||
antilatencySupport: 0
|
||||
networkingSupport: 0
|
||||
networkingVoiceSupport: 0
|
||||
humanoidSceneName:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c620c6539f83ba4a9ef59558546da7f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddd35f516c607da4ab4f97b210606169
|
||||
timeCreated: 1453468358
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,168 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
/// <summary>
|
||||
/// Sets preferences for \ref Humanoid "Humanoid Control"
|
||||
/// </summary>
|
||||
///
|
||||
/// The preferences can be accessed by the Edit->Preferences... menu.
|
||||
///
|
||||
/// \image html HumanoidPreferences.png
|
||||
///
|
||||
/// * SteamVR Support, enables support for SteamVR devices beyound Unity XR (VR, Plus, Pro)
|
||||
/// * Vive Tracker Support, enables support for Vive Trackers (Plus, Pro)
|
||||
/// * Leap Motion Support, enables support for Leap Motion (Plus, Pro)
|
||||
/// * Kinect 1 Support, enables support for Microsoft Kinect 360/Kinect for Windows (Plus, Pro)
|
||||
/// * Kinect 2 Support, enables support for Microsoft Kinect 2 (Plus, Pro)
|
||||
/// * Azure Kinect Support, enables support for Azure Kinect (Plus, Pro)
|
||||
/// * Orbbec Astra Support, enables support for Orbbec Astra (Plus, Pro)
|
||||
/// * Hydra Support, enables support for Razer Hydra (Pro)
|
||||
/// * Tobii Support, enables support for Tobii desktop eye tracking (Pro)
|
||||
/// * Perception Neuron Support, enables support for Perception Neuron (Pro)
|
||||
/// * OptiTrack Support, enables support for OptiTrack (Pro)
|
||||
/// * Antilatency Support, enables support for Antilatency (Pro)
|
||||
///
|
||||
/// * The Testing Visitor selects which Visitor Scene will be used when a Site is started in Play mode.
|
||||
///
|
||||
//[System.Serializable]
|
||||
public class HumanoidPreferences : ScriptableObject {
|
||||
public static bool help = false;
|
||||
public const string settingsPath = "Assets/Passer/Humanoid/HumanoidPreferences.asset";
|
||||
|
||||
public Configuration configuration;
|
||||
|
||||
//internal static HumanoidPreferences GetOrCreateSettings() {
|
||||
// string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
||||
// humanoidPath = humanoidPath.Substring(0, humanoidPath.Length - 1); // strip last /
|
||||
// humanoidPath = humanoidPath.Substring(0, humanoidPath.LastIndexOf('/') + 1); // strip Scripts;
|
||||
// string settingsPath = "Assets" + humanoidPath + "HumanoidPreferences.asset";
|
||||
// HumanoidPreferences settings = AssetDatabase.LoadAssetAtPath<HumanoidPreferences>(settingsPath);
|
||||
// SerializedObject serializedSettings = new SerializedObject(settings);
|
||||
// if (settings == null) {
|
||||
// settings = CreateInstance<HumanoidPreferences>();
|
||||
|
||||
// AssetDatabase.CreateAsset(settings, settingsPath);
|
||||
// }
|
||||
// if (settings.configuration == null) {
|
||||
// string configurationString = EditorPrefs.GetString("HumanoidConfigurationKey", "DefaultConfiguration");
|
||||
// Configuration configuration = Configuration_Editor.LoadConfiguration(configurationString);
|
||||
// if (configuration == null) {
|
||||
// configurationString = "DefaultConfiguration";
|
||||
// Configuration_Editor.LoadConfiguration(configurationString);
|
||||
// if (configuration == null) {
|
||||
// Debug.Log("Created new Default Configuration");
|
||||
// // Create new Default Configuration
|
||||
// configuration = CreateInstance<Configuration>();
|
||||
// string path = "Assets" + humanoidPath + configurationString + ".asset";
|
||||
// AssetDatabase.CreateAsset(configuration, path);
|
||||
// AssetDatabase.SaveAssets();
|
||||
// }
|
||||
// }
|
||||
// SerializedProperty configurationProp = serializedSettings.FindProperty("configuration");
|
||||
// configurationProp.objectReferenceValue = configuration;
|
||||
// EditorUtility.SetDirty(settings);
|
||||
// }
|
||||
// serializedSettings.ApplyModifiedProperties();
|
||||
// return (HumanoidPreferences)serializedSettings.targetObject;//settings;
|
||||
//}
|
||||
|
||||
//internal static SerializedObject GetOrCreateSerializedSettings() {
|
||||
// string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
||||
// humanoidPath = humanoidPath.Substring(0, humanoidPath.Length - 1); // strip last /
|
||||
// humanoidPath = humanoidPath.Substring(0, humanoidPath.LastIndexOf('/') + 1); // strip Scripts;
|
||||
// string settingsPath = "Assets" + humanoidPath + "HumanoidPreferences.asset";
|
||||
// HumanoidPreferences settings = AssetDatabase.LoadAssetAtPath<HumanoidPreferences>(settingsPath);
|
||||
|
||||
// if (settings == null) {
|
||||
// Debug.Log("Created new Settings");
|
||||
// settings = CreateInstance<HumanoidPreferences>();
|
||||
|
||||
// AssetDatabase.CreateAsset(settings, settingsPath);
|
||||
// }
|
||||
// if (settings.configuration == null) {
|
||||
// Debug.Log("Settings Configuration is not set");
|
||||
// string configurationString = "DefaultConfiguration";
|
||||
// Configuration configuration = Configuration_Editor.LoadConfiguration(configurationString);
|
||||
// if (configuration == null) {
|
||||
// configurationString = "DefaultConfiguration";
|
||||
// Configuration_Editor.LoadConfiguration(configurationString);
|
||||
// if (configuration == null) {
|
||||
// Debug.Log("Created new Default Configuration");
|
||||
// // Create new Default Configuration
|
||||
// configuration = CreateInstance<Configuration>();
|
||||
// string path = "Assets" + humanoidPath + configurationString + ".asset";
|
||||
// AssetDatabase.CreateAsset(configuration, path);
|
||||
// AssetDatabase.SaveAssets();
|
||||
// }
|
||||
// }
|
||||
// settings.configuration = configuration;
|
||||
// }
|
||||
// SerializedObject serializedSettings = new SerializedObject(settings);
|
||||
// return serializedSettings;
|
||||
//}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private const string networkingSupportKey = "HumanoidNetworkingSupport";
|
||||
public static NetworkingSystems networkingSupport {
|
||||
get {
|
||||
NetworkingSystems networkingSupport = (NetworkingSystems)EditorPrefs.GetInt(networkingSupportKey, 0);
|
||||
return networkingSupport;
|
||||
}
|
||||
set {
|
||||
EditorPrefs.SetInt(networkingSupportKey, (int)value);
|
||||
}
|
||||
}
|
||||
|
||||
private const string visitorSceneNameKey = "VisitorSceneName";
|
||||
public static string visitorSceneName {
|
||||
get {
|
||||
string visitorSceneName = EditorPrefs.GetString(visitorSceneNameKey, "");
|
||||
return visitorSceneName;
|
||||
}
|
||||
set {
|
||||
EditorPrefs.SetString(visitorSceneNameKey, value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
static class HumanoidPreferencesIMGUIRegister {
|
||||
//public static bool reload;
|
||||
|
||||
[SettingsProvider]
|
||||
public static SettingsProvider CreateHumanoidSettingsProvider() {
|
||||
var provider = new SettingsProvider("Preferences/HumanoidControlSettings", SettingsScope.User) {
|
||||
label = "Humanoid Control",
|
||||
guiHandler = (searchContext) => {
|
||||
|
||||
VisitorSceneInspector();
|
||||
|
||||
},
|
||||
keywords = new HashSet<string>(
|
||||
new[] { "Humanoid", "Oculus", "SteamVR" }
|
||||
)
|
||||
};
|
||||
return provider;
|
||||
}
|
||||
|
||||
private static string[] visitorNames;
|
||||
private static bool VisitorSceneInspector() {
|
||||
string visitorScenePath = HumanoidPreferences.visitorSceneName;
|
||||
|
||||
SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(visitorScenePath);
|
||||
sceneAsset = (SceneAsset) EditorGUILayout.ObjectField("Visitor Scene", sceneAsset, typeof(SceneAsset), false);
|
||||
visitorScenePath = AssetDatabase.GetAssetPath(sceneAsset);
|
||||
|
||||
bool anyChanged = visitorScenePath != HumanoidPreferences.visitorSceneName;
|
||||
|
||||
HumanoidPreferences.visitorSceneName = visitorScenePath;
|
||||
|
||||
return anyChanged;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a3c0fc4c73d35b419d46a829c66a232
|
||||
timeCreated: 1559823791
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1db13c7a2ec237b4caee962814512306
|
||||
folderAsset: yes
|
||||
timeCreated: 1480088539
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 686cf920b09d4d645a864e3d18018632
|
||||
folderAsset: yes
|
||||
timeCreated: 1480088552
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,42 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public class Angle {
|
||||
// Normalize an angle to the range -180 < angle <= 180
|
||||
public static float Normalize(float angle) {
|
||||
while (angle <= -180) angle += 360;
|
||||
while (angle > 180) angle -= 360;
|
||||
return angle;
|
||||
}
|
||||
|
||||
// clamp the angle between the given min and max values
|
||||
// Angles are normalized
|
||||
public static float Clamp(float angle, float min, float max) {
|
||||
float normalizedAngle = Normalize(angle);
|
||||
return Mathf.Clamp(normalizedAngle, min, max);
|
||||
}
|
||||
}
|
||||
|
||||
public struct Angles {
|
||||
// Normalize all vector angles to the range -180 < angle < 180
|
||||
public static Vector Normalize(Vector angles) {
|
||||
float x = Angle.Normalize(angles.x);
|
||||
float y = Angle.Normalize(angles.y);
|
||||
float z = Angle.Normalize(angles.z);
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
|
||||
// Clamp all vector acis between the given min and max values
|
||||
// Angles are normalized
|
||||
public static Vector Clamp(Vector angles, Vector min, Vector max) {
|
||||
float x = Angle.Clamp(angles.x, min.x, max.x);
|
||||
float y = Angle.Clamp(angles.y, min.y, max.y);
|
||||
float z = Angle.Clamp(angles.z, min.z, max.z);
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
|
||||
//public static Rotation ToRotation(Vector angles) {
|
||||
// return Rotation.Euler(angles.x, angles.y, angles.z);
|
||||
//}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6d14a63d690bb5449dc0fe3dbf0cf01
|
||||
timeCreated: 1535359362
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,310 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public struct Rotation {
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public float w;
|
||||
|
||||
public static Rotation identity {
|
||||
get {
|
||||
return new Rotation(0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public Rotation(float _x, float _y, float _z, float _w) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
w = _w;
|
||||
}
|
||||
|
||||
public Rotation(Vector _xyz, float _w) {
|
||||
x = _xyz.x;
|
||||
y = _xyz.y;
|
||||
z = _xyz.z;
|
||||
w = _w;
|
||||
}
|
||||
|
||||
public Vector xyz {
|
||||
set {
|
||||
x = value.x;
|
||||
y = value.y;
|
||||
z = value.z;
|
||||
}
|
||||
get {
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public float Length {
|
||||
get {
|
||||
return Mathf.Sqrt(x * x + y * y + z * z + w * w);
|
||||
}
|
||||
}
|
||||
|
||||
public float LengthSquared {
|
||||
get {
|
||||
return x * x + y * y + z * z + w * w;
|
||||
}
|
||||
}
|
||||
|
||||
public void Normalize() {
|
||||
float scale = 1.0f / this.Length;
|
||||
xyz *= scale;
|
||||
w *= scale;
|
||||
}
|
||||
public static Rotation Normalize(Rotation q) {
|
||||
Rotation result;
|
||||
Normalize(ref q, out result);
|
||||
return result;
|
||||
}
|
||||
public static void Normalize(ref Rotation q, out Rotation result) {
|
||||
float scale = 1.0f / q.Length;
|
||||
result = new Rotation(q.xyz * scale, q.w * scale);
|
||||
}
|
||||
|
||||
public static float Dot(Rotation a, Rotation b) {
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
||||
}
|
||||
|
||||
/* no the same as UnityEngine version!
|
||||
public static Rotation Euler(float x, float y, float z) {
|
||||
return FromEulerRad(new Vector(x, y, z) * Mathf.Deg2Rad);
|
||||
}
|
||||
private static Rotation FromEulerRad(Vector euler) {
|
||||
var yaw = euler.x;
|
||||
var pitch = euler.z;
|
||||
var roll = euler.y;
|
||||
|
||||
float rollOver2 = roll * 0.5f;
|
||||
float sinRollOver2 = (float)System.Math.Sin(rollOver2);
|
||||
float cosRollOver2 = (float)System.Math.Cos(rollOver2);
|
||||
float pitchOver2 = pitch * 0.5f;
|
||||
float sinPitchOver2 = (float)System.Math.Sin(pitchOver2);
|
||||
float cosPitchOver2 = (float)System.Math.Cos(pitchOver2);
|
||||
float yawOver2 = yaw * 0.5f;
|
||||
float sinYawOver2 = (float)System.Math.Sin(yawOver2);
|
||||
float cosYawOver2 = (float)System.Math.Cos(yawOver2);
|
||||
|
||||
Rotation result = identity;
|
||||
result.x = cosYawOver2 * cosPitchOver2 * cosRollOver2 + sinYawOver2 * sinPitchOver2 * sinRollOver2;
|
||||
result.y = cosYawOver2 * cosPitchOver2 * sinRollOver2 - sinYawOver2 * sinPitchOver2 * cosRollOver2;
|
||||
result.z = cosYawOver2 * sinPitchOver2 * cosRollOver2 + sinYawOver2 * cosPitchOver2 * sinRollOver2;
|
||||
result.w = sinYawOver2 * cosPitchOver2 * cosRollOver2 - cosYawOver2 * sinPitchOver2 * sinRollOver2;
|
||||
return result;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public static Vector ToAngles(Rotation q1) {
|
||||
float test = q1.x * q1.y + q1.z * q1.w;
|
||||
if (test > 0.499) { // singularity at north pole
|
||||
return new Vector(
|
||||
0,
|
||||
2 * Mathf.Atan2(q1.x, q1.w) * Mathf.Rad2Deg,
|
||||
90
|
||||
);
|
||||
}
|
||||
else if (test < -0.499) { // singularity at south pole
|
||||
return new Vector(
|
||||
0,
|
||||
-2 * Mathf.Atan2(q1.x, q1.w) * Mathf.Rad2Deg,
|
||||
-90
|
||||
);
|
||||
}
|
||||
else {
|
||||
float sqx = q1.x * q1.x;
|
||||
float sqy = q1.y * q1.y;
|
||||
float sqz = q1.z * q1.z;
|
||||
|
||||
return new Vector(
|
||||
Mathf.Atan2(2 * q1.x * q1.w - 2 * q1.y * q1.z, 1 - 2 * sqx - 2 * sqz) * Mathf.Rad2Deg,
|
||||
Mathf.Atan2(2 * q1.y * q1.w - 2 * q1.x * q1.z, 1 - 2 * sqy - 2 * sqz) * Mathf.Rad2Deg,
|
||||
Mathf.Asin(2 * test) * Mathf.Rad2Deg
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//public static Rotation Clamp(Rotation o, Vector min, Vector max) {
|
||||
// Vector angles = ToAngles(o);
|
||||
// angles = Angles.Clamp(angles, min, max);
|
||||
// return Rotation.Euler(angles); // Angles.ToRotation(angles);
|
||||
//}
|
||||
|
||||
public static Rotation operator *(Rotation r1, Rotation r2) {
|
||||
return new Rotation(
|
||||
r1.x * r2.w + r1.y * r2.z - r1.z * r2.y + r1.w * r2.x,
|
||||
-r1.x * r2.z + r1.y * r2.w + r1.z * r2.x + r1.w * r2.y,
|
||||
r1.x * r2.y - r1.y * r2.x + r1.z * r2.w + r1.w * r2.z,
|
||||
-r1.x * r2.x - r1.y * r2.y - r1.z * r2.z + r1.w * r2.w
|
||||
);
|
||||
}
|
||||
|
||||
public static Rotation Inverse(Rotation r) {
|
||||
float n = Mathf.Sqrt(r.x * r.x + r.y * r.y + r.z * r.z + r.w * r.w);
|
||||
return new Rotation(-r.x / n, -r.y / n, -r.z / n, r.w / n);
|
||||
}
|
||||
|
||||
public static Rotation LookRotation(Vector forward, Vector upwards) {
|
||||
return LookRotation(ref forward, ref upwards);
|
||||
}
|
||||
public static Rotation LookRotation(Vector forward) {
|
||||
Vector up = Vector.up;
|
||||
return LookRotation(ref forward, ref up);
|
||||
}
|
||||
private static Rotation LookRotation(ref Vector forward, ref Vector up) {
|
||||
forward = Vector.Normalize(forward);
|
||||
Vector right = Vector.Normalize(Vector.Cross(up, forward));
|
||||
up = Vector.Cross(forward, right);
|
||||
var m00 = right.x;
|
||||
var m01 = right.y;
|
||||
var m02 = right.z;
|
||||
var m10 = up.x;
|
||||
var m11 = up.y;
|
||||
var m12 = up.z;
|
||||
var m20 = forward.x;
|
||||
var m21 = forward.y;
|
||||
var m22 = forward.z;
|
||||
|
||||
|
||||
float num8 = (m00 + m11) + m22;
|
||||
var quaternion = identity;
|
||||
if (num8 > 0f) {
|
||||
var num = Mathf.Sqrt(num8 + 1f);
|
||||
quaternion.w = num * 0.5f;
|
||||
num = 0.5f / num;
|
||||
quaternion.x = (m12 - m21) * num;
|
||||
quaternion.y = (m20 - m02) * num;
|
||||
quaternion.z = (m01 - m10) * num;
|
||||
return quaternion;
|
||||
}
|
||||
if ((m00 >= m11) && (m00 >= m22)) {
|
||||
var num7 = Mathf.Sqrt(((1f + m00) - m11) - m22);
|
||||
var num4 = 0.5f / num7;
|
||||
quaternion.x = 0.5f * num7;
|
||||
quaternion.y = (m01 + m10) * num4;
|
||||
quaternion.z = (m02 + m20) * num4;
|
||||
quaternion.w = (m12 - m21) * num4;
|
||||
return quaternion;
|
||||
}
|
||||
if (m11 > m22) {
|
||||
var num6 = Mathf.Sqrt(((1f + m11) - m00) - m22);
|
||||
var num3 = 0.5f / num6;
|
||||
quaternion.x = (m10 + m01) * num3;
|
||||
quaternion.y = 0.5f * num6;
|
||||
quaternion.z = (m21 + m12) * num3;
|
||||
quaternion.w = (m20 - m02) * num3;
|
||||
return quaternion;
|
||||
}
|
||||
var num5 = (float)System.Math.Sqrt(((1f + m22) - m00) - m11);
|
||||
var num2 = 0.5f / num5;
|
||||
quaternion.x = (m20 + m02) * num2;
|
||||
quaternion.y = (m21 + m12) * num2;
|
||||
quaternion.z = 0.5f * num5;
|
||||
quaternion.w = (m01 - m10) * num2;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/* Does not work correctly!
|
||||
public static Rotation FromToRotation(Vector fromDirection, Vector toDirection) {
|
||||
return RotateTowards(LookRotation(fromDirection), LookRotation(toDirection), float.MaxValue);
|
||||
}
|
||||
//*/
|
||||
|
||||
public static Rotation RotateTowards(Rotation from, Rotation to, float maxDegreesDelta) {
|
||||
float num = Angle(from, to);
|
||||
if (num == 0f) {
|
||||
return to;
|
||||
}
|
||||
float t = Mathf.Min(1f, maxDegreesDelta / num);
|
||||
return SlerpUnclamped(from, to, t);
|
||||
}
|
||||
|
||||
public static Rotation AngleAxis(float angle, Vector axis) {
|
||||
return AngleAxis(angle, ref axis);
|
||||
}
|
||||
private static Rotation AngleAxis(float degress, ref Vector axis) {
|
||||
if (Vector.SqrMagnitude(axis) == 0.0f)
|
||||
return identity;
|
||||
|
||||
Rotation result = identity;
|
||||
var radians = degress * Mathf.Deg2Rad;
|
||||
radians *= 0.5f;
|
||||
Vector.Normalize(axis);
|
||||
axis = axis * (float)System.Math.Sin(radians);
|
||||
result.x = axis.x;
|
||||
result.y = axis.y;
|
||||
result.z = axis.z;
|
||||
result.w = (float)System.Math.Cos(radians);
|
||||
|
||||
return Normalize(result);
|
||||
}
|
||||
|
||||
public static float Angle(Rotation a, Rotation b) {
|
||||
float f = Rotation.Dot(a, b);
|
||||
return Mathf.Acos(Mathf.Min(Mathf.Abs(f), 1f)) * 2f * Mathf.Rad2Deg;
|
||||
}
|
||||
|
||||
public static Rotation Slerp(Rotation a, Rotation b, float t) {
|
||||
return Slerp(ref a, ref b, t);
|
||||
}
|
||||
private static Rotation Slerp(ref Rotation a, ref Rotation b, float t) {
|
||||
if (t > 1) t = 1;
|
||||
if (t < 0) t = 0;
|
||||
return SlerpUnclamped(ref a, ref b, t);
|
||||
}
|
||||
|
||||
public static Rotation SlerpUnclamped(Rotation a, Rotation b, float t) {
|
||||
return SlerpUnclamped(ref a, ref b, t);
|
||||
}
|
||||
private static Rotation SlerpUnclamped(ref Rotation a, ref Rotation b, float t) {
|
||||
// if either input is zero, return the other.
|
||||
if (a.LengthSquared == 0.0f) {
|
||||
if (b.LengthSquared == 0.0f) {
|
||||
return identity;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
else if (b.LengthSquared == 0.0f) {
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
float cosHalfAngle = a.w * b.w + Vector.Dot(a.xyz, b.xyz);
|
||||
|
||||
if (cosHalfAngle >= 1.0f || cosHalfAngle <= -1.0f) {
|
||||
// angle = 0.0f, so just return one input.
|
||||
return a;
|
||||
}
|
||||
else if (cosHalfAngle < 0.0f) {
|
||||
b.xyz = -b.xyz;
|
||||
b.w = -b.w;
|
||||
cosHalfAngle = -cosHalfAngle;
|
||||
}
|
||||
|
||||
float blendA;
|
||||
float blendB;
|
||||
if (cosHalfAngle < 0.99f) {
|
||||
// do proper slerp for big angles
|
||||
float halfAngle = (float)System.Math.Acos(cosHalfAngle);
|
||||
float sinHalfAngle = (float)System.Math.Sin(halfAngle);
|
||||
float oneOverSinHalfAngle = 1.0f / sinHalfAngle;
|
||||
blendA = (float)System.Math.Sin(halfAngle * (1.0f - t)) * oneOverSinHalfAngle;
|
||||
blendB = (float)System.Math.Sin(halfAngle * t) * oneOverSinHalfAngle;
|
||||
}
|
||||
else {
|
||||
// do lerp if angle is really small.
|
||||
blendA = 1.0f - t;
|
||||
blendB = t;
|
||||
}
|
||||
|
||||
Rotation result = new Rotation(blendA * a.xyz + blendB * b.xyz, blendA * a.w + blendB * b.w);
|
||||
if (result.LengthSquared > 0.0f)
|
||||
return Normalize(result);
|
||||
else
|
||||
return identity;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60acb0a725c6dd64fb0044ce3a03bbbd
|
||||
timeCreated: 1535358987
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8384e7e3f7b6e54181b1f2078019a21
|
||||
folderAsset: yes
|
||||
timeCreated: 1535359545
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,35 +0,0 @@
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
|
||||
public class ControllerButtons {
|
||||
public float stickHorizontal;
|
||||
public float stickVertical;
|
||||
public bool stickPress;
|
||||
public bool stickTouch;
|
||||
public bool up;
|
||||
public bool down;
|
||||
public bool left;
|
||||
public bool right;
|
||||
|
||||
public bool[] buttons = new bool[4];
|
||||
|
||||
public float trigger1;
|
||||
public float trigger2;
|
||||
|
||||
public bool option;
|
||||
}
|
||||
|
||||
public class ArmController : ArmSensor {
|
||||
|
||||
|
||||
public ControllerButtons input;
|
||||
|
||||
public ArmController(bool isLeft, DeviceView deviceView) : base(isLeft, deviceView) {
|
||||
input = new ControllerButtons();
|
||||
}
|
||||
|
||||
public virtual void UpdateInput() { }
|
||||
|
||||
public virtual void Vibrate(float length, float strength) { }
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d2f20550b201514cb4e927eb7281965
|
||||
timeCreated: 1535359205
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,98 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public enum FingerBones {
|
||||
Proximal = 0,
|
||||
Intermediate = 1,
|
||||
Distal = 2,
|
||||
LastBone = 3
|
||||
}
|
||||
|
||||
public class ArmSensor : Sensor {
|
||||
public bool isLeft;
|
||||
|
||||
public TargetData shoulder;
|
||||
public TargetData upperArm;
|
||||
public TargetData forearm;
|
||||
public TargetData hand;
|
||||
|
||||
public class Finger {
|
||||
public float curl;
|
||||
public TargetData proximal = new TargetData();
|
||||
public TargetData intermediate = new TargetData();
|
||||
public TargetData distal = new TargetData();
|
||||
}
|
||||
|
||||
public Finger thumb;
|
||||
public Finger indexFinger;
|
||||
public Finger middleFinger;
|
||||
public Finger ringFinger;
|
||||
public Finger littleFinger;
|
||||
public Finger[] fingers;
|
||||
|
||||
public ArmSensor(bool isLeft, DeviceView deviceView) : base(deviceView) {
|
||||
this.isLeft = isLeft;
|
||||
|
||||
shoulder = new TargetData();
|
||||
upperArm = new TargetData();
|
||||
forearm = new TargetData();
|
||||
hand = new TargetData();
|
||||
|
||||
thumb = new Finger();
|
||||
indexFinger = new Finger();
|
||||
middleFinger = new Finger();
|
||||
ringFinger = new Finger();
|
||||
littleFinger = new Finger();
|
||||
|
||||
fingers = new Finger[] {
|
||||
thumb,
|
||||
indexFinger,
|
||||
middleFinger,
|
||||
ringFinger,
|
||||
littleFinger
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual void UpdateHand() {
|
||||
hand.rotation = _sensorRotation * _sensor2TargetRotation;
|
||||
hand.confidence.rotation = _rotationConfidence;
|
||||
|
||||
hand.position = _sensorPosition + hand.rotation * _sensor2TargetPosition;
|
||||
hand.confidence.position = _positionConfidence;
|
||||
}
|
||||
|
||||
private const float Rad2Deg = 57.29578F;
|
||||
public static Rotation CalculateUpperArmOrientation(Vector upperArmPosition, float upperArmLength, Vector forearmUp, float forearmLength, Vector handPosition, bool isLeft) {
|
||||
Rotation upperArmRotation = Rotation.LookRotation(handPosition - upperArmPosition, forearmUp);
|
||||
|
||||
float upperArm2HandDistance = Vector.Distance(upperArmPosition, handPosition);
|
||||
float upperArm2HandDistance2 = upperArm2HandDistance * upperArm2HandDistance;
|
||||
float upperArmLength2 = upperArmLength * upperArmLength;
|
||||
float forearmLength2 = forearmLength * forearmLength;
|
||||
float elbowAngle = (float)System.Math.Acos((upperArm2HandDistance2 + upperArmLength2 - forearmLength2) / (2 * upperArm2HandDistance * upperArmLength)) * Rad2Deg;
|
||||
if (float.IsNaN(elbowAngle)) elbowAngle = 10;
|
||||
if (isLeft)
|
||||
elbowAngle = -elbowAngle;
|
||||
|
||||
upperArmRotation = Rotation.AngleAxis(elbowAngle, upperArmRotation * Vector.up) * upperArmRotation;
|
||||
|
||||
if (isLeft)
|
||||
upperArmRotation *= Rotation.AngleAxis(90, Vector.up); // Euler(0, 90, 0)
|
||||
else
|
||||
upperArmRotation *= Rotation.AngleAxis(-90, Vector.up); // Euler(0, -90, 0)
|
||||
|
||||
return upperArmRotation;
|
||||
}
|
||||
public static Rotation CalculateArmOrientation(Vector joint1Position, Vector joint1Up, Vector joint2Position, bool isLeft) {
|
||||
Vector boneForward = joint2Position - joint1Position;
|
||||
Rotation boneRotation = Rotation.LookRotation(boneForward, joint1Up);
|
||||
|
||||
if (isLeft)
|
||||
boneRotation *= Rotation.AngleAxis(90, Vector.up); // Euler(0, 90, 0)
|
||||
else
|
||||
boneRotation *= Rotation.AngleAxis(-90, Vector.up); // Euler(0, -90, 0)
|
||||
|
||||
return boneRotation;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f0192b954f10bb48966e97356dc05f3
|
||||
timeCreated: 1535359219
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,91 +0,0 @@
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public enum FaceBone {
|
||||
LeftOuterBrow,
|
||||
LeftBrow,
|
||||
LeftInnerBrow,
|
||||
RightInnerBrow,
|
||||
RightBrow,
|
||||
RightOuterBrow,
|
||||
|
||||
LeftCheek,
|
||||
RightCheek,
|
||||
|
||||
NoseTopLeft,
|
||||
NoseTop,
|
||||
NoseTopRight,
|
||||
NoseTip,
|
||||
NoseBottomLeft,
|
||||
NoseBottom,
|
||||
NoseBottomRight,
|
||||
|
||||
UpperLipLeft,
|
||||
UpperLip,
|
||||
UpperLipRight,
|
||||
LipLeft,
|
||||
LipRight,
|
||||
LowerLipLeft,
|
||||
LowerLip,
|
||||
LowerLipRight,
|
||||
LastBone
|
||||
}
|
||||
|
||||
public class FaceSensor : Sensor {
|
||||
public TrackedBrow leftBrow = new TrackedBrow();
|
||||
public TrackedBrow rightBrow = new TrackedBrow();
|
||||
|
||||
public TrackedEye leftEye = new TrackedEye();
|
||||
public TrackedEye rightEye = new TrackedEye();
|
||||
|
||||
public TargetData leftCheek = new TargetData();
|
||||
public TargetData rightCheek = new TargetData();
|
||||
|
||||
public TrackedNose nose = new TrackedNose();
|
||||
|
||||
public TrackedMouth mouth = new TrackedMouth();
|
||||
|
||||
public TargetData jaw = new TargetData();
|
||||
|
||||
public float smile;
|
||||
public float pucker;
|
||||
public float frown;
|
||||
|
||||
public FaceSensor(DeviceView deviceView) : base(deviceView) { }
|
||||
|
||||
public class TrackedBrow {
|
||||
public TargetData inner;
|
||||
public TargetData center;
|
||||
public TargetData outer;
|
||||
}
|
||||
|
||||
public class TrackedEye {
|
||||
public float closed;
|
||||
}
|
||||
|
||||
public class TrackedNose {
|
||||
public TargetData top;
|
||||
public TargetData topLeft;
|
||||
public TargetData topRight;
|
||||
public TargetData tip;
|
||||
public TargetData bottom;
|
||||
public TargetData bottomLeft;
|
||||
public TargetData bottomRight;
|
||||
}
|
||||
|
||||
public class TrackedMouth {
|
||||
public TargetData upperLipLeft;
|
||||
public TargetData upperLip;
|
||||
public TargetData upperLipRight;
|
||||
|
||||
public TargetData lipLeft;
|
||||
public TargetData lipRight;
|
||||
|
||||
public TargetData lowerLipLeft;
|
||||
public TargetData lowerLip;
|
||||
public TargetData lowerLipRight;
|
||||
}
|
||||
|
||||
public class FaceTargetData : TargetData {
|
||||
public new Vector startPosition;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0daaa99661b2a6845ada7430949365d2
|
||||
timeCreated: 1535359279
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,72 +0,0 @@
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
/// <summary>
|
||||
/// Humanoid head tracking sensor
|
||||
/// </summary>
|
||||
public class HeadSensor : Sensor {
|
||||
public TargetData neck;
|
||||
public TargetData head;
|
||||
|
||||
//public TrackedBrow leftBrow;
|
||||
//public TrackedBrow rightBrow;
|
||||
|
||||
//public TrackedEye leftEye;
|
||||
//public TrackedEye rightEye;
|
||||
|
||||
//public TrackedMouth mouth;
|
||||
|
||||
//public TargetData jaw;
|
||||
|
||||
//public float smile;
|
||||
|
||||
public HeadSensor(DeviceView deviceView) : base(deviceView) {
|
||||
neck = new TargetData();
|
||||
head = new TargetData();
|
||||
|
||||
// leftBrow = new TrackedBrow();
|
||||
// rightBrow = new TrackedBrow();
|
||||
|
||||
// leftEye = new TrackedEye();
|
||||
// rightEye = new TrackedEye();
|
||||
|
||||
// mouth = new TrackedMouth();
|
||||
|
||||
// jaw = new TargetData();
|
||||
}
|
||||
|
||||
//public class TrackedBrow {
|
||||
// public TargetData inner;
|
||||
// public TargetData center;
|
||||
// public TargetData outer;
|
||||
//}
|
||||
|
||||
//public class TrackedEye {
|
||||
// public float closed;
|
||||
//}
|
||||
|
||||
//public class TrackedMouth {
|
||||
// public TargetData upperLipLeft;
|
||||
// public TargetData upperLip;
|
||||
// public TargetData upperLipRight;
|
||||
|
||||
// public TargetData lipLeft;
|
||||
// public TargetData lipRight;
|
||||
|
||||
// public TargetData lowerLipLeft;
|
||||
// public TargetData lowerLip;
|
||||
// public TargetData lowerLipRight;
|
||||
|
||||
// //public TrackedMouth() {
|
||||
// // upperLipLeft = new TargetData();
|
||||
// // upperLip = new TargetData();
|
||||
// // upperLipRight = new TargetData();
|
||||
|
||||
// // lipLeft = new TargetData();
|
||||
// // lipRight = new TargetData();
|
||||
|
||||
// // lowerLipLeft = new TargetData();
|
||||
// // lowerLip = new TargetData();
|
||||
// // lowerLipRight = new TargetData();
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d29807d7513f6fb4c877730de91a1bd0
|
||||
timeCreated: 1535359169
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,27 +0,0 @@
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
|
||||
public class LegSensor : Sensor {
|
||||
public bool isLeft;
|
||||
|
||||
public TargetData upperLeg;
|
||||
public TargetData lowerLeg;
|
||||
public TargetData foot;
|
||||
|
||||
public LegSensor(bool isLeft, DeviceView deviceView) : base(deviceView) {
|
||||
this.isLeft = isLeft;
|
||||
|
||||
upperLeg = new TargetData();
|
||||
lowerLeg = new TargetData();
|
||||
foot = new TargetData();
|
||||
}
|
||||
|
||||
public static Rotation CalculateLegOrientation(Vector joint1Position, Vector joint2Position, Rotation hipsRotation) {
|
||||
Vector boneUp = hipsRotation * Vector.back;
|
||||
Vector boneForward = Rotation.AngleAxis(180, Vector.up) * (joint2Position - joint1Position);
|
||||
Rotation boneRotation = Rotation.LookRotation(boneForward, boneUp);
|
||||
boneRotation *= Rotation.AngleAxis(270, Vector.right);
|
||||
return boneRotation;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdbde1b8cd99fa54a8f081318df158d0
|
||||
timeCreated: 1535359302
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,192 +0,0 @@
|
||||
using UnityEngine; // This should disappear!
|
||||
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public class Rotation_ {
|
||||
public static Rotation Euler(Vector v) {
|
||||
return Euler(v.x, v.y, v.z);
|
||||
}
|
||||
|
||||
public static Rotation Euler(float x, float y, float z) {
|
||||
// temporary...
|
||||
Quaternion q = Quaternion.Euler(x, y, z);
|
||||
return new Rotation(q.x, q.y, q.z, q.w);
|
||||
}
|
||||
|
||||
public static Rotation FromToRotation(Vector v1, Vector v2) {
|
||||
Vector3 uv1 = HumanoidTarget.ToVector3(v1);
|
||||
Vector3 uv2 = HumanoidTarget.ToVector3(v2);
|
||||
Quaternion r = Quaternion.FromToRotation(uv1, uv2);
|
||||
return HumanoidTarget.ToRotation(r);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Humanoid Tracking sensor
|
||||
/// </summary>
|
||||
public class Sensor {
|
||||
/// <summary>
|
||||
/// The device to which the sensor belongs
|
||||
/// </summary>
|
||||
public DeviceView device;
|
||||
|
||||
/// <summary>
|
||||
/// Status of the sensor
|
||||
/// </summary>
|
||||
public Tracker.Status status = Tracker.Status.Unavailable;
|
||||
|
||||
public struct State {
|
||||
public int sensorID;
|
||||
public Vector position;
|
||||
public Rotation rotation;
|
||||
public float confidence;
|
||||
public bool present;
|
||||
}
|
||||
|
||||
public enum ID {
|
||||
Head,
|
||||
LeftHand,
|
||||
RightHand,
|
||||
Hips,
|
||||
LeftFoot,
|
||||
RightFoot,
|
||||
|
||||
Tracker1,
|
||||
Tracker2,
|
||||
Tracker3,
|
||||
Tracker4,
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create new sensor the the device
|
||||
/// </summary>
|
||||
/// <param name="_device"></param>
|
||||
public Sensor(DeviceView _device) {
|
||||
device = _device;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the sensor state
|
||||
/// </summary>
|
||||
/// <returns>Status of the sensor after the update</returns>
|
||||
public virtual Tracker.Status Update() {
|
||||
return Tracker.Status.Unavailable;
|
||||
}
|
||||
|
||||
public static Rotation CalculateBoneRotation(Vector bonePosition, Vector parentBonePosition, Vector upDirection) {
|
||||
Vector direction = bonePosition - parentBonePosition;
|
||||
if (Vector.Magnitude(direction) > 0) {
|
||||
return Rotation.LookRotation(direction, upDirection);
|
||||
}
|
||||
else
|
||||
return Rotation.identity;
|
||||
}
|
||||
|
||||
// The tracker's position and rotation
|
||||
protected Vector _localSensorPosition;
|
||||
public Vector localSensorPosition {
|
||||
get { return _localSensorPosition; }
|
||||
}
|
||||
protected Rotation _localSensorRotation;
|
||||
public Rotation localSensorRotation {
|
||||
get { return _localSensorRotation; }
|
||||
}
|
||||
|
||||
protected Vector _sensorPosition;
|
||||
public Vector sensorPosition {
|
||||
get { return _sensorPosition; }
|
||||
}
|
||||
protected Rotation _sensorRotation;
|
||||
public Rotation sensorRotation {
|
||||
get { return _sensorRotation; }
|
||||
}
|
||||
|
||||
protected void UpdateSensor() {
|
||||
_sensorRotation = device.ToWorldOrientation(_localSensorRotation);
|
||||
_sensorPosition = device.ToWorldPosition(_localSensorPosition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracking confidence
|
||||
/// </summary>
|
||||
protected float _positionConfidence;
|
||||
public float positionConfidence {
|
||||
get { return _positionConfidence; }
|
||||
}
|
||||
protected float _rotationConfidence;
|
||||
public float rotationConfidence {
|
||||
get { return _rotationConfidence; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The position of the tracker relative to the origin of the object it is tracking
|
||||
/// </summary>
|
||||
protected Vector _sensor2TargetPosition = Vector.zero;
|
||||
public Vector sensor2TargetPosition {
|
||||
set { _sensor2TargetPosition = value; }
|
||||
get { return _sensor2TargetPosition; }
|
||||
}
|
||||
protected Rotation _sensor2TargetRotation = Rotation.identity;
|
||||
public Rotation sensor2TargetRotation {
|
||||
set { _sensor2TargetRotation = value; }
|
||||
get { return _sensor2TargetRotation; }
|
||||
}
|
||||
}
|
||||
|
||||
public class Controller : Sensor {
|
||||
public Controller(DeviceView _device) : base(_device) { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Most of these should move to difference files...
|
||||
|
||||
public enum Status {
|
||||
Unavailable,
|
||||
Present,
|
||||
Tracking
|
||||
}
|
||||
|
||||
public class TargetData {
|
||||
public Vector position = Vector.zero;
|
||||
public Rotation rotation = Rotation.identity;
|
||||
public float length;
|
||||
public Confidence confidence;
|
||||
|
||||
public Vector startPosition = Vector.zero;
|
||||
}
|
||||
|
||||
public struct Confidence {
|
||||
public float position { get; set; }
|
||||
public float rotation { get; set; }
|
||||
public float length { get; set; }
|
||||
|
||||
private const float degradationPerFrame = -0.01F; // PER FRAME!!!!
|
||||
public void Degrade() {
|
||||
position = Mathf.Clamp01(position + degradationPerFrame);
|
||||
rotation = Mathf.Clamp01(rotation + degradationPerFrame);
|
||||
length = Mathf.Clamp01(length + degradationPerFrame);
|
||||
}
|
||||
|
||||
public static Confidence none {
|
||||
get {
|
||||
return new Confidence { position = 0, rotation = 0, length = 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceView {
|
||||
public Vector position;
|
||||
public Rotation orientation;
|
||||
|
||||
public virtual Vector ToWorldPosition(Vector localPosition) {
|
||||
return position + orientation * localPosition;
|
||||
}
|
||||
|
||||
public virtual Rotation ToWorldOrientation(Rotation localRotation) {
|
||||
return orientation * localRotation;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8da3cffabf9d3c4096196cde2e96374
|
||||
timeCreated: 1480088564
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,13 +0,0 @@
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public class TorsoSensor : Sensor {
|
||||
public TargetData chest;
|
||||
public TargetData spine;
|
||||
public TargetData hips;
|
||||
|
||||
public TorsoSensor(DeviceView deviceView) : base(deviceView) {
|
||||
chest = new TargetData();
|
||||
spine = new TargetData();
|
||||
hips = new TargetData();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23f5d07c0f866854da1e575474ce727d
|
||||
timeCreated: 1535359326
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,97 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
public struct Vector {
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public static Vector zero { get { return new Vector(0, 0, 0); } }
|
||||
public static Vector right { get { return new Vector(1, 0, 0); } }
|
||||
public static Vector up { get { return new Vector(0, 1, 0); } }
|
||||
public static Vector forward { get { return new Vector(0, 0, 1); } }
|
||||
public static Vector back { get { return new Vector(0, 0, -1); } }
|
||||
|
||||
public Vector(float _x, float _y, float _z) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
}
|
||||
|
||||
public static float Magnitude(Vector a) {
|
||||
return Mathf.Sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
|
||||
}
|
||||
|
||||
public static float SqrMagnitude(Vector a) {
|
||||
return a.x * a.x + a.y * a.y + a.z * a.z;
|
||||
}
|
||||
|
||||
public static Vector Normalize(Vector v) {
|
||||
float num = Magnitude(v);
|
||||
Vector result;
|
||||
if (num > 1E-05f) {
|
||||
result = v / num;
|
||||
}
|
||||
else {
|
||||
result = zero;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static Vector operator -(Vector p1) {
|
||||
return new Vector(-p1.x, -p1.y, -p1.z);
|
||||
}
|
||||
public static Vector operator -(Vector p1, Vector p2) {
|
||||
return new Vector(p1.x - p2.x, p1.y - p2.y, p1.z - p2.z);
|
||||
}
|
||||
public static Vector operator +(Vector p1, Vector t1) {
|
||||
return new Vector(p1.x + t1.x, p1.y + t1.y, p1.z + t1.z);
|
||||
}
|
||||
public static Vector Scale(Vector p1, Vector p2) {
|
||||
return new Vector(p1.x * p2.x, p1.y * p2.y, p1.z * p2.z);
|
||||
}
|
||||
public static Vector operator *(float f, Vector p) {
|
||||
return new Vector(f * p.x, f * p.y, f * p.z);
|
||||
}
|
||||
public static Vector operator *(Vector p, float f) {
|
||||
return new Vector(p.x * f, p.y * f, p.z * f);
|
||||
}
|
||||
public static Vector operator *(Rotation o, Vector p) {
|
||||
float num = o.x * 2f;
|
||||
float num2 = o.y * 2f;
|
||||
float num3 = o.z * 2f;
|
||||
float num4 = o.x * num;
|
||||
float num5 = o.y * num2;
|
||||
float num6 = o.z * num3;
|
||||
float num7 = o.x * num2;
|
||||
float num8 = o.x * num3;
|
||||
float num9 = o.y * num3;
|
||||
float num10 = o.w * num;
|
||||
float num11 = o.w * num2;
|
||||
float num12 = o.w * num3;
|
||||
Vector result = Vector.zero;
|
||||
result.x = (1f - (num5 + num6)) * p.x + (num7 - num12) * p.y + (num8 + num11) * p.z;
|
||||
result.y = (num7 + num12) * p.x + (1f - (num4 + num6)) * p.y + (num9 - num10) * p.z;
|
||||
result.z = (num8 - num11) * p.x + (num9 + num10) * p.y + (1f - (num4 + num5)) * p.z;
|
||||
return result;
|
||||
}
|
||||
public static Vector operator /(Vector a, float d) {
|
||||
return new Vector(a.x / d, a.y / d, a.z / d);
|
||||
}
|
||||
|
||||
public static float Dot(Vector v1, Vector v2) {
|
||||
return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
|
||||
}
|
||||
|
||||
public static float Distance(Vector p1, Vector p2) {
|
||||
return Magnitude(p1 - p2);
|
||||
}
|
||||
|
||||
public static Vector Cross(Vector v1, Vector v2) {
|
||||
return new Vector(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
|
||||
}
|
||||
|
||||
//public float Length() {
|
||||
// return Mathf.Sqrt(x * x + y * y + z * z);
|
||||
//}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc399eafe69085649961ea3ea4bcf729
|
||||
timeCreated: 1535359025
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02c28d0bb00e7214eb7f47fb1563b3af
|
||||
folderAsset: yes
|
||||
timeCreated: 1483015126
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,940 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid.Tracking {
|
||||
|
||||
|
||||
public enum BoneType {
|
||||
AllBones,
|
||||
CenterBones,
|
||||
SideBones,
|
||||
FaceBones
|
||||
}
|
||||
|
||||
public enum Bone : byte {
|
||||
None,
|
||||
|
||||
#region Center Bones
|
||||
// Torso
|
||||
Hips,
|
||||
Spine,
|
||||
Spine1,
|
||||
Spine2,
|
||||
Chest,
|
||||
|
||||
// Head
|
||||
Neck,
|
||||
Head,
|
||||
#endregion
|
||||
|
||||
#region Left Side Bones
|
||||
// Left Arm
|
||||
LeftShoulder,
|
||||
LeftUpperArm,
|
||||
LeftForearm,
|
||||
LeftForearmTwist,
|
||||
LeftHand,
|
||||
|
||||
// Thumb
|
||||
LeftThumbProximal,
|
||||
LeftThumbIntermediate,
|
||||
LeftThumbDistal,
|
||||
|
||||
// Index Finger
|
||||
LeftIndexMetacarpal,
|
||||
LeftIndexProximal,
|
||||
LeftIndexIntermediate,
|
||||
LeftIndexDistal,
|
||||
|
||||
// Middle Finger
|
||||
LeftMiddleMetacarpal,
|
||||
LeftMiddleProximal,
|
||||
LeftMiddleIntermediate,
|
||||
LeftMiddleDistal,
|
||||
|
||||
// Ring Finger
|
||||
LeftRingMetacarpal,
|
||||
LeftRingProximal,
|
||||
LeftRingIntermediate,
|
||||
LeftRingDistal,
|
||||
|
||||
// Little Finger
|
||||
LeftLittleMetacarpal,
|
||||
LeftLittleProximal,
|
||||
LeftLittleIntermediate,
|
||||
LeftLittleDistal,
|
||||
|
||||
// Left Leg
|
||||
LeftUpperLeg,
|
||||
LeftLowerLeg,
|
||||
LeftFoot,
|
||||
LeftToes,
|
||||
#endregion
|
||||
|
||||
#region Right Side Bones
|
||||
// Right Arm
|
||||
RightShoulder,
|
||||
RightUpperArm,
|
||||
RightForearm,
|
||||
RightForearmTwist,
|
||||
RightHand,
|
||||
|
||||
// Thumb
|
||||
RightThumbProximal,
|
||||
RightThumbIntermediate,
|
||||
RightThumbDistal,
|
||||
|
||||
// Index Finger
|
||||
RightIndexMetacarpal,
|
||||
RightIndexProximal,
|
||||
RightIndexIntermediate,
|
||||
RightIndexDistal,
|
||||
|
||||
// Middle Finger
|
||||
RightMiddleMetacarpal,
|
||||
RightMiddleProximal,
|
||||
RightMiddleIntermediate,
|
||||
RightMiddleDistal,
|
||||
|
||||
// Ring Finger
|
||||
RightRingMetacarpal,
|
||||
RightRingProximal,
|
||||
RightRingIntermediate,
|
||||
RightRingDistal,
|
||||
|
||||
// Little Finger
|
||||
RightLittleMetacarpal,
|
||||
RightLittleProximal,
|
||||
RightLittleIntermediate,
|
||||
RightLittleDistal,
|
||||
|
||||
// Right Leg
|
||||
RightUpperLeg,
|
||||
RightLowerLeg,
|
||||
RightFoot,
|
||||
RightToes,
|
||||
#endregion
|
||||
|
||||
#region Face Bones
|
||||
|
||||
// Eyes
|
||||
LeftUpperLid,
|
||||
LeftEye,
|
||||
LeftLowerLid,
|
||||
RightUpperLid,
|
||||
RightEye,
|
||||
RightLowerLid,
|
||||
|
||||
// Brows
|
||||
LeftOuterBrow,
|
||||
LeftBrow,
|
||||
LeftInnerBrow,
|
||||
RightInnerBrow,
|
||||
RightBrow,
|
||||
RightOuterBrow,
|
||||
|
||||
// Ears
|
||||
LeftEar,
|
||||
RightEar,
|
||||
|
||||
// Cheeks
|
||||
LeftCheek,
|
||||
RightCheek,
|
||||
|
||||
// Nose
|
||||
NoseTop,
|
||||
NoseTip,
|
||||
NoseBottomLeft,
|
||||
NoseBottom,
|
||||
NoseBottomRight,
|
||||
|
||||
// Mouth
|
||||
UpperLipLeft,
|
||||
UpperLip,
|
||||
UpperLipRight,
|
||||
LipLeft,
|
||||
LipRight,
|
||||
LowerLipLeft,
|
||||
LowerLip,
|
||||
LowerLipRight,
|
||||
|
||||
Jaw,
|
||||
Chin,
|
||||
#endregion
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
public enum CenterBone {
|
||||
Unknown,
|
||||
|
||||
// Torso
|
||||
Hips,
|
||||
Spine,
|
||||
Spine1,
|
||||
Spine2,
|
||||
Chest,
|
||||
|
||||
// Head
|
||||
Neck,
|
||||
Head,
|
||||
|
||||
Count
|
||||
}
|
||||
|
||||
public enum SideBone {
|
||||
None,
|
||||
|
||||
// Arm
|
||||
Shoulder,
|
||||
UpperArm,
|
||||
Forearm,
|
||||
ForearmTwist,
|
||||
Hand,
|
||||
|
||||
// Thumb
|
||||
ThumbProximal,
|
||||
ThumbIntermediate,
|
||||
ThumbDistal,
|
||||
|
||||
// Index Finger
|
||||
IndexMetacarpal,
|
||||
IndexProximal,
|
||||
IndexIntermediate,
|
||||
IndexDistal,
|
||||
|
||||
// Middle Finger
|
||||
MiddleMetacarpal,
|
||||
MiddleProximal,
|
||||
MiddleIntermediate,
|
||||
MiddleDistal,
|
||||
|
||||
// Ring Finger
|
||||
RingMetacarpal,
|
||||
RingProximal,
|
||||
RingIntermediate,
|
||||
RingDistal,
|
||||
|
||||
// Little Finger
|
||||
LittleMetacarpal,
|
||||
LittleProximal,
|
||||
LittleIntermediate,
|
||||
LittleDistal,
|
||||
|
||||
// Left Leg
|
||||
UpperLeg,
|
||||
LowerLeg,
|
||||
Foot,
|
||||
Toes,
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
public enum Finger {
|
||||
Thumb,
|
||||
Index,
|
||||
Middle,
|
||||
Ring,
|
||||
Little,
|
||||
Count
|
||||
};
|
||||
|
||||
public enum FingerBone {
|
||||
Metacarpal,
|
||||
Proximal,
|
||||
Intermediate,
|
||||
Distal,
|
||||
Tip,
|
||||
Count
|
||||
};
|
||||
|
||||
public enum FacialBone {
|
||||
Unknown,
|
||||
|
||||
// Eyes
|
||||
LeftUpperLid,
|
||||
LeftEye,
|
||||
LeftLowerLid,
|
||||
RightUpperLid,
|
||||
RightEye,
|
||||
RightLowerLid,
|
||||
|
||||
// Brows
|
||||
LeftOuterBrow,
|
||||
LeftBrow,
|
||||
LeftInnerBrow,
|
||||
RightInnerBrow,
|
||||
RightBrow,
|
||||
RightOuterBrow,
|
||||
|
||||
// Ears
|
||||
LeftEar,
|
||||
RightEar,
|
||||
|
||||
// Cheeks
|
||||
LeftCheek,
|
||||
RightCheek,
|
||||
|
||||
// Nose
|
||||
NoseTop,
|
||||
NoseTip,
|
||||
NoseBottomLeft,
|
||||
NoseBottom,
|
||||
NoseBottomRight,
|
||||
|
||||
// Mouth
|
||||
UpperLipLeft,
|
||||
UpperLip,
|
||||
UpperLipRight,
|
||||
LipLeft,
|
||||
LipRight,
|
||||
LowerLipLeft,
|
||||
LowerLip,
|
||||
LowerLipRight,
|
||||
|
||||
Jaw,
|
||||
Chin,
|
||||
|
||||
Count
|
||||
}
|
||||
|
||||
public class Bones {
|
||||
public static bool IsLeftSideBone(Bone bone) {
|
||||
return (bone >= Bone.LeftShoulder && bone <= Bone.LeftToes);
|
||||
}
|
||||
|
||||
public static bool IsRightSideBone(Bone bone) {
|
||||
return (bone >= Bone.RightShoulder && bone <= Bone.RightToes);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class BoneReference {
|
||||
public BoneType type;
|
||||
public Side side;
|
||||
[SerializeField]
|
||||
private Bone _boneId;
|
||||
[SerializeField]
|
||||
private SideBone _sideBoneId;
|
||||
|
||||
public Bone boneId {
|
||||
get { return _boneId; }
|
||||
set {
|
||||
_boneId = value;
|
||||
_sideBoneId = HumanoidSideBone(_boneId);
|
||||
}
|
||||
}
|
||||
public CenterBone centerBoneId {
|
||||
get { return HumanoidCenterBone(boneId); }
|
||||
set { boneId = HumanoidBone(value); }
|
||||
}
|
||||
public SideBone sideBoneId {
|
||||
get { return _sideBoneId; }
|
||||
set {
|
||||
_sideBoneId = value;
|
||||
_boneId = HumanoidBone(side, _sideBoneId);
|
||||
}
|
||||
}
|
||||
public FacialBone faceBoneId {
|
||||
get { return HumanoidFaceBone(boneId); }
|
||||
set { boneId = HumanoidBone(value); }
|
||||
}
|
||||
public HumanBodyBones humanBodyBone {
|
||||
get { return humanBodyBones[(int)boneId]; }
|
||||
}
|
||||
|
||||
public bool isCenterBone {
|
||||
get { return (_boneId >= Bone.Hips && _boneId <= Bone.Head); }
|
||||
}
|
||||
public bool isSideBone {
|
||||
//get { return (_boneId >= Bone.LeftShoulder && _boneId <= Bone.RightToes); }
|
||||
get { return (_sideBoneId != SideBone.None); }
|
||||
}
|
||||
public bool isLeftSideBone {
|
||||
get { return Bones.IsLeftSideBone(_boneId); }
|
||||
}
|
||||
public bool isRightSideBone {
|
||||
get { return Bones.IsRightSideBone(_boneId); }
|
||||
}
|
||||
public bool isHandBone {
|
||||
get {
|
||||
bool boneIsHand = (_boneId >= Bone.LeftThumbProximal && _boneId <= Bone.RightLittleDistal);
|
||||
bool sideBoneIsHand = (_sideBoneId >= SideBone.ThumbProximal && _sideBoneId <= SideBone.LittleDistal);
|
||||
return boneIsHand || sideBoneIsHand;
|
||||
//(_boneId >= Bone.LeftThumbProximal && _boneId <= Bone.RightLittleDistal) ||
|
||||
//(_sideBoneId >= SideBone.ThumbProximal && _sideBoneId <= SideBone.LittleDistal);
|
||||
}
|
||||
}
|
||||
public bool isLeftHandBone {
|
||||
get { return (_boneId >= Bone.LeftThumbProximal && _boneId <= Bone.LeftLittleDistal); }
|
||||
}
|
||||
public bool isRightHandBone {
|
||||
get { return (_boneId >= Bone.RightThumbProximal && _boneId <= Bone.RightLittleDistal); }
|
||||
}
|
||||
public bool isFacialBone {
|
||||
get { return (_boneId >= Bone.LeftUpperLid && _boneId <= Bone.Chin); }
|
||||
}
|
||||
|
||||
public static Bone HumanoidBone(CenterBone centerBone) {
|
||||
return (Bone)centerBone;
|
||||
}
|
||||
|
||||
public static CenterBone HumanoidCenterBone(Bone bone) {
|
||||
return (CenterBone)bone;
|
||||
}
|
||||
|
||||
public static Bone HumanoidBone(Side side, SideBone sideBone) {
|
||||
if (sideBone == Tracking.SideBone.None)
|
||||
return Bone.None;
|
||||
|
||||
int shoulderIx;
|
||||
int sideBoneIx;
|
||||
switch (side) {
|
||||
case Side.Left:
|
||||
shoulderIx = (int)Bone.LeftShoulder;
|
||||
sideBoneIx = (int)sideBone;
|
||||
return (Bone)(shoulderIx + sideBoneIx - 1);
|
||||
//return (int)Bone.LeftShoulder + ((int)sideBone - 1);
|
||||
case Side.Right:
|
||||
shoulderIx = (int)Bone.RightShoulder;
|
||||
sideBoneIx = (int)sideBone;
|
||||
return (Bone)(shoulderIx + sideBoneIx - 1);
|
||||
default:
|
||||
return Bone.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static SideBone HumanoidSideBone(Bone bone) {
|
||||
if (bone >= Bone.LeftShoulder && bone <= Bone.LeftToes) {
|
||||
return (SideBone)(int)bone - (int)Bone.LeftShoulder + 1;
|
||||
}
|
||||
else if (bone >= Bone.RightShoulder && bone <= Bone.RightToes) {
|
||||
return (SideBone)(int)bone - (int)Bone.RightShoulder + 1;
|
||||
}
|
||||
else {
|
||||
return Tracking.SideBone.None;
|
||||
}
|
||||
}
|
||||
public static SideBone HumanoidSideBone(Finger fingerId, FingerBone fingerBoneId) {
|
||||
SideBone boneId = (SideBone)(((int)Tracking.SideBone.ThumbProximal - 1) + (int)fingerId * 4 + (int)fingerBoneId);
|
||||
return boneId;
|
||||
}
|
||||
public static SideBone HumanoidSideBone(Bone bone, out Side side) {
|
||||
if (bone >= Bone.LeftShoulder && bone <= Bone.LeftToes) {
|
||||
side = Side.Left;
|
||||
return (SideBone)(int)bone - (int)Bone.LeftShoulder + 1;
|
||||
}
|
||||
else if (bone >= Bone.RightShoulder && bone <= Bone.RightToes) {
|
||||
side = Side.Right;
|
||||
return (SideBone)(int)bone - (int)Bone.RightShoulder + 1;
|
||||
}
|
||||
else {
|
||||
side = Side.Left; //AnySide;
|
||||
return Tracking.SideBone.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static Bone HumanoidBone(FacialBone faceBone) {
|
||||
return (int)Bone.LeftUpperLid + ((Bone)faceBone - 1);
|
||||
}
|
||||
public static FacialBone HumanoidFaceBone(Bone bone) {
|
||||
return (FacialBone)(int)bone - (int)Bone.LeftUpperLid + 1;
|
||||
}
|
||||
|
||||
public static HumanBodyBones HumanBodyBone(Bone bone) {
|
||||
return humanBodyBones[(int)bone];
|
||||
}
|
||||
private static HumanBodyBones[] humanBodyBones = new HumanBodyBones[(int)Bone.Count] {
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.Hips,
|
||||
HumanBodyBones.Spine,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.Chest,
|
||||
|
||||
HumanBodyBones.Neck,
|
||||
HumanBodyBones.Head,
|
||||
|
||||
HumanBodyBones.LeftShoulder,
|
||||
HumanBodyBones.LeftUpperArm,
|
||||
HumanBodyBones.LeftLowerArm,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LeftHand,
|
||||
|
||||
HumanBodyBones.LeftThumbProximal,
|
||||
HumanBodyBones.LeftThumbIntermediate,
|
||||
HumanBodyBones.LeftThumbDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LeftIndexProximal,
|
||||
HumanBodyBones.LeftIndexIntermediate,
|
||||
HumanBodyBones.LeftIndexDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LeftMiddleProximal,
|
||||
HumanBodyBones.LeftMiddleIntermediate,
|
||||
HumanBodyBones.LeftMiddleDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LeftRingProximal,
|
||||
HumanBodyBones.LeftRingIntermediate,
|
||||
HumanBodyBones.LeftRingDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LeftLittleProximal,
|
||||
HumanBodyBones.LeftLittleIntermediate,
|
||||
HumanBodyBones.LeftLittleDistal,
|
||||
|
||||
HumanBodyBones.LeftUpperLeg,
|
||||
HumanBodyBones.LeftLowerLeg,
|
||||
HumanBodyBones.LeftFoot,
|
||||
HumanBodyBones.LeftToes,
|
||||
|
||||
HumanBodyBones.RightShoulder,
|
||||
HumanBodyBones.RightUpperArm,
|
||||
HumanBodyBones.RightLowerArm,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.RightHand,
|
||||
|
||||
HumanBodyBones.RightThumbProximal,
|
||||
HumanBodyBones.RightThumbIntermediate,
|
||||
HumanBodyBones.RightThumbDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.RightIndexProximal,
|
||||
HumanBodyBones.RightIndexIntermediate,
|
||||
HumanBodyBones.RightIndexDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.RightMiddleProximal,
|
||||
HumanBodyBones.RightMiddleIntermediate,
|
||||
HumanBodyBones.RightMiddleDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.RightRingProximal,
|
||||
HumanBodyBones.RightRingIntermediate,
|
||||
HumanBodyBones.RightRingDistal,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.RightLittleProximal,
|
||||
HumanBodyBones.RightLittleIntermediate,
|
||||
HumanBodyBones.RightLittleDistal,
|
||||
|
||||
HumanBodyBones.RightUpperLeg,
|
||||
HumanBodyBones.RightLowerLeg,
|
||||
HumanBodyBones.RightFoot,
|
||||
HumanBodyBones.RightToes,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LeftEye,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.RightEye,
|
||||
HumanBodyBones.LastBone,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
HumanBodyBones.LastBone,
|
||||
|
||||
HumanBodyBones.Jaw,
|
||||
|
||||
HumanBodyBones.LastBone,
|
||||
};
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Vec2 {
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Vec2(Vector2 v) {
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
}
|
||||
public Vector2 Vector2 {
|
||||
get { return new Vector2(x, y); }
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Vec3 {
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public Vec3(Vector3 v) {
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = v.z;
|
||||
}
|
||||
public Vector3 Vector3 {
|
||||
get { return new Vector3(x, y, z); }
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Quat {
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public float w;
|
||||
|
||||
public Quat(Quaternion q) {
|
||||
x = q.x;
|
||||
y = q.y;
|
||||
z = q.z;
|
||||
w = q.w;
|
||||
}
|
||||
public Quaternion Quaternion {
|
||||
get { return new Quaternion(x, y, z, w); }
|
||||
}
|
||||
}
|
||||
|
||||
public class TrackerTransform {
|
||||
private TrackingDevice tracker;
|
||||
|
||||
protected float lastTime = 0;
|
||||
|
||||
public TrackerTransform(TrackingDevice tracker) {
|
||||
this.tracker = tracker;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (Time.frameCount <= lastTime)
|
||||
return;
|
||||
|
||||
TrackingDevice.TrackerTransformC trackerTransform = tracker.GetTrackerData();
|
||||
|
||||
_status = trackerTransform.status;
|
||||
_actorCount = trackerTransform.actorCount;
|
||||
|
||||
lastTime = Time.frameCount;
|
||||
}
|
||||
|
||||
private Tracker.Status _status;
|
||||
public Tracker.Status status {
|
||||
get {
|
||||
Update();
|
||||
return _status;
|
||||
}
|
||||
}
|
||||
|
||||
private int _actorCount;
|
||||
public int actorCount {
|
||||
get {
|
||||
Update();
|
||||
return _actorCount;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if hUNSAFE
|
||||
unsafe public class SensorBone {
|
||||
private TrackingDevice.SensorTransformC* pSensorTransform = null;
|
||||
protected float lastTime = 0;
|
||||
|
||||
unsafe public SensorBone(TrackingDevice.SensorTransformC* pSensorTransform) {
|
||||
this.pSensorTransform = pSensorTransform;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (pSensorTransform == null)
|
||||
return;
|
||||
if (Time.frameCount <= lastTime)
|
||||
return;
|
||||
|
||||
_position = pSensorTransform->position.Vector3;
|
||||
_positionConfidence = pSensorTransform->positionConfidence;
|
||||
_rotation = pSensorTransform->rotation.Quaternion;
|
||||
_rotationConfidence = pSensorTransform->rotationConfidence;
|
||||
|
||||
lastTime = Time.frameCount;
|
||||
}
|
||||
#else
|
||||
public class SensorBone {
|
||||
protected TrackingDevice tracker;
|
||||
protected readonly uint actorId;
|
||||
protected readonly Bone boneId;
|
||||
protected readonly Side side;
|
||||
protected readonly SideBone sideBoneId;
|
||||
|
||||
protected float lastTime = 0;
|
||||
|
||||
public SensorBone(TrackingDevice tracker, uint actorId, Side side, SideBone sideBoneId) {
|
||||
this.tracker = tracker;
|
||||
this.actorId = actorId;
|
||||
this.boneId = Bone.None;
|
||||
this.side = side;
|
||||
this.sideBoneId = sideBoneId;
|
||||
}
|
||||
|
||||
public SensorBone(TrackingDevice tracker, uint actorId, Bone boneId) {
|
||||
this.tracker = tracker;
|
||||
this.actorId = actorId;
|
||||
this.side = Side.AnySide;
|
||||
this.boneId = boneId;
|
||||
this.sideBoneId = SideBone.None;
|
||||
}
|
||||
|
||||
protected virtual void Update() {
|
||||
if (Time.frameCount <= lastTime)
|
||||
return;
|
||||
|
||||
TrackingDevice.SensorTransformC sensorTransform =
|
||||
(boneId == Bone.None) ?
|
||||
tracker.GetBoneData(actorId, side, sideBoneId) :
|
||||
tracker.GetBoneData(actorId, boneId);
|
||||
|
||||
|
||||
_position = sensorTransform.position.Vector3;
|
||||
_positionConfidence = sensorTransform.positionConfidence;
|
||||
_rotation = sensorTransform.rotation.Quaternion;
|
||||
_rotationConfidence = sensorTransform.rotationConfidence;
|
||||
|
||||
lastTime = Time.frameCount;
|
||||
}
|
||||
#endif
|
||||
protected Vector3 _position;
|
||||
public virtual Vector3 position {
|
||||
get {
|
||||
Update();
|
||||
return _position;
|
||||
}
|
||||
}
|
||||
|
||||
protected float _positionConfidence;
|
||||
public virtual float positionConfidence {
|
||||
get {
|
||||
Update();
|
||||
return _positionConfidence;
|
||||
}
|
||||
}
|
||||
|
||||
protected Quaternion _rotation;
|
||||
public virtual Quaternion rotation {
|
||||
get {
|
||||
Update();
|
||||
return _rotation;
|
||||
}
|
||||
}
|
||||
|
||||
protected float _rotationConfidence;
|
||||
public virtual float rotationConfidence {
|
||||
get {
|
||||
Update();
|
||||
return _rotationConfidence;
|
||||
}
|
||||
}
|
||||
|
||||
private float _lengthConfidence;
|
||||
|
||||
public float length = 0;
|
||||
|
||||
public Vector3 velocity;
|
||||
public Quaternion rotationalVelocity;
|
||||
}
|
||||
|
||||
public class ControllerState {
|
||||
private TrackingDevice tracker;
|
||||
private readonly uint actorId;
|
||||
private readonly Side side;
|
||||
|
||||
//private float lastTime = 0;
|
||||
|
||||
public ControllerState(TrackingDevice tracker, uint actorId, Side side) {
|
||||
this.tracker = tracker;
|
||||
this.actorId = actorId;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
public void Update() {
|
||||
TrackingDevice.ControllerStateC controllerState =
|
||||
tracker.GetControllerState(actorId, side);
|
||||
|
||||
//if (lastTime >= targetTransform.timestamp)
|
||||
// return;
|
||||
|
||||
for (int i = 0; i < input3dCount; i++)
|
||||
input3d[i] = controllerState.input3d.Vector3; //[i].Vector3;
|
||||
//for (int i = 0; i < input1dCount; i++)
|
||||
// input1d[i] = controllerState.input1d[i];
|
||||
|
||||
//lastTime = controllerState.timestamp;
|
||||
|
||||
}
|
||||
|
||||
public const int input3dCount = 1; //2;
|
||||
public const int input1dCount = 7;
|
||||
|
||||
public Vector3[] input3d = new Vector3[input3dCount];
|
||||
public float[] input1d = new float[input1dCount];
|
||||
|
||||
}
|
||||
public class TrackingDevice {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct TrackerTransformC {
|
||||
public float timestamp;
|
||||
|
||||
public Vec3 position;
|
||||
public Quat rotation;
|
||||
|
||||
public Tracker.Status status;
|
||||
|
||||
public int actorCount;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SensorTransformC {
|
||||
public float timestamp;
|
||||
public uint id;
|
||||
|
||||
public Vec3 position;
|
||||
public float positionConfidence;
|
||||
public Vec3 velocity;
|
||||
|
||||
public Quat rotation;
|
||||
public float rotationConfidence;
|
||||
public Quat rotationalVelocity;
|
||||
|
||||
public float length;
|
||||
public float lengthConfidence;
|
||||
|
||||
public Vec3 sensor2TargetPosition;
|
||||
public Quat sensor2TargetRotation;
|
||||
|
||||
public Vec3 targetPosition;
|
||||
public Quat targetRotation;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ControllerStateC {
|
||||
public float timestamp;
|
||||
|
||||
public Vec3 input3d;
|
||||
//public float[] input1d;
|
||||
}
|
||||
|
||||
protected IntPtr device;
|
||||
|
||||
public virtual void Init() { }
|
||||
public virtual void Stop() { }
|
||||
|
||||
public virtual void Update() { }
|
||||
|
||||
protected void LogError(int errorIndex, string[] errorMsgs) {
|
||||
if (errorIndex >= errorMsgs.Length - 1)
|
||||
Debug.LogError(errorMsgs[errorMsgs.Length - 1] + errorIndex);
|
||||
else
|
||||
Debug.LogError(errorMsgs[errorIndex]);
|
||||
}
|
||||
|
||||
#region Tracker
|
||||
public virtual Tracker.Status status {
|
||||
get { return Tracker.Status.Unavailable; }
|
||||
}
|
||||
public virtual Vector3 position {
|
||||
set { }
|
||||
}
|
||||
public virtual Quaternion rotation {
|
||||
set { }
|
||||
}
|
||||
public virtual TrackerTransform GetTracker() {
|
||||
return new TrackerTransform(this);
|
||||
}
|
||||
public virtual TrackerTransformC GetTrackerData() {
|
||||
return new TrackerTransformC();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Bone
|
||||
public virtual Vector3 GetBonePosition(uint actorId, Bone boneId) {
|
||||
return Vector3.zero;
|
||||
}
|
||||
public virtual Quaternion GetBoneRotation(uint actorId, Bone boneId) {
|
||||
return Quaternion.identity;
|
||||
}
|
||||
public virtual float GetBoneConfidence(uint actorId, Bone boneId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if hUNSAFE
|
||||
unsafe public virtual SensorBone GetBone(uint actorId, Bone boneId) {
|
||||
return new SensorBone(null);
|
||||
}
|
||||
#else
|
||||
public virtual SensorBone GetBone(uint actorId, Bone boneId) {
|
||||
return new SensorBone(this, actorId, boneId);
|
||||
}
|
||||
#endif
|
||||
public virtual SensorTransformC GetBoneData(uint actorId, Bone boneId) {
|
||||
return new SensorTransformC();
|
||||
}
|
||||
|
||||
#if hUNSAFE
|
||||
unsafe public virtual SensorBone GetBone(uint actorId, Side side, SideBone boneId) {
|
||||
return new SensorBone(null);
|
||||
}
|
||||
#else
|
||||
public virtual SensorBone GetBone(uint actorId, Side side, SideBone boneId) {
|
||||
return new SensorBone(this, actorId, side, boneId);
|
||||
}
|
||||
#endif
|
||||
public virtual SensorTransformC GetBoneData(uint actorId, Side side, SideBone boneId) {
|
||||
return new SensorTransformC();
|
||||
}
|
||||
public virtual Vector3 GetBonePosition(uint actorId, Side side, SideBone boneId) {
|
||||
return Vector3.zero;
|
||||
}
|
||||
public virtual Quaternion GetBoneRotation(uint actorId, Side side, SideBone boneId) {
|
||||
return Quaternion.identity;
|
||||
}
|
||||
public virtual float GetBoneConfidence(uint actorId, Side side, SideBone boneId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Quaternion GetBoneRotation(uint actorId, Side side, Finger fingerId, FingerBone fingerboneId) {
|
||||
SideBone sideBoneId = BoneReference.HumanoidSideBone(fingerId, fingerboneId);
|
||||
Quaternion q = GetBoneRotation(actorId, side, sideBoneId);
|
||||
return q;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Controllers
|
||||
public virtual ControllerState GetController(uint actorId, Side side) {
|
||||
return new ControllerState(this, actorId, side);
|
||||
}
|
||||
|
||||
public virtual ControllerStateC GetControllerState(uint actorId, Side side) {
|
||||
return new ControllerStateC();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a46c28db66593be4aa670f3c35712387
|
||||
timeCreated: 1533109553
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +0,0 @@
|
||||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,2
|
||||
[InternetShortcut]
|
||||
IDList=
|
||||
URL=http://passervr.com/documentation/humanoid-control/
|
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