Class RootBoneMapper
Provides functionality to locate a “root bone” for rigging or animation setup within the loaded model hierarchy. This can be essential when binding skin meshes or humanoid rigs, as well as customizing bone references in scripts.
Inheritance
Namespace: TriLibCore.Mappers
Assembly: TriLibCore.Source.dll
Syntax
public class RootBoneMapper : ScriptableObject
Methods
Map(AssetLoaderContext)
Attempts to find a root bone in the loaded model hierarchy, returning the
Transform to be used as the topmost bone for binding or rigging.
This method is now marked as Obsolete; use Map(AssetLoaderContext, IList<Transform>) instead.
Declaration
[Obsolete("Please use the override that accepts a list of bones instead.")]
public virtual Transform Map(AssetLoaderContext assetLoaderContext)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The AssetLoaderContext referencing loaded GameObject data, user options, and other contextual information. |
Returns
| Type | Description |
|---|---|
| Transform | The root bone Transform if one is found or chosen;
by default, the method returns |
Map(AssetLoaderContext, IList<Transform>)
Finds a suitable root bone from a provided list of potential bone transforms. This is the highest-level bone in the hierarchy that others descend from. Subclasses should override this method to implement more advanced selection logic (e.g., checking naming patterns, evaluating bone connections, etc.).
Declaration
public virtual Transform Map(AssetLoaderContext assetLoaderContext, IList<Transform> bones)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The AssetLoaderContext referencing the loaded model’s GameObjects, user-defined import options, and callbacks. |
| IList<Transform> | bones | An ordered or unordered list of transforms that may qualify as bones in the skeleton hierarchy. Subclasses can evaluate these to decide which one is truly at the top of the chain. |
Returns
| Type | Description |
|---|---|
| Transform | The Transform chosen to serve as the root bone. By default,
this method returns |