Merge pull request 'feature-binding: 动作绑定完成' (#1) from feature-binding into master

Reviewed-on: https://rrricardo.top/git/MotionCapture/MotionCapture/pulls/1
This commit is contained in:
jackfiled 2023-03-30 21:32:33 +08:00
commit ca24486eac
46 changed files with 2283 additions and 349 deletions

View File

@ -39,7 +39,7 @@ ModelImporter:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationCompression: 3
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
@ -106,11 +106,11 @@ ModelImporter:
globalScale: 1
rootMotionBoneName: mixamorig:Hips
hasTranslationDoF: 0
hasExtraRoot: 0
hasExtraRoot: 1
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
animationType: 3
humanoidOversampling: 1
avatarSetup: 1
addHumanoidExtraRootOnlyWhenUsingAvatar: 1

8
Assets/Behaviours.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 83bce6e0ab5db38aaaae7ec73b738130
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,186 @@
using System.Collections.Generic;
using Models;
using UnityEngine;
using Utils.PoseTransformHandlers;
namespace Behaviours
{
public class BallStickBehaviour : MonoBehaviour
{
private readonly GameObject[] _nodes = new GameObject[PoseLandmarkType.MaxValue];
private readonly List<Bond> _bonds = new List<Bond>();
private readonly PoseTransform[] _poseTransforms = new PoseTransform[PoseLandmarkType.MaxValue];
private readonly UdpListener _listener = new UdpListener();
private const float Scale = 0.2f;
// Start is called before the first frame update
private void Start()
{
PoseTransform.AverageLength = 3;
CreateNodes();
CreateBonds();
_listener.AddHandler(OnReceive);
_listener.Connect(5000);
}
// Update is called once per frame
private void Update()
{
var mid = _poseTransforms[PoseLandmarkType.LeftHip] + _poseTransforms[PoseLandmarkType.RightHip];
mid = mid / 2;
for (var i = 0; i < PoseLandmarkType.MaxValue; i++)
{
_nodes[i].transform.position = (_poseTransforms[i].ResultPosition - mid) * -5f;
}
foreach (var bond in _bonds)
{
bond.UpdateBond();
}
}
private void OnDisable()
{
_listener.DisConnect();
}
private void OnReceive(List<PoseLandmark> landmarks)
{
foreach (var landmark in landmarks)
{
PoseTransform.UpdatePosition(ref _poseTransforms[landmark.Type.Value], landmark);
}
}
private void CreateNodes()
{
for (var i = 0; i < PoseLandmarkType.MaxValue; i++)
{
var ball = GameObject.CreatePrimitive(PrimitiveType.Sphere);
ball.transform.localScale = new Vector3(Scale, Scale, Scale);
if (i <= 10)
{
ball.GetComponent<Renderer>().material.color = Color.red; //给头部添加颜色
}
else if (i <= 22)
{
ball.GetComponent<Renderer>().material.color = Color.blue; //给手部添加颜色
}
else if (i <= 32)
{
ball.GetComponent<Renderer>().material.color = Color.green; //给脚部添加颜色
}
_nodes[i] = ball;
_poseTransforms[i] = new PoseTransform(i, new AverageHandler());
}
}
private void CreateBonds()
{
var headBonds = new[]
{
PoseLandmarkType.RightEar,
PoseLandmarkType.RightEyeOuter,
PoseLandmarkType.RightEye,
PoseLandmarkType.RightEyeInner,
PoseLandmarkType.Nose,
PoseLandmarkType.LeftEyeInner,
PoseLandmarkType.LeftEye,
PoseLandmarkType.LeftEyeOuter,
PoseLandmarkType.LeftEar
};
_bonds.AddRange(GenerateBondsList(headBonds));
var monthBonds = new[]
{
PoseLandmarkType.MouthLeft,
PoseLandmarkType.MouthRight,
};
_bonds.AddRange(GenerateBondsList(monthBonds));
var leftArmBonds = new[]
{
PoseLandmarkType.LeftShoulder,
PoseLandmarkType.LeftElbow,
PoseLandmarkType.LeftWrist,
PoseLandmarkType.LeftPinky,
PoseLandmarkType.LeftIndex,
PoseLandmarkType.LeftWrist,
PoseLandmarkType.LeftThumb
};
_bonds.AddRange(GenerateBondsList(leftArmBonds));
var rightArmBonds = new[]
{
PoseLandmarkType.RightShoulder,
PoseLandmarkType.RightElbow,
PoseLandmarkType.RightWrist,
PoseLandmarkType.RightPinky,
PoseLandmarkType.RightIndex,
PoseLandmarkType.RightWrist,
PoseLandmarkType.RightThumb
};
_bonds.AddRange(GenerateBondsList(rightArmBonds));
var leftLegBonds = new[]
{
PoseLandmarkType.LeftShoulder,
PoseLandmarkType.LeftHip,
PoseLandmarkType.LeftKnee,
PoseLandmarkType.LeftAnkle,
PoseLandmarkType.LeftHeel,
PoseLandmarkType.LeftFootIndex,
PoseLandmarkType.LeftAnkle
};
_bonds.AddRange(GenerateBondsList(leftLegBonds));
var rightLegBonds = new[]
{
PoseLandmarkType.RightShoulder,
PoseLandmarkType.RightHip,
PoseLandmarkType.RightKnee,
PoseLandmarkType.RightAnkle,
PoseLandmarkType.RightHeel,
PoseLandmarkType.RightFootIndex,
PoseLandmarkType.RightAnkle
};
_bonds.AddRange(GenerateBondsList(rightLegBonds));
// 最后手动添加身体上的两条横线
_bonds.Add(new Bond(
_nodes[PoseLandmarkType.LeftShoulder],
_nodes[PoseLandmarkType.RightShoulder],
Scale));
_bonds.Add(new Bond(
_nodes[PoseLandmarkType.LeftHip],
_nodes[PoseLandmarkType.RightHip],
Scale));
}
/// <summary>
/// 创建棍子列表
/// </summary>
/// <param name="nodes">需要连接起来的关键点 需要按顺序设置</param>
/// <returns></returns>
private List<Bond> GenerateBondsList(int[] nodes)
{
var bonds = new List<Bond>();
for (var i = 0; i < nodes.Length - 1; i++)
{
bonds.Add(new Bond(
_nodes[nodes[i]],
_nodes[nodes[i + 1]],
Scale));
}
return bonds;
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 11e8a976fe328b1c3bdf9f44ef9f6fa1
guid: 574a3724e040787f7afd9341fba89cf2
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,272 @@
using System;
using System.Collections.Generic;
using Models;
using UnityEngine;
namespace Behaviours
{
public class BoneBehaviour : MonoBehaviour
{
private readonly UdpListener _listener = new UdpListener();
private readonly GameObject[] _nodes = new GameObject[PoseLandmarkType.MaxValue];
private readonly List<Bond> _bonds = new List<Bond>();
private Dictionary<HumanBodyBones, RotationNode> _rotationNodes;
private List<PoseLandmark> _landmarks;
private Animator _animator;
private bool _isReceived;
private const float Scale = 0.2f;
private void Start()
{
_animator = GetComponent<Animator>();
CreateRotationNodes();
CreateNodes();
CreateBonds();
_listener.AddHandler(OnReceive);
_listener.Connect(5000);
}
private void Update()
{
if (_isReceived)
{
_animator.GetBoneTransform(HumanBodyBones.Hips).rotation =
_rotationNodes[HumanBodyBones.Hips].Rotation;
/*var rotation = _rotationNodes[HumanBodyBones.Hips].CalculateRotate
* Quaternion.Inverse(_rotationNodes[HumanBodyBones.RightUpperArm].CalculateRotate);
_animator.GetBoneTransform(HumanBodyBones.RightUpperArm).Rotate(rotation.eulerAngles);*/
var mid = (_landmarks[PoseLandmarkType.LeftHip].Position +
_landmarks[PoseLandmarkType.RightHip].Position) / 2;
for (var i = 0; i < PoseLandmarkType.MaxValue; i++)
{
_nodes[i].transform.position = (_landmarks[i].Position - mid) * 5f;
}
foreach (var bond in _bonds)
{
bond.UpdateBond();
}
_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;
}
}
private void OnDisable()
{
_listener.DisConnect();
}
private void OnReceive(List<PoseLandmark> landmarks)
{
// 计算腰部
var frontLeft = Vector3.Cross(
landmarks[PoseLandmarkType.RightHip].Position - landmarks[PoseLandmarkType.LeftHip].Position,
landmarks[PoseLandmarkType.RightShoulder].Position - landmarks[PoseLandmarkType.LeftHip].Position);
var frontRight = Vector3.Cross(
landmarks[PoseLandmarkType.LeftShoulder].Position - landmarks[PoseLandmarkType.RightHip].Position,
landmarks[PoseLandmarkType.LeftHip].Position - landmarks[PoseLandmarkType.LeftHip].Position);
var front = frontLeft + frontRight;
front.Normalize();
var oldRotation = _rotationNodes[HumanBodyBones.Hips];
_rotationNodes[HumanBodyBones.Hips] = new RotationNode(
oldRotation.UnityName,
oldRotation.Rotation,
Quaternion.LookRotation(front));
_landmarks = landmarks;
_isReceived = true;
}
private void CreateRotationNodes()
{
_rotationNodes = new Dictionary<HumanBodyBones, RotationNode>();
var bonesArray = new[]
{
HumanBodyBones.Hips,
HumanBodyBones.LeftUpperArm,
HumanBodyBones.LeftLowerArm,
HumanBodyBones.RightUpperArm,
HumanBodyBones.RightLowerArm,
HumanBodyBones.LeftUpperLeg,
HumanBodyBones.LeftLowerLeg,
HumanBodyBones.RightUpperLeg,
HumanBodyBones.RightLowerLeg
};
foreach (var bone in bonesArray)
{
var rotation = _animator.GetBoneTransform(bone).rotation;
_rotationNodes.Add(bone, new RotationNode(bone, rotation, rotation));
}
}
private void CreateNodes()
{
for (var i = 0; i < PoseLandmarkType.MaxValue; i++)
{
var ball = GameObject.CreatePrimitive(PrimitiveType.Sphere);
ball.transform.localScale = new Vector3(Scale, Scale, Scale);
if (i <= 10)
{
ball.GetComponent<Renderer>().material.color = Color.red; //给头部添加颜色
}
else if (i <= 22)
{
ball.GetComponent<Renderer>().material.color = Color.blue; //给手部添加颜色
}
else if (i <= 32)
{
ball.GetComponent<Renderer>().material.color = Color.green; //给脚部添加颜色
}
_nodes[i] = ball;
}
}
private void CreateBonds()
{
var headBonds = new[]
{
PoseLandmarkType.RightEar,
PoseLandmarkType.RightEyeOuter,
PoseLandmarkType.RightEye,
PoseLandmarkType.RightEyeInner,
PoseLandmarkType.Nose,
PoseLandmarkType.LeftEyeInner,
PoseLandmarkType.LeftEye,
PoseLandmarkType.LeftEyeOuter,
PoseLandmarkType.LeftEar
};
_bonds.AddRange(GenerateBondsList(headBonds));
var monthBonds = new[]
{
PoseLandmarkType.MouthLeft,
PoseLandmarkType.MouthRight,
};
_bonds.AddRange(GenerateBondsList(monthBonds));
var leftArmBonds = new[]
{
PoseLandmarkType.LeftShoulder,
PoseLandmarkType.LeftElbow,
PoseLandmarkType.LeftWrist,
PoseLandmarkType.LeftPinky,
PoseLandmarkType.LeftIndex,
PoseLandmarkType.LeftWrist,
PoseLandmarkType.LeftThumb
};
_bonds.AddRange(GenerateBondsList(leftArmBonds));
var rightArmBonds = new[]
{
PoseLandmarkType.RightShoulder,
PoseLandmarkType.RightElbow,
PoseLandmarkType.RightWrist,
PoseLandmarkType.RightPinky,
PoseLandmarkType.RightIndex,
PoseLandmarkType.RightWrist,
PoseLandmarkType.RightThumb
};
_bonds.AddRange(GenerateBondsList(rightArmBonds));
var leftLegBonds = new[]
{
PoseLandmarkType.LeftShoulder,
PoseLandmarkType.LeftHip,
PoseLandmarkType.LeftKnee,
PoseLandmarkType.LeftAnkle,
PoseLandmarkType.LeftHeel,
PoseLandmarkType.LeftFootIndex,
PoseLandmarkType.LeftAnkle
};
_bonds.AddRange(GenerateBondsList(leftLegBonds));
var rightLegBonds = new[]
{
PoseLandmarkType.RightShoulder,
PoseLandmarkType.RightHip,
PoseLandmarkType.RightKnee,
PoseLandmarkType.RightAnkle,
PoseLandmarkType.RightHeel,
PoseLandmarkType.RightFootIndex,
PoseLandmarkType.RightAnkle
};
_bonds.AddRange(GenerateBondsList(rightLegBonds));
// 最后手动添加身体上的两条横线
_bonds.Add(new Bond(
_nodes[PoseLandmarkType.LeftShoulder],
_nodes[PoseLandmarkType.RightShoulder],
Scale));
_bonds.Add(new Bond(
_nodes[PoseLandmarkType.LeftHip],
_nodes[PoseLandmarkType.RightHip],
Scale));
}
/// <summary>
/// 创建棍子列表
/// </summary>
/// <param name="nodes">需要连接起来的关键点 需要按顺序设置</param>
/// <returns></returns>
private List<Bond> GenerateBondsList(int[] nodes)
{
var bonds = new List<Bond>();
for (var i = 0; i < nodes.Length - 1; i++)
{
bonds.Add(new Bond(
_nodes[nodes[i]],
_nodes[nodes[i + 1]],
Scale));
}
return bonds;
}
}
}

View File

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

View File

@ -0,0 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6275755417433151442
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a2b060336532a01bfb4593b385955175, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1107 &-4834836044711832442
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates: []
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 0}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BoneAnimator
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -4834836044711832442}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 1
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7406b3b3cd1a7812ca7823cf800c679b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,38 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Models;
using UnityEngine;
public class CubeBehaviour : MonoBehaviour
{
public Vector3 rotateAmount = new Vector3(0, 1, 0);
private readonly UdpListener _listener = new UdpListener();
// Start is called before the first frame update
private void Start()
{
_listener.AddHandler(LogLandmarks);
_listener.Connect(5000);
}
// Update is called once per frame
private void Update()
{
transform.Rotate(rotateAmount);
}
private void OnDisable()
{
_listener.DisConnect();
}
private static void LogLandmarks(List<PoseLandmark> landmarks)
{
foreach (var landmark in landmarks)
{
Debug.Log(landmark.ToString());
}
}
}

8
Assets/Materials.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c2963c03969c7f6d480483b45e36590b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PlaneMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0.29922488, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6083fe04391087ca294999838984a59c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

48
Assets/Models/Bond.cs Normal file
View File

@ -0,0 +1,48 @@
using UnityEngine;
using Utils;
namespace Models
{
/// <summary>
/// 捕捉点之间的连接线
/// </summary>
public class Bond
{
protected readonly GameObject Start;
protected readonly GameObject End;
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)
{
Start = start;
End = end;
_bond = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
_bond.transform.localScale = new Vector3(scale/2, scale/2, scale/2);
//这里可以设置材质,具体自己设置
_bond.GetComponent<Renderer>().material.color = Color.cyan;
}
public void UpdateBond()
{
var startPos = Start.transform.position;
var endPos = End.transform.position;
var rightPosition = (startPos + endPos) / 2;
var rightRotation = endPos - startPos;
var halfLength = Vector3.Distance(startPos, endPos) / 2;
var thickness = 0.1f;//线的粗细
//创建圆柱体
//bond.gameObject.transform.parent = transform;
_bond.transform.position = rightPosition;
_bond.transform.rotation = Quaternion.FromToRotation(Vector3.up, rightRotation);
_bond.transform.localScale = new Vector3(thickness, halfLength, thickness);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 94a8f8c83e58421d9447173d38482d74
timeCreated: 1677230676

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace Models
{
@ -39,6 +40,8 @@ public class PoseLandmark
/// </summary>
public float Z { get; }
public Vector3 Position => new Vector3(-X, -Y, -0.2f * Z);
/// <summary>
/// 该坐标点估计的可见性
/// [0,1]
@ -47,9 +50,9 @@ public class PoseLandmark
public long TimeStamp { get; }
public PoseLandmark(PoseLandmarkType type, float x, float y, float z, float visibility, long timeStamp)
public PoseLandmark(int type, float x, float y, float z, float visibility, long timeStamp)
{
Type = type;
Type = new PoseLandmarkType(type);
X = x;
Y = y;
Z = z;
@ -66,7 +69,7 @@ public byte[] ToByteArray()
{
var result = new byte[PacketLength];
BitConverter.GetBytes((int)Type).CopyTo(result, 0);
BitConverter.GetBytes(Type.Value).CopyTo(result, 0);
BitConverter.GetBytes(X).CopyTo(result, 4);
BitConverter.GetBytes(Y).CopyTo(result, 8);
BitConverter.GetBytes(Z).CopyTo(result, 12);
@ -84,7 +87,7 @@ public byte[] ToByteArray()
public static PoseLandmark ValueOf(byte[] bytes)
{
var result = new PoseLandmark(
(PoseLandmarkType)BitConverter.ToInt32(bytes, 0),
BitConverter.ToInt32(bytes, 0),
BitConverter.ToSingle(bytes, 4),
BitConverter.ToSingle(bytes, 8),
BitConverter.ToSingle(bytes, 12),
@ -106,7 +109,7 @@ public static List<PoseLandmark> ArrayOf(byte[] bytes)
for (var i = 0; i < bytes.Length; i = i + PacketLength)
{
var landmark = new PoseLandmark((PoseLandmarkType)BitConverter.ToInt32(bytes, i),
var landmark = new PoseLandmark(BitConverter.ToInt32(bytes, i),
BitConverter.ToSingle(bytes, i + 4),
BitConverter.ToSingle(bytes, i + 8),
BitConverter.ToSingle(bytes, i + 12),
@ -127,7 +130,7 @@ public override bool Equals(object obj)
}
else
{
return Type == landmark.Type
return Type.Value == landmark.Type.Value
&& Math.Abs(X - landmark.X) < Tolerance
&& Math.Abs(Y - landmark.Y) < Tolerance
&& Math.Abs(Z - landmark.Z) < Tolerance

View File

@ -1,40 +1,70 @@
using System;
namespace Models
{
//名字
public enum PoseLandmarkType
public readonly struct PoseLandmarkType
{
Nose,
LeftEyeInner,
LeftEye,
LeftEyeOuter,
RightEyeInner,
RightEye,
RightEyeOuter,
LeftEar,
RightEar,
MouthLeft,
MouthRight,
LeftShoulder,
RightShoulder,
LeftElbow,
RightElbow,
LeftWrist,
RightWrist,
LeftPinky,
RightPinky,
LeftIndex,
RightIndex,
LeftThumb,
RightThumb,
LeftHip,
RightHip,
LeftKnee,
RightKnee,
LeftAnkle,
RightAnkle,
LeftHeel,
RightHeel,
LeftFootIndex,
RightFootIndex
public const int Nose = 0;
public const int LeftEyeInner = 1;
public const int LeftEye = 2;
public const int LeftEyeOuter = 3;
public const int RightEyeInner = 4;
public const int RightEye = 5;
public const int RightEyeOuter = 6;
public const int LeftEar = 7;
public const int RightEar = 8;
public const int MouthLeft = 9;
public const int MouthRight = 10;
public const int LeftShoulder = 11;
public const int RightShoulder = 12;
public const int LeftElbow = 13;
public const int RightElbow = 14;
public const int LeftWrist = 15;
public const int RightWrist = 16;
public const int LeftPinky = 17;
public const int RightPinky = 18;
public const int LeftIndex = 19;
public const int RightIndex = 20;
public const int LeftThumb = 21;
public const int RightThumb = 22;
public const int LeftHip = 23;
public const int RightHip = 24;
public const int LeftKnee = 25;
public const int RightKnee = 26;
public const int LeftAnkle = 27;
public const int RightAnkle = 28;
public const int LeftHeel = 29;
public const int RightHeel = 30;
public const int LeftFootIndex = 31;
public const int RightFootIndex = 32;
public const int MaxValue = 33;
public int Value { get; }
public PoseLandmarkType(int value)
{
if (value >= MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(value));
}
Value = value;
}
public override bool Equals(object obj)
{
return Value.Equals(obj);
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
public override string ToString()
{
return Value.ToString();
}
}
}

View File

@ -0,0 +1,120 @@
using System.Collections.Generic;
using UnityEngine;
using Utils;
namespace Models
{
/// <summary>
/// 捕捉骨骼的动作转换
/// </summary>
public struct PoseTransform
{
/// <summary>
/// MediaPipe中动捕节点标识
/// </summary>
public readonly PoseLandmarkType MediaPipeName;
/// <summary>
/// Unity中绑定骨骼名称
/// </summary>
public readonly HumanBodyBones UnityName;
/// <summary>
/// 取平均的长度
/// </summary>
public static int AverageLength = 3;
/// <summary>
/// 取平均之后的结果
/// </summary>
public Vector3 ResultPosition => _transformHandler.GetResultPosition();
/// <summary>
/// 节点的父节点列表
/// </summary>
public readonly List<PoseLandmarkType> Parent;
private readonly IPoseTransformHandler _transformHandler;
public PoseTransform(
int type,
IPoseTransformHandler handler
)
{
MediaPipeName = new PoseLandmarkType(type);
UnityName = GetRelatedBone(MediaPipeName);
Parent = new List<PoseLandmarkType>();
_transformHandler = handler;
}
public static void UpdatePosition(ref PoseTransform pose, PoseLandmark landmark)
{
pose._transformHandler.ReceivePoseLandmark(landmark);
}
public static Vector3 operator +(PoseTransform a) => a.ResultPosition;
public static Vector3 operator -(PoseTransform a) => -a.ResultPosition;
public static Vector3 operator +(PoseTransform a, PoseTransform b) =>
a.ResultPosition + b.ResultPosition;
public static Vector3 operator -(PoseTransform a, PoseTransform b) =>
a.ResultPosition - b.ResultPosition;
public static Vector3 operator *(PoseTransform a, int b) =>
a.ResultPosition * b;
public static Vector3 operator *(int a, PoseTransform b) =>
a * b.ResultPosition;
public static Vector3 operator /(PoseTransform a, int b) =>
a.ResultPosition / b;
/// <summary>
/// 获得同相关捕捉点关联的骨骼
/// </summary>
/// <param name="type">捕捉点的种类</param>
/// <returns>关联骨骼的种类</returns>
private static HumanBodyBones GetRelatedBone(PoseLandmarkType type)
{
switch (type.Value)
{
case PoseLandmarkType.LeftHip:
return HumanBodyBones.LeftUpperLeg;
case PoseLandmarkType.RightHip:
return HumanBodyBones.RightUpperLeg;
case PoseLandmarkType.LeftShoulder:
return HumanBodyBones.LeftUpperArm;
case PoseLandmarkType.RightShoulder:
return HumanBodyBones.RightUpperArm;
case PoseLandmarkType.Nose:
return HumanBodyBones.Head;
case PoseLandmarkType.LeftElbow:
return HumanBodyBones.LeftLowerArm;
case PoseLandmarkType.RightElbow:
return HumanBodyBones.RightLowerArm;
case PoseLandmarkType.LeftWrist:
return HumanBodyBones.LeftHand;
case PoseLandmarkType.RightWrist:
return HumanBodyBones.RightHand;
case PoseLandmarkType.LeftKnee:
return HumanBodyBones.LeftLowerLeg;
case PoseLandmarkType.RightKnee:
return HumanBodyBones.RightLowerLeg;
case PoseLandmarkType.LeftAnkle:
return HumanBodyBones.LeftFoot;
case PoseLandmarkType.RightAnkle:
return HumanBodyBones.RightFoot;
case PoseLandmarkType.LeftFootIndex:
return HumanBodyBones.LeftToes;
case PoseLandmarkType.RightFootIndex:
return HumanBodyBones.RightToes;
default:
return HumanBodyBones.LastBone;
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9e38fe43bac14375a4f16690d139411f
timeCreated: 1676859644

View File

@ -0,0 +1,29 @@
using UnityEngine;
namespace Models
{
public struct RotationNode
{
public readonly HumanBodyBones UnityName;
public Quaternion PreviousRotation;
public Quaternion Rotation;
public Quaternion CalculateRotate => PreviousRotation * Quaternion.Inverse(Rotation);
public RotationNode(HumanBodyBones humanBodyBone, Quaternion previousRotation, Quaternion rotation)
{
UnityName = humanBodyBone;
PreviousRotation = previousRotation;
Rotation = rotation;
}
public RotationNode(RotationNode node, PoseLandmark begin, PoseLandmark end)
{
UnityName = node.UnityName;
PreviousRotation = node.Rotation;
var forward = end.Position - begin.Position;
Rotation = Quaternion.LookRotation(forward);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 87e238cb51f34339a39945af13f43248
timeCreated: 1680090845

View File

@ -0,0 +1,35 @@
using UnityEngine;
namespace Models
{
public class VirtualSkeleton : Bond
{
private readonly GameObject _virtualSkeleton;
public VirtualSkeleton(GameObject start,GameObject end,float scale) : base(start,end,scale)
{
_virtualSkeleton = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
_virtualSkeleton.transform.localScale = new Vector3(scale/2, scale/2, scale/2);
_virtualSkeleton.GetComponent<Renderer>().material.color = Color.white;
}
/// <summary>
/// 覆盖基类的更新方法
/// </summary>
public new void UpdateBond()
{
var startPos = Start.transform.position;
var endPos = End.transform.position;
var rightPosition = (startPos + endPos) / 2;
var rightRotation = endPos - startPos;
var lThickness = 0.2f;
_virtualSkeleton.transform.position = rightPosition;
_virtualSkeleton.transform.rotation = Quaternion.FromToRotation(Vector3.up, rightRotation);
_virtualSkeleton.transform.localScale = new Vector3(lThickness, lThickness, lThickness);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5f725336fc6a4481a4c7d74ec0e3b17b
timeCreated: 1677413910

View File

@ -0,0 +1,441 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18029127, g: 0.22572401, b: 0.3069303, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &306285767
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 306285770}
- component: {fileID: 306285769}
- component: {fileID: 306285768}
m_Layer: 0
m_Name: Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &306285768
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 306285767}
m_Enabled: 1
--- !u!20 &306285769
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 306285767}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &306285770
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 306285767}
m_LocalRotation: {x: 0.0016336598, y: 0.99834925, z: 0.037567556, w: -0.043414135}
m_LocalPosition: {x: -1.83, y: 6.98, z: 16.38}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: -4.31, y: 184.98, z: 0}
--- !u!1001 &670355942
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.x
value: -0.93436813
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.y
value: 0.81755877
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.z
value: -0.6021528
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_Name
value: troop
objectReference: {fileID: 0}
- target: {fileID: 5465940246521907071, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5465940246521907071, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.w
value: 0.8707891
objectReference: {fileID: 0}
- target: {fileID: 5465940246521907071, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5465940246521907071, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.y
value: -0.49165684
objectReference: {fileID: 0}
- target: {fileID: 5465940246521907071, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -58.899
objectReference: {fileID: 0}
- target: {fileID: 5866666021909216657, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.x
value: -0.000114262104
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.y
value: 1.8739636
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.z
value: -0.00004636313
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9621656
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.x
value: 0.023309091
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.y
value: -0.26867148
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.z
value: -0.03885668
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 1.374
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -31.263
objectReference: {fileID: 0}
- target: {fileID: 6502182839619065283, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: -5.01
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
--- !u!1 &670355943 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
m_PrefabInstance: {fileID: 670355942}
m_PrefabAsset: {fileID: 0}
--- !u!114 &670355944
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 670355943}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a2b060336532a01bfb4593b385955175, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1059201228
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1059201230}
- component: {fileID: 1059201229}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1059201229
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1059201228}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1059201230
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1059201228}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 7.33, y: 1.28, z: -4.76}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: aa15f758637754fa394d6979dab2c3fa
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,459 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &99618223
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 99618227}
- component: {fileID: 99618226}
- component: {fileID: 99618225}
- component: {fileID: 99618224}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &99618224
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 99618223}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &99618225
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 99618223}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6083fe04391087ca294999838984a59c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &99618226
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 99618223}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &99618227
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 99618223}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &182244630
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 182244631}
- component: {fileID: 182244632}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &182244631
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 182244630}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &182244632
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 182244630}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 574a3724e040787f7afd9341fba89cf2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &443683957
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 443683959}
- component: {fileID: 443683958}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &443683958
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 443683957}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &443683959
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 443683957}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &2045151417
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2045151420}
- component: {fileID: 2045151419}
- component: {fileID: 2045151418}
- component: {fileID: 2045151421}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &2045151418
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2045151417}
m_Enabled: 1
--- !u!20 &2045151419
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2045151417}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &2045151420
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2045151417}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 7}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &2045151421
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2045151417}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9189b565e8ba9bfc3bdaa38149e3e13f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 182244631}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 53edd235eaf7da249a8204f606eb1489
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -123,117 +123,93 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &320693305
GameObject:
--- !u!1001 &404755305
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.x
value: -12.91
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.y
value: -4.98
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -2845779275431937956, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: -464305122009946348, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_LocalPosition.x
value: -4.32
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
propertyPath: m_Name
value: troop
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
--- !u!1 &404755306 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
m_PrefabInstance: {fileID: 404755305}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 320693310}
- component: {fileID: 320693309}
- component: {fileID: 320693308}
- component: {fileID: 320693307}
- component: {fileID: 320693306}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &320693306
--- !u!4 &404755309 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: c5470c9a1aff50643b6a9ff0bab4297d, type: 3}
m_PrefabInstance: {fileID: 404755305}
m_PrefabAsset: {fileID: 0}
--- !u!114 &404755310
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320693305}
m_GameObject: {fileID: 404755306}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 11e8a976fe328b1c3bdf9f44ef9f6fa1, type: 3}
m_Script: {fileID: 11500000, guid: a2b060336532a01bfb4593b385955175, type: 3}
m_Name:
m_EditorClassIdentifier:
rotateAmount: {x: 0, y: 1, z: 0}
--- !u!65 &320693307
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320693305}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &320693308
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320693305}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &320693309
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320693305}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &320693310
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320693305}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.24, y: 1.1, z: -1.8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
@ -326,7 +302,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &963194225
GameObject:
@ -405,14 +381,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.3, y: 1.06, z: -8.26}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 7, z: 15}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &963194229
MonoBehaviour:
m_ObjectHideFlags: 0
@ -420,12 +396,12 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9189b565e8ba9bfc3bdaa38149e3e13f, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 320693310}
target: {fileID: 404755309}
--- !u!1 &1880773849
GameObject:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,23 @@
using Models;
using UnityEngine;
namespace Utils
{
/// <summary>
/// 坐标处理接口
/// </summary>
public interface IPoseTransformHandler
{
/// <summary>
/// 传入新收到的坐标点
/// </summary>
/// <param name="landmark"></param>
public void ReceivePoseLandmark(PoseLandmark landmark);
/// <summary>
/// 获得处理之后的坐标点
/// </summary>
/// <returns></returns>
public Vector3 GetResultPosition();
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 09e98a9502f0470f827a472058068bc4
timeCreated: 1677676325

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 790fe29ab090465183945d02718de6a9
timeCreated: 1677676888

View File

@ -0,0 +1,41 @@
using Models;
using UnityEngine;
using System.Collections.Concurrent;
namespace Utils.PoseTransformHandlers
{
public class AverageHandler : IPoseTransformHandler
{
public static int AverageLength = 3;
// 线程安全的队列集合
// 据文档描述甚至没有使用锁
private readonly ConcurrentQueue<PoseLandmark> _queue = new ConcurrentQueue<PoseLandmark>();
public void ReceivePoseLandmark(PoseLandmark landmark)
{
if (_queue.Count < AverageLength)
{
_queue.Enqueue(landmark);
}
else
{
if (_queue.TryDequeue(out _))
{
_queue.Enqueue(landmark);
}
}
}
public Vector3 GetResultPosition()
{
var sum = new Vector3();
foreach (var item in _queue)
{
sum += new Vector3(item.X, item.Y, item.Z);
}
return sum / AverageLength;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c02b0d03301d408faf81931a69679f5c
timeCreated: 1677676898

View File

@ -0,0 +1,20 @@
using Models;
using UnityEngine;
namespace Utils.PoseTransformHandlers
{
public class NormalHandler : IPoseTransformHandler
{
private Vector3 _result;
public void ReceivePoseLandmark(PoseLandmark landmark)
{
_result = new Vector3(landmark.X, landmark.Y, landmark.Z);
}
public Vector3 GetResultPosition()
{
return _result;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 93a33f47f3654fd3b27dd18db88fcc55
timeCreated: 1677678654

View File

@ -0,0 +1,21 @@
using Models;
using UnityEngine;
namespace Utils.PoseTransformHandlers
{
public class ZAxisHandler : IPoseTransformHandler
{
private Vector3 _result;
public void ReceivePoseLandmark(PoseLandmark landmark)
{
_result = new Vector3(landmark.X, landmark.Y, landmark.Z * 0.2f);
_result = _result * -1;
}
public Vector3 GetResultPosition()
{
return _result;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 12369669a7fc44eaae881f89678649b1
timeCreated: 1678024599

View File

@ -0,0 +1,67 @@
using System;
using UnityEngine;
namespace Utils
{
/// <summary>
/// 旋转工具类
/// </summary>
public static class RotateUtils
{
private static Matrix4x4 _matrix;
/// <summary>
/// 获得绕X轴旋转矩阵
/// </summary>
/// <param name="degree">旋转的角度</param>
/// <returns></returns>
public static Matrix4x4 RotateAxisX(float degree)
{
var sin = MathF.Sin(degree);
var cos = MathF.Cos(degree);
_matrix.SetRow(0 ,new Vector4(1,0,0,0));
_matrix.SetRow(1, new Vector4(0, cos, -sin, 0));
_matrix.SetRow(2, new Vector4(0, sin, cos, 0));
_matrix.SetRow(3, new Vector4(0, 0, 0, 1));
return _matrix;
}
/// <summary>
/// 获得绕Y轴旋转矩阵
/// </summary>
/// <param name="degree">旋转的角度</param>
/// <returns></returns>
public static Matrix4x4 RotateAxisY(float degree)
{
var sin = MathF.Sin(degree);
var cos = MathF.Cos(degree);
_matrix.SetRow(0, new Vector4(cos, 0, sin, 0));
_matrix.SetRow(1, new Vector4(0, 1, 0, 1));
_matrix.SetRow(2, new Vector4(-sin, 0, cos, 0));
_matrix.SetRow(3, new Vector4(0, 0, 0, 1));
return _matrix;
}
/// <summary>
/// 获得绕Z轴旋转矩阵
/// </summary>
/// <param name="degree">旋转的角度</param>
/// <returns></returns>
public static Matrix4x4 RotateAxisZ(float degree)
{
var sin = MathF.Sin(degree);
var cos = MathF.Cos(degree);
_matrix.SetRow(0, new Vector4(cos, -sin, 0, 0));
_matrix.SetRow(1, new Vector4(sin, cos, 0, 0));
_matrix.SetRow(2, new Vector4(0, 0, 1, 0));
_matrix.SetRow(3, new Vector4(0, 0, 0, 1));
return _matrix;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d748c6669d714e65a5ca9164c5798583
timeCreated: 1677319275

View File

@ -1,15 +1,15 @@
{
"dependencies": {
"com.unity.collab-proxy": "1.17.7",
"com.unity.collab-proxy": "2.0.0",
"com.unity.feature.development": "1.0.1",
"com.unity.ide.rider": "3.0.18",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.visualstudio": "2.0.17",
"com.unity.ide.vscode": "1.2.5",
"com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.6.4",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.7.8",
"com.unity.visualscripting": "1.8.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",

View File

@ -1,12 +1,10 @@
{
"dependencies": {
"com.unity.collab-proxy": {
"version": "1.17.7",
"version": "2.0.0",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.services.core": "1.0.1"
},
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.editorcoroutines": {
@ -28,11 +26,11 @@
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.rider": "3.0.16",
"com.unity.ide.visualstudio": "2.0.17",
"com.unity.ide.rider": "3.0.18",
"com.unity.ide.vscode": "1.2.5",
"com.unity.editorcoroutines": "1.0.0",
"com.unity.performance.profile-analyzer": "1.1.1",
"com.unity.performance.profile-analyzer": "1.2.2",
"com.unity.test-framework": "1.1.31",
"com.unity.testtools.codecoverage": "1.2.2"
}
@ -47,7 +45,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.16",
"version": "2.0.17",
"depth": 0,
"source": "registry",
"dependencies": {
@ -62,31 +60,13 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.nuget.newtonsoft-json": {
"version": "3.0.2",
"depth": 2,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.performance.profile-analyzer": {
"version": "1.1.1",
"version": "1.2.2",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.services.core": {
"version": "1.6.0",
"depth": 1,
"source": "registry",
"dependencies": {
"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.com"
},
"com.unity.settings-manager": {
"version": "1.0.3",
"depth": 2,
@ -146,7 +126,7 @@
}
},
"com.unity.visualscripting": {
"version": "1.7.8",
"version": "1.8.0",
"depth": 0,
"source": "registry",
"dependencies": {

View File

@ -25,7 +25,6 @@ MonoBehaviour:
m_Scopes: []
m_IsDefault: 1
m_Capabilities: 7
m_ConfigSource: 0
m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft:

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.16f1
m_EditorVersionWithRevision: 2021.3.16f1 (4016570cf34f)
m_EditorVersion: 2021.3.19f1
m_EditorVersionWithRevision: 2021.3.19f1 (c9714fde33b6)