Class HumanoidAvatarMapper
Provides functionality to convert a loaded model’s bones into a Unity humanoid avatar hierarchy. This class enforces humanoid-like orientations (e.g., T-pose) and aligns bone transforms to standardized directional vectors. Subclasses can extend this mapper to refine or modify default humanoid bone mapping processes.
Namespace: TriLibCore.Mappers
Assembly: TriLibCore.dll
Syntax
public class HumanoidAvatarMapper : ScriptableObject
Constructors
HumanoidAvatarMapper()
Declaration
public HumanoidAvatarMapper()
Methods
Map(AssetLoaderContext)
Attempts to map the loaded model bones into a humanoid rig, returning a Dictionary<TKey, TValue> for further processing. This method can be overridden to implement custom bone search or heuristics.
Declaration
public virtual Dictionary<BoneMapping, Transform> Map(AssetLoaderContext assetLoaderContext)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext containing references to the loaded GameObject hierarchy and relevant import options. |
Returns
Type | Description |
---|---|
Dictionary<BoneMapping, Transform> | A dictionary mapping each humanoid BoneMapping entry to the
corresponding UnityEngine.Transform in the scene. By default, returns |
PostSetup(AssetLoaderContext, Dictionary<BoneMapping, Transform>)
Called once the basic bone mapping is established. If SampleBindPose is enabled, the model is sampled at bind pose. If EnforceTPose is enabled, the mapped bones are rotated to align the character in a T-pose configuration (spine/arms/legs arranged horizontally).
Declaration
public void PostSetup(AssetLoaderContext assetLoaderContext, Dictionary<BoneMapping, Transform> mapping)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext referencing user-defined options and loaded GameObjects. |
Dictionary<BoneMapping, Transform> | mapping | The finalized dictionary mapping TriLib BoneMapping entries to actual UnityEngine.Transform references. |