1using System.Collections.Generic;
10 [CreateAssetMenu(menuName =
"TriLib/Mappers/Humanoid/By Name Humanoid Avatar Mapper", fileName =
"ByNameHumanoidAvatarMapper")]
16 [Header(
"Left = Loaded GameObjects Names, Right = Names in BonesMapping.BoneNames")]
30 public override Dictionary<BoneMapping, Transform>
Map(AssetLoaderContext assetLoaderContext)
32 var mapping =
new Dictionary<BoneMapping, Transform>();
36 if (boneMapping.BoneNames !=
null)
39 for (var j = 0; j < boneMapping.BoneNames.Length; j++)
41 var boneName = boneMapping.BoneNames[j];
43 if (transform ==
null)
48 var model = assetLoaderContext.Models[transform.gameObject];
54 mapping.Add(boneMapping, transform);
59 if (!found && !IsBoneOptional(boneMapping.HumanBone))
61 if (assetLoaderContext.Options.ShowLoadingWarnings)
63 Debug.LogWarning($
"Could not find bone '{boneMapping.HumanBone}'");
75 private static bool IsBoneOptional(HumanBodyBones humanBodyBones)
77 return !HumanTrait.RequiredBone((
int)humanBodyBones);
90 BonesMapping.Add(
new BoneMapping(humanBodyBones, humanLimit, boneNames));
TriLibCore.General.HumanLimit HumanLimit
Represents a Mapper that finds humanoid Avatar bones by name-matching.
bool CaseInsensitive
Is the string comparison case insensitive?
List< BoneMapping > BonesMapping
The human bone to Unity bone relationship list.
StringComparisonMode stringComparisonMode
String comparison mode to use on the mapping.
override Dictionary< BoneMapping, Transform > Map(AssetLoaderContext assetLoaderContext)
void AddMapping(HumanBodyBones humanBodyBones, HumanLimit humanLimit, params string[] boneNames)
Adds a new mapping item, containing the humanoid bone type, the limits, and the list of names to look...