Compare commits
243 Commits
Author | SHA1 | Date | |
---|---|---|---|
f177384da3 | |||
![]() |
bfa05a93e3 | ||
![]() |
4d53839164 | ||
![]() |
0d22094ba4 | ||
![]() |
ab5d034f6e | ||
![]() |
9e7a685815 | ||
![]() |
fd9bc37467 | ||
![]() |
f1ef79a103 | ||
![]() |
6dcd64ddc7 | ||
fbfbb8cbaf | |||
90b4c46988 | |||
a3a2732060 | |||
![]() |
48f5a48639 | ||
![]() |
039b347475 | ||
![]() |
3d37b1a61e | ||
![]() |
c0effaf025 | ||
![]() |
66e07c9bdc | ||
![]() |
3a15ab000f | ||
![]() |
0a609ce083 | ||
![]() |
36660c8495 | ||
![]() |
70f9edc918 | ||
![]() |
c7c92f3e53 | ||
![]() |
d7c2f3b960 | ||
![]() |
27afc9d501 | ||
![]() |
f1a4ced59d | ||
![]() |
8b199b9c78 | ||
![]() |
ea9deb82fb | ||
![]() |
83ab3a6dbe | ||
![]() |
9e19dfd5af | ||
![]() |
c852dc4a1e | ||
![]() |
ddb76e71de | ||
![]() |
78a3d2f38a | ||
![]() |
0d6446ae18 | ||
9e5916d06c | |||
![]() |
3c853c3ba1 | ||
![]() |
9489cdc5b5 | ||
![]() |
46da2dfe1b | ||
![]() |
65aad9159e | ||
![]() |
c0256f8c9b | ||
![]() |
eeb74e2491 | ||
![]() |
bf7cd6c188 | ||
![]() |
64e5a573cb | ||
![]() |
43edc40b53 | ||
411b97e33d | |||
27fc3b7eb6 | |||
ff47263fce | |||
0cdbfadfa5 | |||
227c242589 | |||
9b31c9a7d3 | |||
81b7fee9ea | |||
285aefc2ae | |||
64af1d26da | |||
efefc4b9fd | |||
14ac81f2f2 | |||
43bd355b29 | |||
dc166b9246 | |||
143add636f | |||
0cb43c31d0 | |||
14d30d28e3 | |||
115fe62c49 | |||
ba8d8cf6e0 | |||
![]() |
bc6d236e1a | ||
![]() |
5d2459979c | ||
![]() |
e33f599371 | ||
![]() |
927dfff7d1 | ||
![]() |
e3ea1ce371 | ||
![]() |
31583b828a | ||
![]() |
3d340c4312 | ||
![]() |
178d242762 | ||
![]() |
34c45dc39a | ||
![]() |
c013cf0722 | ||
![]() |
f19acc5133 | ||
![]() |
71075deb47 | ||
![]() |
816bad12c2 | ||
![]() |
3f3f7f4d77 | ||
![]() |
6c0170e4cf | ||
0174e943e7 | |||
8e768343d8 | |||
cfde4632cd | |||
![]() |
5138587eef | ||
![]() |
d3cafd3c15 | ||
![]() |
a69e74e853 | ||
![]() |
724dd8a07a | ||
![]() |
c4bd28c4e7 | ||
![]() |
1e616284c0 | ||
![]() |
d2fe125488 | ||
![]() |
7c46b252dd | ||
![]() |
a7498aeb9f | ||
9093521f43 | |||
aa61ffd2f4 | |||
![]() |
43cf7767c4 | ||
![]() |
750fccaaaa | ||
6d3c7edd0d | |||
e991920a18 | |||
![]() |
8769d7328f | ||
![]() |
ab36bea0a7 | ||
![]() |
17f8325b37 | ||
![]() |
a5d3dc6938 | ||
![]() |
2f458dde27 | ||
![]() |
3e448bc472 | ||
![]() |
70e9210167 | ||
![]() |
a69f8c4eac | ||
![]() |
277662d107 | ||
![]() |
0bacb58481 | ||
![]() |
cde1f4b594 | ||
![]() |
fc79ea1a39 | ||
![]() |
af0fc71edd | ||
![]() |
2ab022b22b | ||
![]() |
5e4d59d30a | ||
![]() |
6c94ef65f8 | ||
![]() |
870b5a5546 | ||
![]() |
78a3a5119f | ||
![]() |
1704c4bc05 | ||
![]() |
77c9e37aef | ||
![]() |
4d7ab052a2 | ||
![]() |
80ab32d237 | ||
![]() |
ff63a67d9a | ||
![]() |
78cb4e4044 | ||
![]() |
4eb1f1722d | ||
![]() |
e646ef0f7d | ||
2b055edb6c | |||
![]() |
f99b3b9842 | ||
![]() |
6cbdb9dfcb | ||
![]() |
168e30c094 | ||
![]() |
abab50dc76 | ||
![]() |
4f3088685d | ||
![]() |
098f544a37 | ||
![]() |
4a16af4dce | ||
![]() |
6e1fb738e6 | ||
41b3755252 | |||
![]() |
d04deb59e1 | ||
![]() |
cfc3b22c00 | ||
![]() |
f447b2b301 | ||
2738e5c9f0 | |||
afb4a704ef | |||
9f8f819666 | |||
2cfc53e876 | |||
ed750c012b | |||
02329b3532 | |||
87672ce3ee | |||
6b3934cdd0 | |||
4ede9f8c31 | |||
dfea57877e | |||
85c24ecea0 | |||
50b76d64f0 | |||
1d99d6d15d | |||
328edcb44c | |||
69a1ed2fff | |||
a055ff337a | |||
16f6d72219 | |||
d11396b8bc | |||
188342a40f | |||
3aed07a76a | |||
47223965a2 | |||
13a43aa1e5 | |||
cb6f90da98 | |||
284c77d0a2 | |||
450ec9012f | |||
54cb265be1 | |||
704559e150 | |||
2bcf3e5c10 | |||
3551dcfd17 | |||
021efa5cb5 | |||
221818a81c | |||
c8c2a855c2 | |||
20db91147d | |||
ad17216055 | |||
80a5581054 | |||
ae7112de56 | |||
59f4add2ac | |||
219f2f987c | |||
998683a881 | |||
03948b8b01 | |||
1f1e26615c | |||
eeb0009545 | |||
59558c09e3 | |||
555c5fd2d8 | |||
d476b2c269 | |||
c252ba8b51 | |||
513092ca16 | |||
550cc04519 | |||
a7bdaa081f | |||
8a3a2be643 | |||
4648565214 | |||
9034590707 | |||
228b5925b7 | |||
a75c4b38ec | |||
94690b38e1 | |||
145bb2e8bf | |||
b7dd213e3a | |||
cb93a3b7f7 | |||
![]() |
70389b2d64 | ||
![]() |
4c3edd4f80 | ||
![]() |
0df37f9c28 | ||
8b553966c4 | |||
41c66b3eb6 | |||
6166df3e80 | |||
24a0f22ce1 | |||
3d7fff1c15 | |||
6bebede2a1 | |||
660d03ef67 | |||
44cedfc8ad | |||
31ff5058f8 | |||
39cc19df48 | |||
58532dda73 | |||
9e0911359b | |||
7ee6e7a4d3 | |||
461006c8b4 | |||
![]() |
29de3d1b69 | ||
![]() |
659353122e | ||
![]() |
f6eb8fcf7b | ||
6f760f4a92 | |||
14937d96b9 | |||
c7c5ab59e6 | |||
71085cd6ee | |||
41409d627d | |||
4b3bd49242 | |||
075a5d7ba1 | |||
7d41944b98 | |||
8d7142f3b0 | |||
9f7a96187f | |||
04c589dec9 | |||
13a48376a3 | |||
2c25f7832b | |||
f60f7a5634 | |||
c512dd42c3 | |||
d6de90fbe9 | |||
18735e37e2 | |||
45cd4a16ef | |||
d5de37a168 | |||
7262f48fb2 | |||
68800cd96f | |||
ce9546b8ea | |||
ec4e2a2ea2 | |||
21110b5be5 | |||
acae3becdc | |||
5fe3fda9f2 | |||
88cdf0de98 | |||
dd759b878f | |||
![]() |
a24c86db3f | ||
![]() |
3596f0067e | ||
![]() |
daf16351cd | ||
b01ebb0570 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Samples
|
||||
Samples.meta
|
||||
package.json
|
||||
package.json.meta
|
||||
Samples~.meta
|
5
CONTRIBUTING.md
Normal file
5
CONTRIBUTING.md
Normal file
@ -0,0 +1,5 @@
|
||||
Contibuting to Humanoid Control Free
|
||||
====================================
|
||||
If you want to contribute to this project, make sure you have access to the repository.
|
||||
You can request access by logging into our [GitLab site](https://gitlab.passervr.com/) with an GitHub or Google account.
|
||||
Besides that, it is best to [contract us](https://passervr.com/contract) about you wanting to contribute to this project. This will ensure you will get access more quickly.
|
7
CONTRIBUTING.md.meta
Normal file
7
CONTRIBUTING.md.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c55d00a05de5d8340a1a49f5d8b2aeed
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -219,7 +219,7 @@ namespace Passer.Humanoid {
|
||||
for (int i = 0; i < hcScripts.Length; i++) {
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(hcScripts[i]);
|
||||
if (assetPath.Length > 36 && assetPath.Substring(assetPath.Length - 27, 27) == "/Scripts/HumanoidControl.cs") {
|
||||
humanoidPath = assetPath.Substring(6, assetPath.Length - 24);
|
||||
humanoidPath = assetPath.Substring(0, assetPath.Length - 18);
|
||||
return humanoidPath;
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,6 @@ namespace Passer.Humanoid {
|
||||
//anyChanged |= SteamVRSettingUI(serializedConfiguration);
|
||||
//anyChanged |= OculusSettingUI(serializedConfiguration);
|
||||
//anyChanged |= WindowsMRSettingUI(serializedConfiguration);
|
||||
//anyChanged |= VrtkSettingUI(serializedConfiguration);
|
||||
|
||||
//anyChanged |= LeapSettingUI(serializedConfiguration);
|
||||
//anyChanged |= Kinect1SettingUI(serializedConfiguration);
|
||||
@ -430,24 +429,6 @@ namespace Passer.Humanoid {
|
||||
return anyChanged;
|
||||
}
|
||||
|
||||
public static bool VrtkSettingUI(SerializedObject serializedConfiguration) {
|
||||
|
||||
SerializedProperty vrtkSupportProp = serializedConfiguration.FindProperty("vrtkSupport");
|
||||
|
||||
if (!isVrtkSupportAvailable)
|
||||
vrtkSupportProp.boolValue = false;
|
||||
|
||||
else if (!isVrtkAvailable) {
|
||||
using (new EditorGUI.DisabledScope(true)) {
|
||||
EditorGUILayout.Toggle("VRTK Supoort", false);
|
||||
}
|
||||
EditorGUILayout.HelpBox("VRTK is not available. Please download it from the Asset Store.", MessageType.Warning, true);
|
||||
}
|
||||
else
|
||||
vrtkSupportProp.boolValue = EditorGUILayout.Toggle("VRTK Support", vrtkSupportProp.boolValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool LeapSettingUI(SerializedObject serializedConfiguration) {
|
||||
SerializedProperty leapSupportProp = serializedConfiguration.FindProperty("leapSupport");
|
||||
|
||||
@ -800,7 +781,6 @@ namespace Passer.Humanoid {
|
||||
configuration.viveTrackerSupport = CheckExtensionViveTracker(configuration);
|
||||
configuration.oculusSupport = CheckExtensionOculus(configuration);
|
||||
configuration.windowsMRSupport = CheckExtensionWindowsMR(configuration);
|
||||
configuration.vrtkSupport = CheckExtensionVRTK(configuration);
|
||||
configuration.neuronSupport = CheckExtensionNeuron(configuration);
|
||||
configuration.hi5Support = CheckExtensionHi5(configuration);
|
||||
configuration.realsenseSupport = CheckExtensionRealsense(configuration);
|
||||
@ -848,8 +828,12 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
public static bool CheckExtensionViveTracker(Configuration configuration) {
|
||||
bool available = isViveTrackerSupportAvailable;
|
||||
bool enabled = configuration.viveTrackerSupport;
|
||||
#if UNITY_STANDALONE_WIN
|
||||
bool available = isSteamVrAvailable && isViveTrackerSupportAvailable;
|
||||
#else
|
||||
bool available = false;
|
||||
#endif
|
||||
bool enabled = true; // configuration.viveTrackerSupport;
|
||||
CheckExtension(available && enabled, "hVIVETRACKER");
|
||||
return available && enabled;
|
||||
}
|
||||
@ -865,15 +849,14 @@ namespace Passer.Humanoid {
|
||||
return CheckExtension(enabled, windowsMRPath, "hWINDOWSMR");
|
||||
}
|
||||
|
||||
public static bool CheckExtensionVRTK(Configuration configuration) {
|
||||
bool enabled = configuration.vrtkSupport && isVrtkAvailable;
|
||||
CheckExtension(enabled, "hVRTK");
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static bool CheckExtensionNeuron(Configuration configuration) {
|
||||
bool enabled = configuration.neuronSupport;
|
||||
return CheckExtension(enabled, neuronPath, "hNEURON");
|
||||
#if UNITY_STANDALONE_WIN
|
||||
bool enabled = isNeuronSupportAvailable;
|
||||
#else
|
||||
bool enabled = false;
|
||||
#endif
|
||||
CheckExtension(enabled, "hNEURON");
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static bool CheckExtensionHi5(Configuration configuration) {
|
||||
@ -891,6 +874,7 @@ namespace Passer.Humanoid {
|
||||
public static bool CheckExtensionLeap(Configuration configuration) {
|
||||
bool available = isLeapAvailable && isLeapSupportAvailable;
|
||||
CheckExtension(available, "hLEAP");
|
||||
CheckExtension(isUltraLeapAvailable, "hULTRALEAP");
|
||||
configuration.leapSupport = available;
|
||||
return available;
|
||||
}
|
||||
@ -949,6 +933,7 @@ namespace Passer.Humanoid {
|
||||
|
||||
public static bool CheckExtensionOptitrack(Configuration configuration) {
|
||||
bool available = isOptitrackAvailable && isOptitrackSupportAvailable;
|
||||
available = false; // hard disable because the code currently contains bugs
|
||||
CheckExtension(available, "hOPTITRACK");
|
||||
configuration.optitrackSupport = available;
|
||||
return available;
|
||||
@ -1038,7 +1023,7 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
private static void CheckFaceTracking(Configuration configuration) {
|
||||
if (IsFileAvailable(facePath)) {
|
||||
if (DoesTypeExist("Passer.Humanoid.FaceTarget")) {
|
||||
GlobalDefine("hFACE");
|
||||
}
|
||||
else {
|
||||
@ -1113,9 +1098,9 @@ namespace Passer.Humanoid {
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Availability
|
||||
#region Availability
|
||||
|
||||
public static bool DoesTypeExist(string className) {
|
||||
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
@ -1126,7 +1111,7 @@ namespace Passer.Humanoid {
|
||||
return false;
|
||||
}
|
||||
|
||||
#region SDKs
|
||||
#region SDKs
|
||||
|
||||
protected static bool isUnityXRAvailable {
|
||||
get {
|
||||
@ -1135,6 +1120,9 @@ namespace Passer.Humanoid {
|
||||
return false;
|
||||
if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.management"))
|
||||
return true;
|
||||
else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.oculus"))
|
||||
// Somehow management is no longer available when Oculus is used
|
||||
return true;
|
||||
else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.openxr"))
|
||||
// Somehow management is no longer available when OpenXR is used
|
||||
return true;
|
||||
@ -1148,8 +1136,7 @@ namespace Passer.Humanoid {
|
||||
|
||||
private static bool isSteamVrAvailable {
|
||||
get {
|
||||
return false;
|
||||
//return DoesTypeExist("Valve.VR.SteamVR");
|
||||
return DoesTypeExist("Valve.VR.SteamVR");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1163,18 +1150,18 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isVrtkAvailable {
|
||||
get {
|
||||
return DoesTypeExist("VRTK.VRTK_SDKManager");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isLeapAvailable {
|
||||
get {
|
||||
return DoesTypeExist("Leap.Hand");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isUltraLeapAvailable {
|
||||
get {
|
||||
return DoesTypeExist("Leap.Unity.LeapTestProvider") == false;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isAstraAvailable {
|
||||
get {
|
||||
return DoesTypeExist("Astra.Body");
|
||||
@ -1275,9 +1262,9 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
|
||||
#endregion SDKs
|
||||
#endregion SDKs
|
||||
|
||||
#region Support
|
||||
#region Support
|
||||
|
||||
private static bool isOpenVrSupportAvailable {
|
||||
get {
|
||||
@ -1326,11 +1313,6 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
private static bool isVrtkSupportAvailable {
|
||||
get {
|
||||
return DoesTypeExist("Passer.Humanoid.VrtkTracker");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isLeapSupportAvailable {
|
||||
get {
|
||||
@ -1408,7 +1390,7 @@ namespace Passer.Humanoid {
|
||||
|
||||
private static bool isNeuronSupportAvailable {
|
||||
get {
|
||||
return DoesTypeExist("Passer.Humanoid.NeuronTracker");
|
||||
return DoesTypeExist("Passer.Tracking.PerceptionNeuron");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1445,9 +1427,9 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Support
|
||||
#endregion Support
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class CustomAssetUtility {
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed397d272bcc7c14eb9d4a69d7ba578f
|
||||
guid: 693f9f816fd82f44283cd7bf2ed3ef93
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
190
Editor/HumanoidControl/Extensions/Custom/Custom_Editor.cs
Normal file
190
Editor/HumanoidControl/Extensions/Custom/Custom_Editor.cs
Normal file
@ -0,0 +1,190 @@
|
||||
#if hCUSTOM
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
public class Custom_Editor : Tracker_Editor {
|
||||
|
||||
#region Tracker
|
||||
|
||||
public class TrackerProps : HumanoidControl_Editor.HumanoidTrackerProps {
|
||||
protected SerializedProperty bodySkeletonProp;
|
||||
|
||||
public TrackerProps(SerializedObject serializedObject, HumanoidControl_Editor.HumanoidTargetObjs targetObjs, CustomTracker _custom)
|
||||
: base(serializedObject, targetObjs, _custom, "custom") {
|
||||
tracker = _custom;
|
||||
|
||||
bodySkeletonProp = serializedObject.FindProperty(nameof(HumanoidControl.custom) + "." + nameof(HumanoidControl.custom.bodySkeleton));
|
||||
}
|
||||
|
||||
public override void Inspector(HumanoidControl humanoid) {
|
||||
Inspector(humanoid, "Custom");
|
||||
|
||||
if (humanoid.custom.enabled == false)
|
||||
return;
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
bodySkeletonProp.objectReferenceValue = (BodySkeleton)EditorGUILayout.ObjectField("Body Skeleton", bodySkeletonProp.objectReferenceValue, typeof(BodySkeleton), true);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Tracker
|
||||
|
||||
#region Head
|
||||
|
||||
public class HeadTargetProps : HeadTarget_Editor.TargetProps {
|
||||
protected SerializedProperty sensorProp;
|
||||
|
||||
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
||||
: base(serializedObject, headTarget.custom, headTarget, "custom") {
|
||||
|
||||
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
if (headTarget.humanoid.custom.enabled == false)
|
||||
return;
|
||||
|
||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(headTarget.custom, headTarget);
|
||||
headTarget.custom.enabled = enabledProp.boolValue;
|
||||
if (!Application.isPlaying) {
|
||||
headTarget.custom.SetSensor2Target();
|
||||
headTarget.custom.ShowSensor(headTarget.humanoid.showRealObjects && headTarget.showRealObjects);
|
||||
}
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
if (sensorProp.objectReferenceValue == null && headTarget.custom.sensorComponent != null)
|
||||
sensorProp.objectReferenceValue = headTarget.custom.sensorComponent; // sensorTransform.GetComponent<SensorComponent>();
|
||||
|
||||
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Head
|
||||
|
||||
#region Hand
|
||||
|
||||
public class HandTargetProps : HandTarget_Editor.TargetProps {
|
||||
protected SerializedProperty sensorProp;
|
||||
protected SerializedProperty attachedBoneProp;
|
||||
|
||||
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
||||
: base(serializedObject, handTarget.custom, handTarget, "custom") {
|
||||
|
||||
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||
attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
if (handTarget.humanoid.custom.enabled == false)
|
||||
return;
|
||||
|
||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(handTarget.custom, handTarget);
|
||||
handTarget.custom.enabled = enabledProp.boolValue;
|
||||
if (!Application.isPlaying) {
|
||||
handTarget.custom.SetSensor2Target();
|
||||
handTarget.custom.ShowSensor(handTarget.humanoid.showRealObjects && handTarget.showRealObjects);
|
||||
}
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
if (sensorProp.objectReferenceValue == null && handTarget.custom.sensorComponent != null)
|
||||
sensorProp.objectReferenceValue = handTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
|
||||
|
||||
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||
attachedBoneProp.intValue = (int)(ArmBones)EditorGUILayout.EnumPopup("Bone", (ArmBones)attachedBoneProp.intValue);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Hand
|
||||
|
||||
#region Hips
|
||||
|
||||
public class HipsTargetProps : HipsTarget_Editor.TargetProps {
|
||||
protected SerializedProperty sensorProp;
|
||||
protected SerializedProperty attachedBoneProp;
|
||||
|
||||
public HipsTargetProps(SerializedObject serializedObject, HipsTarget hipsTarget)
|
||||
: base(serializedObject, hipsTarget.custom, hipsTarget, "custom") {
|
||||
|
||||
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||
attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
if (hipsTarget.humanoid.custom.enabled == false)
|
||||
return;
|
||||
|
||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(hipsTarget.custom, hipsTarget);
|
||||
hipsTarget.custom.enabled = enabledProp.boolValue;
|
||||
if (!Application.isPlaying) {
|
||||
hipsTarget.custom.SetSensor2Target();
|
||||
hipsTarget.custom.ShowSensor(hipsTarget.humanoid.showRealObjects && hipsTarget.showRealObjects);
|
||||
}
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
if (sensorProp.objectReferenceValue == null && hipsTarget.custom.sensorComponent != null)
|
||||
sensorProp.objectReferenceValue = hipsTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
|
||||
|
||||
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||
attachedBoneProp.intValue = (int)(TorsoBones)EditorGUILayout.EnumPopup("Bone", (TorsoBones)attachedBoneProp.intValue);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Hips
|
||||
|
||||
#region Foot
|
||||
|
||||
public class FootTargetProps : FootTarget_Editor.TargetProps {
|
||||
protected SerializedProperty sensorProp;
|
||||
protected SerializedProperty attachedBoneProp;
|
||||
|
||||
public FootTargetProps(SerializedObject serializedObject, FootTarget footTarget)
|
||||
: base(serializedObject, footTarget.custom, footTarget, "custom") {
|
||||
|
||||
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||
attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
if (footTarget.humanoid.custom.enabled == false)
|
||||
return;
|
||||
|
||||
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(footTarget.custom, footTarget);
|
||||
footTarget.custom.enabled = enabledProp.boolValue;
|
||||
if (!Application.isPlaying) {
|
||||
footTarget.custom.SetSensor2Target();
|
||||
footTarget.custom.ShowSensor(footTarget.humanoid.showRealObjects && footTarget.showRealObjects);
|
||||
}
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
if (sensorProp.objectReferenceValue == null && footTarget.custom.sensorComponent != null)
|
||||
sensorProp.objectReferenceValue = footTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
|
||||
|
||||
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||
attachedBoneProp.intValue = (int)(LegBones)EditorGUILayout.EnumPopup("Bone", (LegBones)attachedBoneProp.intValue);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Foot
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d806c9717b1fa46a86f6a982c5e1b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -54,27 +54,33 @@ namespace Passer.Humanoid {
|
||||
protected void OculusHandTrackingInspector() {
|
||||
#if hOCHAND
|
||||
GUIContent labelText = new GUIContent(
|
||||
"Oculus Hand Tracking",
|
||||
"Enables hand tracking on the Oculus Quest"
|
||||
"Quest Hand Tracking",
|
||||
"Enables hand tracking on the Meta Quest"
|
||||
);
|
||||
oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
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)
|
||||
try {
|
||||
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.Substring(0, Application.dataPath.Length - 6) + // remove /Assets
|
||||
humanoidPath + "Extensions/Oculus/QuestManifest.xml";
|
||||
Debug.Log(questManifestPath);
|
||||
File.Copy(questManifestPath, manifestPath);
|
||||
}
|
||||
catch (System.Exception ) {
|
||||
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(
|
||||
@ -104,7 +110,7 @@ namespace Passer.Humanoid {
|
||||
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
||||
: base(serializedObject, headTarget.unityXR, headTarget, nameof(HeadTarget.unityXR)) {
|
||||
|
||||
hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".hmd");
|
||||
hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".sensorComponent");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
||||
@ -116,17 +122,18 @@ namespace Passer.Humanoid {
|
||||
|
||||
if (enabledProp.boolValue) {
|
||||
EditorGUI.indentLevel++;
|
||||
if (headTarget.unityXR.hmd == null) {
|
||||
if (headTarget.unityXR.sensorComponent == null) {
|
||||
// Hmd does not exist
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
EditorGUILayout.LabelField("Hmd", GUILayout.Width(120));
|
||||
if (GUILayout.Button("Show")) {
|
||||
headTarget.unityXR.CheckSensor(headTarget);
|
||||
//headTarget.unityXR.CheckSensor(headTarget);
|
||||
headTarget.unityXR.CheckSensor(headTarget); //.GetSensorComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.hmd, typeof(UnityXRHmd), true);
|
||||
hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.sensorComponent, typeof(UnityXRHmd), true);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
@ -145,7 +152,7 @@ namespace Passer.Humanoid {
|
||||
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
||||
: base(serializedObject, handTarget.unityXR, handTarget, "unityXR") {
|
||||
|
||||
controllerProp = serializedObject.FindProperty("unityXR.controller");
|
||||
controllerProp = serializedObject.FindProperty("unityXR.sensorComponent");
|
||||
}
|
||||
|
||||
public override void Inspector() {
|
@ -10,6 +10,7 @@ using Photon.Pun;
|
||||
#endif
|
||||
|
||||
namespace Passer {
|
||||
using Tracking;
|
||||
using Humanoid;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
@ -289,15 +290,6 @@ namespace Passer {
|
||||
#if pUNITYXR
|
||||
new UnityXR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.unityXR),
|
||||
#endif
|
||||
//#if hOPENVR && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
// new OpenVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.openVR),
|
||||
//#endif
|
||||
//#if hSTEAMVR && UNITY_STANDALONE_WIN
|
||||
// //new SteamVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.steamVR),
|
||||
//#endif
|
||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
||||
// new Oculus_Editor.TrackerProps(serializedObject, targetObjs, humanoid.oculus),
|
||||
//#endif
|
||||
#if hWINDOWSMR && UNITY_WSA_10_0
|
||||
new WindowsMR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.mixedReality),
|
||||
|
||||
@ -305,14 +297,11 @@ namespace Passer {
|
||||
#if hWAVEVR
|
||||
new WaveVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.waveVR),
|
||||
#endif
|
||||
#if hVRTK
|
||||
new Vrtk_Editor.TrackerProps(serializedObject, targetObjs, humanoid.vrtk),
|
||||
#endif
|
||||
#if hHYDRA && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
||||
new Hydra_Editor.TrackerProps(serializedObject, targetObjs, humanoid.hydra),
|
||||
#endif
|
||||
#if hLEAP && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
||||
new LeapMotion_Editor.TrackerProps(serializedObject, targetObjs, humanoid.leapTracker),
|
||||
new LeapMotion_Editor.TrackerProps(serializedObject, targetObjs, humanoid.leap),
|
||||
#endif
|
||||
#if hKINECT1 && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
||||
new Kinect1_Editor.TrackerProps(serializedObject, targetObjs, humanoid.kinect1),
|
||||
@ -388,24 +377,11 @@ namespace Passer {
|
||||
|
||||
#region Animations
|
||||
|
||||
private SerializedProperty animatorParamForwardProp;
|
||||
private SerializedProperty animatorParamSidewardProp;
|
||||
private SerializedProperty animatorParamRotationProp;
|
||||
private SerializedProperty animatorParamHeightProp;
|
||||
|
||||
|
||||
private void InitAnimations(HumanoidControl humanoid) {
|
||||
|
||||
animatorParamForwardProp = serializedObject.FindProperty("animatorParameterForwardIndex");
|
||||
animatorParamSidewardProp = serializedObject.FindProperty("animatorParameterSidewardIndex");
|
||||
animatorParamRotationProp = serializedObject.FindProperty("animatorParameterRotationIndex");
|
||||
animatorParamHeightProp = serializedObject.FindProperty("animatorParameterHeightIndex");
|
||||
}
|
||||
private void InitAnimations(HumanoidControl humanoid) { }
|
||||
|
||||
bool showAnimatorParameters = false;
|
||||
private void AnimatorInspector(HumanoidControl humanoid) {
|
||||
AnimatorControllerInspector(humanoid);
|
||||
AnimatorParametersInspector(humanoid);
|
||||
}
|
||||
|
||||
private void AnimatorControllerInspector(HumanoidControl humanoid) {
|
||||
@ -434,44 +410,6 @@ namespace Passer {
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private void AnimatorParametersInspector(HumanoidControl humanoid) {
|
||||
if (showAnimatorParameters && humanoid.animatorEnabled && humanoid.targetsRig.runtimeAnimatorController != null) {
|
||||
if (animatorParameterNames == null)
|
||||
animatorParameterNames = GetAnimatorParameters(humanoid);
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
GUIContent forwardSpeedText = new GUIContent(
|
||||
"Forward Speed",
|
||||
"Animator parameter controlling the forward motion animation"
|
||||
);
|
||||
animatorParamForwardProp.intValue = SetAnimatorInput(forwardSpeedText, animatorParamForwardProp.intValue, ref humanoid.animatorParameterForward);
|
||||
|
||||
GUIContent sidewardSpeedText = new GUIContent(
|
||||
"Sideward Speed",
|
||||
"Animator parameter controlling the sideward motion animation"
|
||||
);
|
||||
animatorParamSidewardProp.intValue = SetAnimatorInput(sidewardSpeedText, animatorParamSidewardProp.intValue, ref humanoid.animatorParameterSideward);
|
||||
|
||||
GUIContent turnSpeedText = new GUIContent(
|
||||
"Turn Speed",
|
||||
"Animator parameter controlling the rotation animation"
|
||||
);
|
||||
animatorParamRotationProp.intValue = SetAnimatorInput(turnSpeedText, animatorParamRotationProp.intValue, ref humanoid.animatorParameterRotation);
|
||||
|
||||
GUIContent headHeightText = new GUIContent(
|
||||
"Head Height",
|
||||
"Animation parameter controlling the squatting animation"
|
||||
);
|
||||
animatorParamHeightProp.intValue = SetAnimatorInput(headHeightText, animatorParamHeightProp.intValue, ref humanoid.animatorParameterHeight);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
showAnimatorParameters = false;
|
||||
|
||||
}
|
||||
|
||||
protected GUIContent[] animatorParameterNames;
|
||||
public GUIContent[] GetAnimatorParameters(HumanoidControl humanoid) {
|
||||
if (humanoid == null || humanoid.targetsRig.runtimeAnimatorController == null)
|
||||
@ -723,6 +661,7 @@ namespace Passer {
|
||||
CalibrateAtStartSetting();
|
||||
StartPositionSetting();
|
||||
ScalingSetting();
|
||||
FloatCorrectionSetting();
|
||||
DontDestroySetting();
|
||||
if (IsPrefab(humanoid))
|
||||
DisconnectInstancesSetting();
|
||||
@ -781,6 +720,15 @@ namespace Passer {
|
||||
scalingProp.intValue = (int)(HumanoidControl.ScalingType)EditorGUILayout.EnumPopup(text, (HumanoidControl.ScalingType)scalingProp.intValue);
|
||||
}
|
||||
|
||||
protected void FloatCorrectionSetting() {
|
||||
SerializedProperty floatCorrectionProp = serializedObject.FindProperty(nameof(HumanoidControl.floatCorrection));
|
||||
GUIContent text = new GUIContent(
|
||||
"Float Correction",
|
||||
"Correct floating avatars when user is taller than the avatar"
|
||||
);
|
||||
floatCorrectionProp.boolValue = EditorGUILayout.Toggle(text, floatCorrectionProp.boolValue);
|
||||
}
|
||||
|
||||
private void ShowTrackers(HumanoidControl humanoid, bool shown) {
|
||||
foreach (Tracker tracker in humanoid.trackers)
|
||||
tracker.ShowTracker(shown);
|
||||
@ -907,6 +855,7 @@ namespace Passer {
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
humanoid.CopyRigToTargets();
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1136,7 +1085,7 @@ namespace Passer {
|
||||
|
||||
private void RemoveControllers() {
|
||||
foreach (HumanoidSensor sensor in tracker.sensors)
|
||||
RemoveTransform(sensor.sensorTransform);
|
||||
RemoveSensor(sensor.sensorComponent);
|
||||
|
||||
if (tracker.headSensor != null)
|
||||
tracker.headSensor.RemoveController(headSensorProp);
|
||||
@ -1152,11 +1101,16 @@ namespace Passer {
|
||||
tracker.rightFootSensor.RemoveController(rightFootSensorProp);
|
||||
}
|
||||
|
||||
private void RemoveTransform(Transform trackerTransform) {
|
||||
if (trackerTransform != null)
|
||||
DestroyImmediate(trackerTransform.gameObject, true);
|
||||
private void RemoveSensor(Tracking.SensorComponent sensorComponent) {
|
||||
if (sensorComponent != null)
|
||||
DestroyImmediate(sensorComponent.gameObject, true);
|
||||
}
|
||||
|
||||
//private void RemoveTransform(Transform trackerTransform) {
|
||||
// if (trackerTransform != null)
|
||||
// DestroyImmediate(trackerTransform.gameObject, true);
|
||||
//}
|
||||
|
||||
private void SetSensors2Target() {
|
||||
foreach (HumanoidSensor sensor in tracker.sensors) {
|
||||
sensor.SetSensor2Target();
|
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
@ -22,7 +22,8 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
public static GameObject GetHumanoidPlayerPrefab(string prefabPath) {
|
||||
GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
|
||||
//GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
|
||||
GameObject prefab = null;
|
||||
return prefab;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7ce8a0ec51c72a4f8a8f33325b0c51e
|
||||
guid: 875a66c1e6398184192242a8674906b3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
@ -0,0 +1,143 @@
|
||||
using UnityEngine;
|
||||
#if hPHOTON2
|
||||
using Photon.Pun;
|
||||
#if hPUNVOICE2 && !UNITY_WEBGL
|
||||
using Photon.Voice.PUN;
|
||||
using Photon.Voice.Unity;
|
||||
#endif
|
||||
#endif
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class OnLoadHumanoidPlayerPun {
|
||||
static OnLoadHumanoidPlayerPun() {
|
||||
CheckHumanoidPlayer();
|
||||
}
|
||||
|
||||
protected static void CheckHumanoidPlayerVoice() {
|
||||
#if hPUNVOICE2
|
||||
string prefabPath = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefabPath();
|
||||
prefabPath = prefabPath.Substring(0, prefabPath.Length - 21) + "HumanoidPlayerVoice.prefab";
|
||||
GameObject playerVoicePrefab = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefab(prefabPath);
|
||||
if (playerVoicePrefab == null)
|
||||
return;
|
||||
|
||||
bool hasChanged = false;
|
||||
#if UNITY_WEBGL
|
||||
PhotonView photonView = playerVoicePrefab.GetComponent<PhotonView>();
|
||||
if (photonView == null) {
|
||||
photonView = playerVoicePrefab.AddComponent<PhotonView>();
|
||||
hasChanged = true;
|
||||
}
|
||||
#else
|
||||
PhotonVoiceView photonVoiceView = playerVoicePrefab.GetComponent<PhotonVoiceView>();
|
||||
if (photonVoiceView == null) {
|
||||
photonVoiceView = playerVoicePrefab.AddComponent<PhotonVoiceView>();
|
||||
hasChanged = true;
|
||||
}
|
||||
if (photonVoiceView.UsePrimaryRecorder == false) {
|
||||
photonVoiceView.UsePrimaryRecorder = true;
|
||||
hasChanged = true;
|
||||
}
|
||||
PhotonTransformView photonTransformView = playerVoicePrefab.GetComponent<PhotonTransformView>();
|
||||
if (photonTransformView == null) {
|
||||
photonTransformView = playerVoicePrefab.AddComponent<PhotonTransformView>();
|
||||
hasChanged = true;
|
||||
}
|
||||
PhotonView photonView = playerVoicePrefab.GetComponent<PhotonView>();
|
||||
if (photonView != null) {
|
||||
// should always be there because of the photonVoiceView
|
||||
if (photonView.ObservedComponents == null) {
|
||||
photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
|
||||
photonView.ObservedComponents.Add(photonTransformView);
|
||||
photonView.Synchronization = ViewSynchronization.UnreliableOnChange;
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
//Speaker speaker = playerVoicePrefab.GetComponent<Speaker>();
|
||||
//if (speaker == null) {
|
||||
// speaker = playerVoicePrefab.AddComponent<Speaker>();
|
||||
// photonVoiceView.SpeakerInUse = speaker;
|
||||
// hasChanged = true;
|
||||
|
||||
// AudioSource audioSource = playerVoicePrefab.GetComponent<AudioSource>();
|
||||
// if (audioSource != null) {
|
||||
// Debug.Log("adjust rolloff");
|
||||
// // default logaritmic only work when people are closer than 0.5m...
|
||||
// audioSource.maxDistance = 5;
|
||||
// }
|
||||
//}
|
||||
#endif
|
||||
if (hasChanged)
|
||||
OnLoadHumanoidPlayer.UpdateHumanoidPrefab(playerVoicePrefab, prefabPath);
|
||||
#if !UNITY_WEBGL
|
||||
CheckVoiceNetwork();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if hPUNVOICE2 && !UNITY_WEBGL
|
||||
protected static void CheckVoiceNetwork() {
|
||||
NetworkingStarter networkingStarter = Object.FindObjectOfType<NetworkingStarter>();
|
||||
if (networkingStarter == null)
|
||||
return;
|
||||
|
||||
PhotonVoiceNetwork voiceNetwork = Object.FindObjectOfType<PhotonVoiceNetwork>();
|
||||
if (voiceNetwork != null)
|
||||
return;
|
||||
|
||||
GameObject voiceNetworkObject = new GameObject("Voice Network");
|
||||
voiceNetwork = voiceNetworkObject.AddComponent<PhotonVoiceNetwork>();
|
||||
|
||||
Recorder voiceRecorder = voiceNetworkObject.AddComponent<Recorder>();
|
||||
voiceRecorder.ReactOnSystemChanges = true;
|
||||
voiceRecorder.TransmitEnabled = true;
|
||||
voiceRecorder.SamplingRate = POpusCodec.Enums.SamplingRate.Sampling48000;
|
||||
|
||||
voiceNetwork.PrimaryRecorder = voiceRecorder;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static void CheckHumanoidPlayer() {
|
||||
#if hPHOTON1 || hPHOTON2
|
||||
string prefabPath = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefabPath();
|
||||
GameObject playerPrefab = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefab(prefabPath);
|
||||
|
||||
bool hasChanged = false;
|
||||
#if hNW_PHOTON
|
||||
if (playerPrefab != null) {
|
||||
PhotonView photonView = playerPrefab.GetComponent<PhotonView>();
|
||||
if (photonView == null) {
|
||||
photonView = playerPrefab.AddComponent<PhotonView>();
|
||||
photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
|
||||
#if hPHOTON2
|
||||
photonView.Synchronization = ViewSynchronization.UnreliableOnChange;
|
||||
#else
|
||||
photonView.synchronization = ViewSynchronization.UnreliableOnChange;
|
||||
#endif
|
||||
|
||||
HumanoidPlayer humanoidPun = playerPrefab.GetComponent<HumanoidPlayer>();
|
||||
if (humanoidPun != null)
|
||||
photonView.ObservedComponents.Add(humanoidPun);
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (playerPrefab != null) {
|
||||
PhotonView photonView = playerPrefab.GetComponent<PhotonView>();
|
||||
if (photonView != null)
|
||||
Object.DestroyImmediate(photonView, true);
|
||||
}
|
||||
#endif
|
||||
if (hasChanged)
|
||||
OnLoadHumanoidPlayer.UpdateHumanoidPrefab(playerPrefab, prefabPath);
|
||||
#endif
|
||||
CheckHumanoidPlayerVoice();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 185ec4e1799d1ac4d867b69454f1cd0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
108
Editor/HumanoidControl/Networking/PhotonPun/PunStarter_Editor.cs
Normal file
108
Editor/HumanoidControl/Networking/PhotonPun/PunStarter_Editor.cs
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
#if hNW_PHOTON
|
||||
#if hPHOTON2
|
||||
using Photon.Pun;
|
||||
#endif
|
||||
|
||||
namespace Passer {
|
||||
|
||||
[CustomEditor(typeof(PhotonStarter))]
|
||||
public class PunStarter_Editor : Editor {
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
base.OnInspectorGUI();
|
||||
|
||||
HumanoidControl[] humanoids = FindObjectsOfType<HumanoidControl>();
|
||||
if (humanoids.Length != 1)
|
||||
// We only support sitatuation with one humanoid in the scene
|
||||
return;
|
||||
|
||||
//HumanoidControl humanoid = humanoids[0];
|
||||
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
|
||||
//GameObject humanoidPrefab = CheckHumanoidPrefab(humanoid);
|
||||
//NetworkingComponentsInspectorPun(humanoid, humanoidPrefab);
|
||||
}
|
||||
|
||||
//private GameObject CheckHumanoidPrefab(HumanoidControl humanoid) {
|
||||
// GameObject humanoidPrefab = Resources.Load<GameObject>(humanoid.gameObject.name + "_generated");
|
||||
// if (humanoidPrefab == null) {
|
||||
// humanoidPrefab = PrefabUtility.CreatePrefab("Assets/Humanoid/Prefabs/Networking/Resources/" + humanoid.gameObject.name + "_generated.prefab", humanoid.gameObject);
|
||||
// humanoidPrefab.gameObject.SetActive(true);
|
||||
// }
|
||||
// return humanoidPrefab;
|
||||
//}
|
||||
|
||||
//private void UpdateHumanoidPrefab(HumanoidControl humanoid) {
|
||||
// if (humanoid != null) {
|
||||
// GameObject humanoidPrefab = Resources.Load<GameObject>(humanoid.gameObject.name + "_generated");
|
||||
// if (humanoidPrefab != null && humanoid.gameObject != humanoidPrefab)
|
||||
// PrefabUtility.ReplacePrefab(humanoid.gameObject, humanoidPrefab, ReplacePrefabOptions.ConnectToPrefab);
|
||||
// }
|
||||
//}
|
||||
|
||||
// private void NetworkingComponentsInspectorPun(HumanoidControl humanoid, GameObject humanoidPrefab) {
|
||||
//#if hPHOTON1 || hPHOTON2
|
||||
//#if hNW_PHOTON
|
||||
// CheckPunStarter(humanoid, humanoidPrefab);
|
||||
// PhotonView photonView = humanoid.GetComponent<PhotonView>();
|
||||
// if (photonView == null)
|
||||
// photonView = humanoid.gameObject.AddComponent<PhotonView>();
|
||||
// photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
|
||||
// photonView.ObservedComponents.Add(humanoid);
|
||||
//#else
|
||||
// cleanupPhotonView = humanoid.GetComponent<PhotonView>();
|
||||
//#endif
|
||||
//#endif
|
||||
// }
|
||||
|
||||
// private void CheckPunStarter(HumanoidControl humanoid, GameObject humanoidPrefab) {
|
||||
// if (Application.isPlaying)
|
||||
// return;
|
||||
|
||||
//#if hNW_PHOTON
|
||||
// PhotonStarter photonStarter = FindObjectOfType<PhotonStarter>();
|
||||
// if (photonStarter != null && humanoidPrefab != null && photonStarter.playerPrefab != humanoidPrefab) {
|
||||
// Undo.RecordObject(photonStarter, "Updated Player Prefab");
|
||||
// photonStarter.playerPrefab = humanoidPrefab;
|
||||
// }
|
||||
//#endif
|
||||
// }
|
||||
public void OnDisable() {
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
#if hNW_UNET
|
||||
private NetworkIdentity cleanupNetworkIdentity;
|
||||
#endif
|
||||
#if hPHOTON1 || hPHOTON2
|
||||
private PhotonView cleanupPhotonView;
|
||||
#endif
|
||||
private GameObject cleanupPunStarter;
|
||||
private void Cleanup() {
|
||||
#if hNW_UNET
|
||||
if (cleanupNetworkIdentity) {
|
||||
DestroyImmediate(cleanupNetworkIdentity, true);
|
||||
cleanupNetworkIdentity = null;
|
||||
}
|
||||
#endif
|
||||
#if hPHOTON1 || hPHOTON2
|
||||
if (cleanupPhotonView) {
|
||||
DestroyImmediate(cleanupPhotonView, true);
|
||||
cleanupPhotonView = null;
|
||||
}
|
||||
#endif
|
||||
if (cleanupPunStarter) {
|
||||
DestroyImmediate(cleanupPunStarter, true);
|
||||
cleanupPunStarter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e86563dd015c559479420645216c4a70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -236,7 +236,13 @@ namespace Passer.Humanoid {
|
||||
if (bones[i] == null || bones[i].bone == null || bones[i].bone.transform == null)
|
||||
continue;
|
||||
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
Handles.FreeMoveHandle(bones[i].bone.transform.position, 0.002F, Vector3.zero, DotHandleCapSaveID);
|
||||
#else
|
||||
Handles.FreeMoveHandle(bones[i].bone.transform.position, bones[i].bone.transform.rotation, 0.002F, Vector3.zero, DotHandleCapSaveID);
|
||||
#endif
|
||||
|
||||
|
||||
controlIds[i] = lastControlID;
|
||||
boneIds[i] = bones[i].boneId;
|
||||
}
|
||||
@ -317,6 +323,6 @@ namespace Passer.Humanoid {
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ namespace Passer {
|
||||
|
||||
private void InitEditors() {
|
||||
allProps = new TargetProps[] {
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
#if hVIVETRACKER
|
||||
new ViveTracker_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hKINECT1
|
||||
@ -48,9 +48,9 @@ namespace Passer {
|
||||
#if hORBBEC
|
||||
new Astra_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
//#if hNEURON
|
||||
// new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
//#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.FootTargetProps(serializedObject, footTarget),
|
||||
#endif
|
||||
@ -63,9 +63,9 @@ namespace Passer {
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Disable
|
||||
#region Disable
|
||||
public void OnDisable() {
|
||||
if (humanoid == null) {
|
||||
// This target is not connected to a humanoid, so we delete it
|
||||
@ -82,9 +82,9 @@ namespace Passer {
|
||||
foreach (TargetProps props in allProps)
|
||||
props.SetSensor2Target();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
#region Inspector
|
||||
public override void OnInspectorGUI() {
|
||||
if (footTarget == null || humanoid == null)
|
||||
return;
|
||||
@ -142,7 +142,7 @@ namespace Passer {
|
||||
return foundHumanoid;
|
||||
}
|
||||
|
||||
#region Sensors
|
||||
#region Sensors
|
||||
private static bool showControllers = true;
|
||||
private void ControllerInspectors(FootTarget footTarget) {
|
||||
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
||||
@ -157,9 +157,9 @@ namespace Passer {
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Configuration
|
||||
#region Configuration
|
||||
private void InitConfiguration(FootTarget footTarget) {
|
||||
if (footTarget.humanoid.avatarRig == null)
|
||||
return;
|
||||
@ -200,7 +200,7 @@ namespace Passer {
|
||||
UpdateToesBones(target.toes);
|
||||
}
|
||||
|
||||
#region UpperLeg
|
||||
#region UpperLeg
|
||||
//private string upperLegXname;
|
||||
//private SerializedProperty upperLegMinX;
|
||||
//private SerializedProperty upperLegMaxX;
|
||||
@ -276,9 +276,9 @@ namespace Passer {
|
||||
//upperLeg.bone.maxAngles.z = upperLegMaxZ.floatValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region LowerLeg
|
||||
#region LowerLeg
|
||||
//private string lowerLegYname;
|
||||
//private SerializedProperty lowerLegMinX;
|
||||
//private SerializedProperty lowerLegMaxX;
|
||||
@ -326,9 +326,9 @@ namespace Passer {
|
||||
//lowerLeg.bone.minAngles.x = lowerLegMinX.floatValue;
|
||||
//lowerLeg.bone.maxAngles.x = lowerLegMaxX.floatValue;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Foot
|
||||
#region Foot
|
||||
//private string footXname;
|
||||
//private SerializedProperty footMinX;
|
||||
//private SerializedProperty footMaxX;
|
||||
@ -390,9 +390,9 @@ namespace Passer {
|
||||
//foot.bone.minAngles.z = footMinZ.floatValue;
|
||||
//foot.bone.maxAngles.z = footMaxZ.floatValue;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Toes
|
||||
#region Toes
|
||||
//private string toesXname;
|
||||
//private SerializedProperty toesMinX;
|
||||
//private SerializedProperty toesMaxX;
|
||||
@ -441,10 +441,10 @@ namespace Passer {
|
||||
//toes.bone.maxAngles.x = toesMaxX.floatValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
#region Settings
|
||||
private SerializedProperty rotationSpeedLimitationProp;
|
||||
private SerializedProperty slidePreventionProp;
|
||||
|
||||
@ -470,9 +470,9 @@ namespace Passer {
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
#region Events
|
||||
|
||||
protected SerializedProperty groundEventProp;
|
||||
|
||||
@ -534,11 +534,11 @@ namespace Passer {
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Scene
|
||||
#region Scene
|
||||
|
||||
public void OnSceneGUI() {
|
||||
if (footTarget == null || humanoid == null)
|
||||
@ -551,12 +551,13 @@ namespace Passer {
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
footTarget.CopyRigToTarget();
|
||||
humanoid.CopyRigToTargets();
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current foot target
|
||||
footTarget.CopyTargetToRig();
|
||||
humanoid.CopyTargetsToRig();
|
||||
// update the avatar bones from the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
@ -568,11 +569,11 @@ namespace Passer {
|
||||
humanoid.UpdateSensorsFromTargets();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensorComponentProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
@ -581,7 +582,7 @@ namespace Passer {
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, LegSensor _sensor, FootTarget _footTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
@ -592,11 +593,11 @@ namespace Passer {
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
if (sensor.sensorTransform == null)
|
||||
if (sensor.sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * footTarget.foot.target.transform.rotation;
|
||||
sensor2TargetPositionProp.vector3Value = -footTarget.foot.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
|
||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * footTarget.foot.target.transform.rotation;
|
||||
sensor2TargetPositionProp.vector3Value = -footTarget.foot.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
|
||||
}
|
||||
|
||||
public abstract void Inspector();
|
@ -44,17 +44,8 @@ namespace Passer.Humanoid {
|
||||
#if pUNITYXR
|
||||
new UnityXR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
//#if hOPENVR && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
// new OpenVR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
//#if hVIVETRACKER
|
||||
// new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
//#endif
|
||||
//#endif
|
||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
|
||||
//new SteamVR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#if hVIVETRACKER
|
||||
//new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
||||
// new Oculus_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
@ -65,9 +56,6 @@ namespace Passer.Humanoid {
|
||||
#if hWAVEVR
|
||||
new WaveVR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hVRTK
|
||||
new Vrtk_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hLEAP
|
||||
new LeapMotion_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
@ -86,9 +74,9 @@ namespace Passer.Humanoid {
|
||||
#if hORBBEC
|
||||
new Astra_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
//#if hNEURON
|
||||
// new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
//#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.HandTargetProps(serializedObject, handTarget),
|
||||
#endif
|
||||
@ -157,8 +145,6 @@ namespace Passer.Humanoid {
|
||||
InteractionPointerButton(handTarget);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
//serializedObject.Update();
|
||||
//serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
public static HandTarget Inspector(HandTarget handTarget, string name) {
|
||||
@ -451,8 +437,8 @@ namespace Passer.Humanoid {
|
||||
if (showSettings) {
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
// Cannot use serializedPropery because showRealObjects is a getter/setter
|
||||
bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", handTarget.showRealObjects);
|
||||
SerializedProperty showObjectsProp = serializedObject.FindProperty("_showRealObjects");
|
||||
bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", showObjectsProp.boolValue);
|
||||
if (showRealObjects != handTarget.showRealObjects) {
|
||||
handTarget.showRealObjects = showRealObjects;
|
||||
handTarget.ShowSensors(showRealObjects, true);
|
||||
@ -709,12 +695,13 @@ namespace Passer.Humanoid {
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
handTarget.CopyRigToTarget();
|
||||
humanoid.CopyRigToTargets();
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current hand target
|
||||
handTarget.CopyTargetToRig();
|
||||
humanoid.CopyTargetsToRig();
|
||||
// update the avatar bones from the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
@ -730,7 +717,8 @@ namespace Passer.Humanoid {
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
//public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensorComponentProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
@ -739,7 +727,8 @@ namespace Passer.Humanoid {
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, Humanoid.ArmSensor _sensor, HandTarget _handTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
//sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
@ -34,10 +34,8 @@ namespace Passer.Humanoid {
|
||||
#if pUNITYXR
|
||||
new UnityXR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
|
||||
#if hVIVETRACKER
|
||||
//new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hWINDOWSMR && UNITY_WSA_10_0
|
||||
new WindowsMR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
@ -45,9 +43,6 @@ namespace Passer.Humanoid {
|
||||
#if hWAVEVR
|
||||
new WaveVR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hVRTK
|
||||
new Vrtk_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hREALSENSE
|
||||
new Realsense_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
@ -66,9 +61,9 @@ namespace Passer.Humanoid {
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
//#if hNEURON
|
||||
// new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
//#endif
|
||||
#if hTOBII
|
||||
new Tobii_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||
#endif
|
||||
@ -177,7 +172,7 @@ namespace Passer.Humanoid {
|
||||
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
||||
if (showControllers) {
|
||||
EditorGUI.indentLevel++;
|
||||
FirstPersonCameraInspector(headTarget);
|
||||
//FirstPersonCameraInspector(headTarget);
|
||||
ScreenInspector(headTarget);
|
||||
|
||||
foreach (TargetProps props in allProps)
|
||||
@ -280,7 +275,7 @@ namespace Passer.Humanoid {
|
||||
if (headTarget.humanoid == null)
|
||||
return;
|
||||
|
||||
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator)+ "." +nameof(HeadTarget.headAnimator.enabled));
|
||||
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator) + "." + nameof(HeadTarget.headAnimator.enabled));
|
||||
if (animatorProp != null && headTarget.humanoid.animatorEnabled) {
|
||||
|
||||
GUIContent text = new GUIContent(
|
||||
@ -487,12 +482,13 @@ namespace Passer.Humanoid {
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
headTarget.CopyRigToTarget();
|
||||
humanoid.CopyRigToTargets();
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current head target
|
||||
headTarget.CopyTargetToRig();
|
||||
humanoid.CopyTargetsToRig();
|
||||
// update the avatar bones from the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
@ -509,7 +505,8 @@ namespace Passer.Humanoid {
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
//public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensorComponentProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
@ -518,7 +515,7 @@ namespace Passer.Humanoid {
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, HeadSensor _sensor, HeadTarget _headTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
@ -529,11 +526,11 @@ namespace Passer.Humanoid {
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
if (sensor.sensorTransform == null)
|
||||
if (sensor.sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * headTarget.head.target.transform.rotation;
|
||||
sensor2TargetPositionProp.vector3Value = -headTarget.head.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
|
||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * headTarget.head.target.transform.rotation;
|
||||
sensor2TargetPositionProp.vector3Value = -headTarget.head.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
|
||||
}
|
||||
|
||||
public abstract void Inspector();
|
@ -32,7 +32,7 @@ namespace Passer {
|
||||
|
||||
private void InitEditors() {
|
||||
allProps = new TargetProps[] {
|
||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
||||
#if hVIVETRACKER
|
||||
new ViveTracker_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hKINECT1
|
||||
@ -47,9 +47,9 @@ namespace Passer {
|
||||
#if hORBBEC
|
||||
new Astra_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
#if hNEURON
|
||||
new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
//#if hNEURON
|
||||
// new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
//#endif
|
||||
#if hOPTITRACK
|
||||
new Optitrack_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||
#endif
|
||||
@ -276,12 +276,13 @@ namespace Passer {
|
||||
humanoid.pose.UpdatePose(humanoid);
|
||||
else {
|
||||
humanoid.pose.Show(humanoid);
|
||||
hipsTarget.CopyRigToTarget();
|
||||
humanoid.CopyRigToTargets();
|
||||
humanoid.MatchTargetsToAvatar();
|
||||
}
|
||||
}
|
||||
|
||||
// update the target rig from the current hips target
|
||||
hipsTarget.CopyTargetToRig();
|
||||
humanoid.CopyTargetsToRig();
|
||||
// update the avatar bones to match the target rig
|
||||
humanoid.UpdateMovements();
|
||||
// match the target rig with the new avatar pose
|
||||
@ -297,7 +298,8 @@ namespace Passer {
|
||||
|
||||
public abstract class TargetProps {
|
||||
public SerializedProperty enabledProp;
|
||||
public SerializedProperty sensorTransformProp;
|
||||
//public SerializedProperty sensorTransformProp;
|
||||
public SerializedProperty sensorComponentProp;
|
||||
public SerializedProperty sensor2TargetPositionProp;
|
||||
public SerializedProperty sensor2TargetRotationProp;
|
||||
|
||||
@ -306,7 +308,8 @@ namespace Passer {
|
||||
|
||||
public TargetProps(SerializedObject serializedObject, TorsoSensor _sensor, HipsTarget _hipsTarget, string unitySensorName) {
|
||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
//sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||
|
||||
@ -317,11 +320,11 @@ namespace Passer {
|
||||
}
|
||||
|
||||
public virtual void SetSensor2Target() {
|
||||
if (sensor.sensorTransform == null)
|
||||
if (sensor.sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * hipsTarget.hips.target.transform.rotation;
|
||||
sensor2TargetPositionProp.vector3Value = -hipsTarget.hips.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
|
||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * hipsTarget.hips.target.transform.rotation;
|
||||
sensor2TargetPositionProp.vector3Value = -hipsTarget.hips.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
|
||||
}
|
||||
|
||||
public abstract void Inspector();
|
@ -7,7 +7,8 @@
|
||||
"PhotonVoice",
|
||||
"PhotonVoice.PUN",
|
||||
"PhotonRealtime",
|
||||
"PhotonVoice.API"
|
||||
"PhotonVoice.API",
|
||||
"SteamVR"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
|
@ -12,7 +12,7 @@ using UnityEditor;
|
||||
namespace Passer {
|
||||
|
||||
[CustomEditor(typeof(Possessable))]
|
||||
public class Possession_Editor : Editor {
|
||||
public class Possessable_Editor : Editor {
|
||||
|
||||
protected Possessable possession;
|
||||
|
||||
@ -49,9 +49,9 @@ namespace Passer {
|
||||
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
||||
if (assetImporter != null)
|
||||
// HACK: force avatars to avatarhops because we cannot change assetbundle in package prefabs
|
||||
assetImporter.assetBundleName = ""; // "possessions"; //activeScene.name + "_possessions";
|
||||
assetImporter.assetBundleName = activeScene.name + "_possessions";
|
||||
|
||||
//Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName);
|
||||
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName + " - " + possession.siteLocation);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ namespace Passer {
|
||||
string scenePath = activeScene.path;
|
||||
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
||||
// HACK: force avatars to avatarhops because we cannot change assetbundle in package prefabs
|
||||
assetImporter.assetBundleName = ""; //"possessions"; //activeScene.name + "_possessions";
|
||||
//Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName);
|
||||
assetImporter.assetBundleName = activeScene.name + "_possessions";
|
||||
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName + " - " + possession.siteLocation);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace Passer {
|
||||
/// by selecting the appropriate sites in the dialog:
|
||||
///
|
||||
/// \image html BuildSitesDialog.png
|
||||
/// \image rtf BuildSitesDialog.png
|
||||
///
|
||||
/// When the Build button is pressed, all sites will be build and become available in the Assets/SiteBuilds folder
|
||||
/// with a submap for each platform (like Windows, Android...)
|
||||
@ -81,6 +82,8 @@ namespace Passer {
|
||||
bool hasChanged = false;
|
||||
|
||||
for (int i = 0; i < assetbundles.Length; i++) {
|
||||
PrepareSite(assetbundles[i]);
|
||||
|
||||
Sites.SiteBuild siteBuild = siteBuilds.list.Find(sb => sb.siteName == assetbundles[i]);
|
||||
if (siteBuild == null) {
|
||||
siteBuild = new Sites.SiteBuild() {
|
||||
@ -95,6 +98,21 @@ namespace Passer {
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
private static void PrepareSite(string sitename) {
|
||||
string[] paths = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(sitename, sitename);
|
||||
if (paths.Length == 0)
|
||||
return;
|
||||
|
||||
Scene scene = UnityEditor.SceneManagement.EditorSceneManager.OpenScene(paths[0]);
|
||||
if (scene == null) {
|
||||
Debug.Log("Could not load " + sitename);
|
||||
return;
|
||||
}
|
||||
Debug.Log("Prepare " + sitename);
|
||||
NetworkObject_Check.CheckNetworkObjects();
|
||||
UnityEditor.SceneManagement.EditorSceneManager.SaveScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
|
||||
}
|
||||
|
||||
private static void StartBuildToFolder() {
|
||||
string savePath = EditorUtility.SaveFolderPanel("Target folder", "", "");
|
||||
BuildSites(savePath);
|
||||
|
@ -4,6 +4,7 @@ using UnityEngine;
|
||||
namespace Passer {
|
||||
using Humanoid;
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(Handle), true)]
|
||||
public class Handle_Editor : Editor {
|
||||
|
||||
@ -42,9 +43,14 @@ namespace Passer {
|
||||
//if (HumanoidPreferences.help)
|
||||
// EditorGUILayout.HelpBox("Component to specify behaviour when grabbing the GameObject", MessageType.None);
|
||||
|
||||
handle.hand = (Handle.Hand)EditorGUILayout.EnumPopup("Hand", handle.hand);
|
||||
handle.grabType = (Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", handle.grabType);
|
||||
handle.range = EditorGUILayout.FloatField("Range", handle.range);
|
||||
SerializedProperty handProp = serializedObject.FindProperty(nameof(Handle.hand));
|
||||
handProp.intValue = (int)(Handle.Hand)EditorGUILayout.EnumPopup("Hand", (Handle.Hand)handProp.intValue);
|
||||
|
||||
SerializedProperty grabTypeProp = serializedObject.FindProperty(nameof(Handle.grabType));
|
||||
grabTypeProp.intValue = (int)(Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", (Handle.GrabType)grabTypeProp.intValue);
|
||||
|
||||
SerializedProperty rangeProp = serializedObject.FindProperty(nameof(Handle.range));
|
||||
rangeProp.floatValue = EditorGUILayout.FloatField("Range", rangeProp.floatValue);
|
||||
|
||||
HandPoseInspector(handle);
|
||||
CheckHandTarget(handle);
|
||||
|
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
namespace Passer {
|
||||
using Humanoid;
|
||||
|
||||
[CustomEditor(typeof(ControllerInput))]
|
||||
[CustomEditor(typeof(ControllerInput), true)]
|
||||
public class ControllerInput_Editor : Editor {
|
||||
protected ControllerInput controllerInput;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#else
|
||||
@ -10,14 +11,26 @@ namespace Passer {
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class NetworkObject_Check {
|
||||
public int callbackOrder => 0;
|
||||
|
||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report) {
|
||||
CheckNetworkObjects();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Check if this gameObject has the right network transform code</summary>
|
||||
static NetworkObject_Check() {
|
||||
CheckNetworkObjects();
|
||||
}
|
||||
|
||||
public static void CheckNetworkObjects() {
|
||||
NetworkObject[] networkObjects = Object.FindObjectsOfType<NetworkObject>();
|
||||
|
||||
foreach (NetworkObject networkObject in networkObjects)
|
||||
CheckForNetworkObject(networkObject.gameObject);
|
||||
}
|
||||
|
||||
|
||||
public static void CheckForNetworkObject(GameObject gameObject) {
|
||||
CheckNetworkObjectNone(gameObject);
|
||||
CheckNetworkObjectUnet(gameObject);
|
||||
@ -98,6 +111,13 @@ namespace Passer {
|
||||
Photon.Pun.PhotonView photonView = gameObject.GetComponent<Photon.Pun.PhotonView>();
|
||||
if (photonView == null)
|
||||
photonView = gameObject.AddComponent<Photon.Pun.PhotonView>();
|
||||
if (photonView.ViewID == 0) {
|
||||
NetworkObject networkObject = gameObject.GetComponent<NetworkObject>();
|
||||
if (networkObject != null && networkObject.objectIdentity != 0)
|
||||
photonView.ViewID = (int)networkObject.objectIdentity;
|
||||
else
|
||||
Photon.Pun.PhotonNetwork.AllocateViewID(photonView);
|
||||
}
|
||||
|
||||
Photon.Pun.PhotonTransformView transformView = gameObject.GetComponent<Photon.Pun.PhotonTransformView>();
|
||||
if (transformView == null) {
|
||||
|
BIN
HumanoidControl documentation.pdf
Normal file
BIN
HumanoidControl documentation.pdf
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfe80b67437fde040b2ebc0b9cb73a15
|
||||
guid: 53c8571aa9e542643b485a80320a9a70
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4465d1dbeab5b4e48a3b1a5a237ce59a
|
||||
guid: ef89ebf080626664e9353fa0565b680e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
14
README.md
14
README.md
@ -1,22 +1,24 @@
|
||||
Installation
|
||||
============
|
||||
Import this package in Unity directlywith the Package Manager git package importer
|
||||
You can import the Humanoid Control Free package in Unity directly with the Package Manager git package importer.
|
||||
|
||||
See [Unity: Installing from a Git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
|
||||
|
||||
Use the link from 'Clone with HTTP' (for example: https://http://gitlab.passervr.com/passer/unity/humanoidcontrol4_free.git)
|
||||
In this way you can always retrieve the latest version by pressing the Update button in the Package Manager.
|
||||
Use the link from 'Clone with HTTP' (for example: https://git.passer.life/HumanoidControl/HumanoidControl_Free.git)
|
||||
In this way you can always retrieve the latest version by pressing the `Update` button in the Package Manager.
|
||||
|
||||
Optionally, you can use a tag to retrieve a specific version. For example:http://gitlab.passervr.com/passer/unity/humanoidcontrol4_free.git#4.1.0.
|
||||
Optionally, you can use a tag to retrieve a specific version. For example:https://git.passer.life/HumanoidControl/HumanoidControl_Free.git#4.1.0.
|
||||
This will give you a stable version which does not change. Updating can be done by retrieving the package with a link to a new release.
|
||||
|
||||
ChangeLog and Releases
|
||||
======================
|
||||
You will find all releases with links which can be used in the Unity Package Manager here: https://gitlab.passervr.com/passer/unity/humanoidcontrol4_free/-/releases
|
||||
All releases with UnityPackages and links for the Unity Package Manager: [Tags page](https://git.passer.life/HumanoidControl/HumanoidControl_Free/tags).
|
||||
|
||||
An RSS/Atom feed with all releases can be found on the [Tags page](https://git.passer.life/HumanoidControl/HumanoidControl_Free/tags). Click on the _RSS Feed_ icon in the top-right corner to retrieve the feed.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
See [PasserVR HumanoidControl Documentation](https://passervr.com/apis/HumanoidControl/Unity/index.html)
|
||||
For the latest version of the documentation, see [PasserVR HumanoidControl Documentation](https://docs.humanoidcontrol.com/)
|
||||
|
||||
Video
|
||||
=====
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fb2df2e4831fc94782d95487f732d65
|
||||
guid: 9bd4d529ee013784db3923a2bdbc5bef
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
@ -11,6 +11,7 @@ namespace Passer.Humanoid {
|
||||
/// The preferences can be accessed by the Edit->Preferences... menu.
|
||||
///
|
||||
/// \image html HumanoidPreferences.png
|
||||
/// \image rtf 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)
|
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