feature: 模型绑定四肢和身体

This commit is contained in:
2023-03-30 14:26:38 +08:00
parent 77bf523001
commit f812a1b831
6 changed files with 203 additions and 20 deletions

View File

@@ -10,6 +10,8 @@ namespace Models
protected readonly GameObject Start;
protected readonly GameObject End;
private readonly GameObject _bond;
public Quaternion Rotation => _bond.transform.rotation;
public Bond(GameObject start,GameObject end,float scale)
{

View File

@@ -40,7 +40,7 @@ namespace Models
/// </summary>
public float Z { get; }
public Vector3 Vector3 => new Vector3(X, Y, Z);
public Vector3 Position => new Vector3(-X, -Y, -0.2f * Z);
/// <summary>
/// 该坐标点估计的可见性

View File

@@ -4,11 +4,11 @@ namespace Models
{
public struct RotationNode
{
public HumanBodyBones UnityName;
public readonly HumanBodyBones UnityName;
public Quaternion PreviousRotation;
public Quaternion Rotation;
public Quaternion CalculateRotate => PreviousRotation * Quaternion.Inverse(PreviousRotation);
public Quaternion CalculateRotate => PreviousRotation * Quaternion.Inverse(Rotation);
public RotationNode(HumanBodyBones humanBodyBone, Quaternion previousRotation, Quaternion rotation)
{
@@ -22,7 +22,7 @@ namespace Models
UnityName = node.UnityName;
PreviousRotation = node.Rotation;
var forward = new Vector3(end.X - begin.X, end.Y - begin.Y, end.Z - begin.Z);
var forward = end.Position - begin.Position;
Rotation = Quaternion.LookRotation(forward);
}
}