fix:将父节点的类型改为PoseLandmarkType

This commit is contained in:
Ichirinko
2023-02-28 22:59:38 +08:00
parent 2f9e21fe66
commit 87831fd869
2 changed files with 31 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Collections;
namespace Models
{
@@ -32,7 +33,7 @@ namespace Models
/// <summary>
/// 节点的父节点列表
/// </summary>
public readonly List<PoseTransform> Parent;
public readonly List<PoseLandmarkType> Parent;
/// <summary>
/// 骨骼节点的初始角度
@@ -55,7 +56,7 @@ namespace Models
MediaPipeName = type;
UnityName = GetRelatedBone(type);
AveragePos = new Vector3();
Parent = new List<PoseTransform>();
Parent = new List<PoseLandmarkType>();
PreviousQuaternion = new Quaternion();
CurrentQuaternion = new Quaternion();
AverageLength = averageLength;
@@ -78,12 +79,20 @@ namespace Models
var sum = new Vector3();
var parentsum = new Vector3(0f,0f,0f);
foreach (var poseLandmark in pose._landmarkQueue)
{
sum += new Vector3(poseLandmark.X, poseLandmark.Y, poseLandmark.Z);
}
pose.AveragePos = sum / AverageLength;
//pose.CurrentQuaternion = Quaternion.LookRotation(pose.AveragePos - parentsum).normalized;
}
}