refact: 删除了冗余的代码

This commit is contained in:
2023-02-28 12:55:21 +08:00
parent abf97571e7
commit 2f9e21fe66
4 changed files with 3 additions and 104 deletions

View File

@@ -1,28 +0,0 @@
/*
using System.Collections.Generic;
using UnityEngine;
namespace Models
{
public class PosTransformator
{
public string mediaPipeName;
//动捕手机端关节点标识
public HumanBodyBones unityName;
//unity内部avatar系统关节点标识
public Vector3 mediaPipePos = new Vector3(0,0,0);
//动捕手机端位置数据
public List<PosTransformator> parent = new List<PosTransformator>();
//该骨骼节点的父关节点列表(因为传上来的数据没有脖子和骨盆节点)
public Quaternion prevQ;
//该骨骼节点的初始角度
public Quaternion currentQ;
//该骨骼节点的当前角度
}
}
*/

View File

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

View File

@@ -87,38 +87,9 @@ namespace Models
}
}
public static void CalculateRotation(PoseTransform poseTransform)
public static void CalculateRotation(ref PoseTransform poseTransform, PoseLandmark landmark)
{
//var temp = _posLandmarks.Find(t=>t.mediaPipeName == landmark.Type.ToString());
var sum = new Vector3(0,0,0);
if (landmark.Visibility > 0.6)
{
var temp = new Vector4(landmark.X, landmark.Y, landmark.Z, 1);
MediaPipePos = new Vector3(-temp.x, -temp.y, -temp.z);
}
if (UnityName != HumanBodyBones.LastBone)
{
Debug.Log(UnityName+".MediaPipePos:"+MediaPipePos);
}
foreach (var parents in Parent)
{
sum += parents.MediaPipePos;
//Debug.Log("parents:"+parents.UnityName+".MediaPipePos:"+parents.MediaPipePos);
}
//Debug.Log("sum:"+sum);
var currentPos = sum / Parent.Count;
CurrentQuaternion = Quaternion.LookRotation(MediaPipePos - currentPos);
}
/// <summary>