diff --git a/Assets/Models/ModelControler.cs b/Assets/Models/ModelControler.cs deleted file mode 100644 index 6c85fe8..0000000 --- a/Assets/Models/ModelControler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using Models; -using UnityEngine; - -public class ModelControler : MonoBehaviour -{ - Animator animator; - //float deltaz = 0f; - //Vector3 upperArm = new Vector3(0f, 0f, 0f); - private Quaternion[] prevQ = new Quaternion[15]; - - private static Quaternion[] uniRotation = new Quaternion[15]; //全局两坐标系通用四元数 - - private readonly UdpListener _listener = new UdpListener(); - - private static Dictionary Landmarks_Mapping= new Dictionary(); - - - void Start() - { - - _listener.AddHandler(LogLandmarks); - _listener.AddHandler(RigPoint); - _listener.Connect(5000); - - - DictProcess(); //匹配字典初始化 - - - // 获取动画控件 - animator = this.GetComponent(); - - GetOriginStatus(); // 获取骨骼的原始旋转角 - - - - - - } - - // Update is called once per frame - void Update() - { - //deltaz += 1f; - //upperArm.z = deltaz; - - //animator.GetBoneTransform(HumanBodyBones.RightLowerArm).rotation = uniRotation * prevQ ; - int pos=0; - foreach(var landmark in Landmarks_Mapping.Values) - { - animator.GetBoneTransform(landmark).rotation = uniRotation[pos]; - pos++; - } - //animator.GetBoneTransform(HumanBodyBones.RightLowerArm).rotation = uniRotation[14]; - - } - - private void OnDisable() - { - _listener.DisConnect(); - } - - private static void LogLandmarks(List landmarks) - { - foreach (var landmark in landmarks) - { - Debug.Log(landmark.ToString()); - } - } - - - //获取传上来的数据点坐标转换成四元数的回调函数 - private static void RigPoint(List landmarks) - { - int pos = 0; - - foreach (var landmark in landmarks) - { - - if(Landmarks_Mapping.ContainsKey(landmark.Type.ToString())) - { - - Vector3 realPosition = new Vector3(landmark.X,landmark.Y,landmark.Z); - - if(landmark.Visibility<0.8){ - - //uniRotation=(0f,0f); - - } - - else - { - - uniRotation[pos] = Quaternion.LookRotation(realPosition); - pos++; - } - - } - } - - /* - Vector3 realPosition = new Vector3(landmarks[14].X,landmarks[14].Y,landmarks[14].Z); - - if(landmarks[14].Visibility<0.8){ - - //uniRotation=(0f,0f); - - } - else{ - - uniRotation[14] = Quaternion.LookRotation(realPosition); - - } - - //Debug.Log(uniRotation); - */ - } - - private void DictProcess() - { - - /*下面的语句的顺序最好别调换,不然可能会发生难以预料的事情*/ - - Landmarks_Mapping.Add("Nose",HumanBodyBones.Head); //0 10 - - Landmarks_Mapping.Add("LeftShoulder",HumanBodyBones.LeftUpperArm); //11 - - Landmarks_Mapping.Add("RightShoulder",HumanBodyBones.RightUpperArm); //12 - - Landmarks_Mapping.Add("LeftElbow",HumanBodyBones.LeftLowerArm); //13 - - Landmarks_Mapping.Add("RightElbow",HumanBodyBones.RightLowerArm); //14 - - Landmarks_Mapping.Add("LeftWrist",HumanBodyBones.LeftHand); //15 - - Landmarks_Mapping.Add("RightWrist",HumanBodyBones.RightHand); //16 - - Landmarks_Mapping.Add("LeftHip",HumanBodyBones.LeftUpperLeg); //23 - - Landmarks_Mapping.Add("RightHip",HumanBodyBones.RightUpperLeg); //24 - - Landmarks_Mapping.Add("LeftKnee",HumanBodyBones.LeftLowerLeg); //25 - - Landmarks_Mapping.Add("RightKnee",HumanBodyBones.RightLowerLeg); //26 - - Landmarks_Mapping.Add("LeftAnkle",HumanBodyBones.LeftFoot); //27 - - Landmarks_Mapping.Add("RightAnkle",HumanBodyBones.RightFoot); //28 - - Landmarks_Mapping.Add("LeftFootIndex",HumanBodyBones.LeftToes); //31 - - Landmarks_Mapping.Add("RightFootIndex",HumanBodyBones.RightToes); //32 - - } - - private void GetOriginStatus() - { - - int pos=0; - - foreach(var landmarks in Landmarks_Mapping.Values) - { - - - prevQ[pos] = animator.GetBoneTransform(landmarks).rotation; - //Quaternion currentQ = Quaternion.Euler(upperArm.x, upperArm.y, upperArm.z); - //animator.GetBoneTransform(HumanBodyBones.LeftUpperArm).rotation = currentQ * prevQ; - uniRotation[pos] = prevQ[pos]; - - pos++; - - } - - } - -} diff --git a/Assets/Models/ModelControler.cs.meta b/Assets/Models/ModelControler.cs.meta deleted file mode 100644 index 27c22a3..0000000 --- a/Assets/Models/ModelControler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f3dc31402d1b12d4faa2846675feff35 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 91b9be0..5b0ed3d 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -234,11 +234,7 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} -<<<<<<< Updated upstream ---- !u!1001 &421937415 -======= --- !u!1001 &404755305 ->>>>>>> Stashed changes PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -259,11 +255,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} propertyPath: m_LocalPosition.z -<<<<<<< Updated upstream - value: 5 -======= value: 0 ->>>>>>> Stashed changes objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} propertyPath: m_LocalRotation.w @@ -293,59 +285,29 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} -<<<<<<< Updated upstream - - target: {fileID: -2845779275431937956, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} -======= ->>>>>>> Stashed changes - target: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} propertyPath: m_Name value: troop objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} -<<<<<<< Updated upstream ---- !u!1 &437000000 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} - m_PrefabInstance: {fileID: 421937415} - m_PrefabAsset: {fileID: 0} ---- !u!114 &437000001 -======= --- !u!1 &404755306 stripped GameObject: m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} m_PrefabInstance: {fileID: 404755305} m_PrefabAsset: {fileID: 0} --- !u!114 &404755307 ->>>>>>> Stashed changes MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} -<<<<<<< Updated upstream - m_GameObject: {fileID: 437000000} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f3dc31402d1b12d4faa2846675feff35, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!4 &437000003 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} - m_PrefabInstance: {fileID: 421937415} - m_PrefabAsset: {fileID: 0} -======= m_GameObject: {fileID: 404755306} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a2b30b6aa6e08c4468a02e1fcabcd485, type: 3} m_Name: m_EditorClassIdentifier: ->>>>>>> Stashed changes --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -518,11 +480,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 963194225} m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} -<<<<<<< Updated upstream - m_LocalPosition: {x: 0, y: 9.29, z: 20} -======= m_LocalPosition: {x: 0, y: 7, z: 15} ->>>>>>> Stashed changes m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index ecacec9..247163d 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -7,34 +7,34 @@ "dependencies": { "com.unity.services.core": "1.0.1" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.editorcoroutines": { "version": "1.0.0", "depth": 1, "source": "registry", "dependencies": {}, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, "source": "registry", "dependencies": {}, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.feature.development": { "version": "1.0.1", "depth": 0, "source": "builtin", "dependencies": { - "com.unity.ide.visualstudio": "2.0.16", - "com.unity.ide.rider": "3.0.16", + "com.unity.ide.visualstudio": "2.0.14", + "com.unity.ide.rider": "3.0.12", "com.unity.ide.vscode": "1.2.5", "com.unity.editorcoroutines": "1.0.0", "com.unity.performance.profile-analyzer": "1.1.1", "com.unity.test-framework": "1.1.31", - "com.unity.testtools.codecoverage": "1.2.2" + "com.unity.testtools.codecoverage": "1.0.1" } }, "com.unity.ide.rider": { @@ -44,7 +44,7 @@ "dependencies": { "com.unity.ext.nunit": "1.0.6" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { "version": "2.0.16", @@ -53,46 +53,37 @@ "dependencies": { "com.unity.test-framework": "1.1.9" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.ide.vscode": { "version": "1.2.5", "depth": 0, "source": "registry", "dependencies": {}, - "url": "https://packages.unity.cn" - }, - "com.unity.nuget.newtonsoft-json": { - "version": "3.0.2", - "depth": 2, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.performance.profile-analyzer": { "version": "1.1.1", "depth": 1, "source": "registry", "dependencies": {}, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.services.core": { - "version": "1.6.0", + "version": "1.0.1", "depth": 1, "source": "registry", "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.nuget.newtonsoft-json": "3.0.2", - "com.unity.modules.androidjni": "1.0.0" + "com.unity.modules.unitywebrequest": "1.0.0" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.settings-manager": { "version": "1.0.3", "depth": 2, "source": "registry", "dependencies": {}, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.test-framework": { "version": "1.1.31", @@ -103,17 +94,17 @@ "com.unity.modules.imgui": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.testtools.codecoverage": { - "version": "1.2.2", + "version": "1.0.1", "depth": 1, "source": "registry", "dependencies": { "com.unity.test-framework": "1.0.16", "com.unity.settings-manager": "1.0.1" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.textmeshpro": { "version": "3.0.6", @@ -122,7 +113,7 @@ "dependencies": { "com.unity.ugui": "1.0.0" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.timeline": { "version": "1.6.4", @@ -134,7 +125,7 @@ "com.unity.modules.audio": "1.0.0", "com.unity.modules.particlesystem": "1.0.0" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.ugui": { "version": "1.0.0", @@ -153,7 +144,7 @@ "com.unity.ugui": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0" }, - "url": "https://packages.unity.cn" + "url": "https://packages.unity.com" }, "com.unity.modules.ai": { "version": "1.0.0", diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset index 93543c4..9990e02 100644 --- a/ProjectSettings/PackageManagerSettings.asset +++ b/ProjectSettings/PackageManagerSettings.asset @@ -21,16 +21,15 @@ MonoBehaviour: m_Registries: - m_Id: main m_Name: - m_Url: https://packages.unity.cn + m_Url: https://packages.unity.com m_Scopes: [] m_IsDefault: 1 m_Capabilities: 7 - m_ConfigSource: 0 m_UserSelectedRegistryName: m_UserAddingNewScopedRegistry: 0 m_RegistryInfoDraft: m_Modified: 0 m_ErrorMessage: - m_UserModificationsInstanceId: -846 - m_OriginalInstanceId: -848 + m_UserModificationsInstanceId: -824 + m_OriginalInstanceId: -826 m_LoadAssets: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index edfab77..0d22176 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.3.16f1c1 -m_EditorVersionWithRevision: 2021.3.16f1c1 (56dbfdd6697f) +m_EditorVersion: 2021.2.18f1 +m_EditorVersionWithRevision: 2021.2.18f1 (0c6e675195cf)