feature: 基本完成绑定
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Models;
|
||||
using UnityEngine;
|
||||
@@ -31,7 +32,8 @@ namespace Behaviours
|
||||
{
|
||||
if (_isReceived)
|
||||
{
|
||||
_animator.GetBoneTransform(HumanBodyBones.Hips).rotation = _rotationNodes[HumanBodyBones.Hips].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.Hips).rotation =
|
||||
_rotationNodes[HumanBodyBones.Hips].Rotation;
|
||||
|
||||
/*var rotation = _rotationNodes[HumanBodyBones.Hips].CalculateRotate
|
||||
* Quaternion.Inverse(_rotationNodes[HumanBodyBones.RightUpperArm].CalculateRotate);
|
||||
@@ -52,16 +54,34 @@ namespace Behaviours
|
||||
}
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftUpperArm).rotation = _bonds[9].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftUpperArm).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftLowerArm).rotation = _bonds[10].Rotation;
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftLowerArm).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightUpperArm).rotation = _bonds[15].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightUpperArm).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightLowerArm).rotation = _bonds[16].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightLowerArm).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftUpperLeg).rotation = _bonds[22].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftUpperLeg).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftLowerLeg).rotation = _bonds[23].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.LeftLowerLeg).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightUpperLeg).rotation = _bonds[28].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightUpperLeg).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightLowerLeg).rotation = _bonds[29].Rotation;
|
||||
_animator.GetBoneTransform(HumanBodyBones.RightLowerLeg).Rotate(0, -180, 0,
|
||||
Space.Self);
|
||||
|
||||
_isReceived = false;
|
||||
}
|
||||
@@ -94,11 +114,6 @@ namespace Behaviours
|
||||
oldRotation.Rotation,
|
||||
Quaternion.LookRotation(front));
|
||||
|
||||
_rotationNodes[HumanBodyBones.RightUpperArm] = new RotationNode(
|
||||
_rotationNodes[HumanBodyBones.RightUpperArm],
|
||||
landmarks[PoseLandmarkType.RightShoulder],
|
||||
landmarks[PoseLandmarkType.RightElbow]);
|
||||
|
||||
_landmarks = landmarks;
|
||||
_isReceived = true;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Utils;
|
||||
|
||||
namespace Models
|
||||
{
|
||||
@@ -12,6 +13,7 @@ namespace Models
|
||||
private readonly GameObject _bond;
|
||||
|
||||
public Quaternion Rotation => _bond.transform.rotation;
|
||||
public Vector3 Vector => End.transform.position - Start.transform.position;
|
||||
|
||||
public Bond(GameObject start,GameObject end,float scale)
|
||||
{
|
||||
|
Reference in New Issue
Block a user