fix: 修复版本问题,移除错误的文件

This commit is contained in:
Ichirinko 2023-02-19 21:09:46 +08:00
parent be507d250e
commit e6a19beb0c
6 changed files with 25 additions and 267 deletions

View File

@ -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<string,(HumanBodyBones,int)> Landmarks_Mapping= new Dictionary<string,HumanBodyBones>();
void Start()
{
_listener.AddHandler(LogLandmarks);
_listener.AddHandler(RigPoint);
_listener.Connect(5000);
DictProcess(); //匹配字典初始化
// 获取动画控件
animator = this.GetComponent<Animator>();
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<PoseLandmark> landmarks)
{
foreach (var landmark in landmarks)
{
Debug.Log(landmark.ToString());
}
}
//获取传上来的数据点坐标转换成四元数的回调函数
private static void RigPoint(List<PoseLandmark> 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++;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f3dc31402d1b12d4faa2846675feff35
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -234,11 +234,7 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
<<<<<<< Updated upstream
--- !u!1001 &421937415
=======
--- !u!1001 &404755305 --- !u!1001 &404755305
>>>>>>> Stashed changes
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
@ -259,11 +255,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} - target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
<<<<<<< Updated upstream
value: 5
=======
value: 0 value: 0
>>>>>>> Stashed changes
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} - target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
@ -293,59 +285,29 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 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} - target: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: troop value: troop
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} 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 --- !u!1 &404755306 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3} m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
m_PrefabInstance: {fileID: 404755305} m_PrefabInstance: {fileID: 404755305}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &404755307 --- !u!114 &404755307
>>>>>>> Stashed changes
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {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_GameObject: {fileID: 404755306}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a2b30b6aa6e08c4468a02e1fcabcd485, type: 3} m_Script: {fileID: 11500000, guid: a2b30b6aa6e08c4468a02e1fcabcd485, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
>>>>>>> Stashed changes
--- !u!1 &705507993 --- !u!1 &705507993
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -518,11 +480,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225} m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} 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} m_LocalPosition: {x: 0, y: 7, z: 15}
>>>>>>> Stashed changes
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []

View File

@ -7,34 +7,34 @@
"dependencies": { "dependencies": {
"com.unity.services.core": "1.0.1" "com.unity.services.core": "1.0.1"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.editorcoroutines": { "com.unity.editorcoroutines": {
"version": "1.0.0", "version": "1.0.0",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ext.nunit": { "com.unity.ext.nunit": {
"version": "1.0.6", "version": "1.0.6",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.feature.development": { "com.unity.feature.development": {
"version": "1.0.1", "version": "1.0.1",
"depth": 0, "depth": 0,
"source": "builtin", "source": "builtin",
"dependencies": { "dependencies": {
"com.unity.ide.visualstudio": "2.0.16", "com.unity.ide.visualstudio": "2.0.14",
"com.unity.ide.rider": "3.0.16", "com.unity.ide.rider": "3.0.12",
"com.unity.ide.vscode": "1.2.5", "com.unity.ide.vscode": "1.2.5",
"com.unity.editorcoroutines": "1.0.0", "com.unity.editorcoroutines": "1.0.0",
"com.unity.performance.profile-analyzer": "1.1.1", "com.unity.performance.profile-analyzer": "1.1.1",
"com.unity.test-framework": "1.1.31", "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": { "com.unity.ide.rider": {
@ -44,7 +44,7 @@
"dependencies": { "dependencies": {
"com.unity.ext.nunit": "1.0.6" "com.unity.ext.nunit": "1.0.6"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.visualstudio": { "com.unity.ide.visualstudio": {
"version": "2.0.16", "version": "2.0.16",
@ -53,46 +53,37 @@
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.1.9" "com.unity.test-framework": "1.1.9"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.vscode": { "com.unity.ide.vscode": {
"version": "1.2.5", "version": "1.2.5",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
},
"com.unity.nuget.newtonsoft-json": {
"version": "3.0.2",
"depth": 2,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.cn"
}, },
"com.unity.performance.profile-analyzer": { "com.unity.performance.profile-analyzer": {
"version": "1.1.1", "version": "1.1.1",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.services.core": { "com.unity.services.core": {
"version": "1.6.0", "version": "1.0.1",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0"
"com.unity.nuget.newtonsoft-json": "3.0.2",
"com.unity.modules.androidjni": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.settings-manager": { "com.unity.settings-manager": {
"version": "1.0.3", "version": "1.0.3",
"depth": 2, "depth": 2,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.31", "version": "1.1.31",
@ -103,17 +94,17 @@
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.testtools.codecoverage": { "com.unity.testtools.codecoverage": {
"version": "1.2.2", "version": "1.0.1",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.0.16", "com.unity.test-framework": "1.0.16",
"com.unity.settings-manager": "1.0.1" "com.unity.settings-manager": "1.0.1"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.textmeshpro": { "com.unity.textmeshpro": {
"version": "3.0.6", "version": "3.0.6",
@ -122,7 +113,7 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.timeline": { "com.unity.timeline": {
"version": "1.6.4", "version": "1.6.4",
@ -134,7 +125,7 @@
"com.unity.modules.audio": "1.0.0", "com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0" "com.unity.modules.particlesystem": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.0",
@ -153,7 +144,7 @@
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.modules.ai": { "com.unity.modules.ai": {
"version": "1.0.0", "version": "1.0.0",

View File

@ -21,16 +21,15 @@ MonoBehaviour:
m_Registries: m_Registries:
- m_Id: main - m_Id: main
m_Name: m_Name:
m_Url: https://packages.unity.cn m_Url: https://packages.unity.com
m_Scopes: [] m_Scopes: []
m_IsDefault: 1 m_IsDefault: 1
m_Capabilities: 7 m_Capabilities: 7
m_ConfigSource: 0
m_UserSelectedRegistryName: m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0 m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft: m_RegistryInfoDraft:
m_Modified: 0 m_Modified: 0
m_ErrorMessage: m_ErrorMessage:
m_UserModificationsInstanceId: -846 m_UserModificationsInstanceId: -824
m_OriginalInstanceId: -848 m_OriginalInstanceId: -826
m_LoadAssets: 0 m_LoadAssets: 0

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.16f1c1 m_EditorVersion: 2021.2.18f1
m_EditorVersionWithRevision: 2021.3.16f1c1 (56dbfdd6697f) m_EditorVersionWithRevision: 2021.2.18f1 (0c6e675195cf)