From f049177e20a276049c61edbad631c1b2bbdd5706 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Oct 2020 19:05:22 +0800 Subject: -advanced inspector +odin --- Assets/MeshUtility/Runtime/HumanoidLoader.cs | 60 ---------------------------- 1 file changed, 60 deletions(-) delete mode 100644 Assets/MeshUtility/Runtime/HumanoidLoader.cs (limited to 'Assets/MeshUtility/Runtime/HumanoidLoader.cs') diff --git a/Assets/MeshUtility/Runtime/HumanoidLoader.cs b/Assets/MeshUtility/Runtime/HumanoidLoader.cs deleted file mode 100644 index 2a5d5252..00000000 --- a/Assets/MeshUtility/Runtime/HumanoidLoader.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace MeshUtility -{ - public static class HumanoidLoader - { - public static Avatar LoadHumanoidAvatar(Transform root, IEnumerable<(Transform, HumanBodyBones)> boneMap) - { - var description = new HumanDescription - { - skeleton = root.GetComponentsInChildren() - .Select(x => x.ToSkeletonBone()).ToArray(), - human = boneMap - .Select(x => new HumanBone - { - boneName = x.Item1.name, - humanName = s_humanTranitBoneNameMap[x.Item2], - limit = new HumanLimit - { - useDefaultValues = true, - } - }).ToArray(), - - armStretch = 0.05f, - legStretch = 0.05f, - upperArmTwist = 0.5f, - lowerArmTwist = 0.5f, - upperLegTwist = 0.5f, - lowerLegTwist = 0.5f, - feetSpacing = 0, - hasTranslationDoF = false, - }; - - return AvatarBuilder.BuildHumanAvatar(root.gameObject, description); - } - - static SkeletonBone ToSkeletonBone(this Transform t) - { - var sb = new SkeletonBone(); - sb.name = t.name; - sb.position = t.localPosition; - sb.rotation = t.localRotation; - sb.scale = t.localScale; - return sb; - } - - static HumanBodyBones TraitToHumanBone(string x) - { - return (HumanBodyBones)Enum.Parse(typeof(HumanBodyBones), x.Replace(" ", ""), true); - } - - static readonly Dictionary s_humanTranitBoneNameMap = - HumanTrait.BoneName.ToDictionary( - x => TraitToHumanBone(x), - x => x); - } -} -- cgit v1.1-26-g67d0