Class SkinnedModel
Skinned model asset that contains model object made of meshes that can be rendered on the GPU using skeleton bones skinning.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public class SkinnedModel : ModelBase
Constructors
SkinnedModel()
Fields
MaxBones
The maximum allowed amount of skeleton bones to be used with skinned model.
Declaration
public const int MaxBones = 256
Field Value
System.Int32
|
Properties
BlendShapes
Gets the blend shapes names used by the skinned model meshes (from LOD 0 only).
Declaration
[Unmanaged]
public string[] BlendShapes { get; }
Property Value
System.String[]
|
Bones
Gets the skeleton bones hierarchy.
Declaration
[Unmanaged]
public SkeletonBone[] Bones { get; }
Property Value
SkeletonBone[]
|
LODs
Model level of details. The first entry is the highest quality LOD0 followed by more optimized versions.
Declaration
[Unmanaged]
public SkinnedModelLOD[] LODs { get; }
Property Value
SkinnedModelLOD[]
|
Nodes
Gets the skeleton nodes hierarchy.
Declaration
[Unmanaged]
public SkeletonNode[] Nodes { get; }
Property Value
SkeletonNode[]
|
SkeletonRetargets
Gets or sets or sets the skeleton retarget entries (accessed in Editor only).
Declaration
[Unmanaged]
public SkinnedModel.SkeletonRetarget[] SkeletonRetargets { get; set; }
Property Value
SkinnedModel.SkeletonRetarget[]
|
Methods
FindBone(Int32)
Finds the bone that is using a given node index.
Declaration
[Unmanaged]
public int FindBone(int nodeIndex)
Parameters
System.Int32
nodeIndex
The index of the node. |
Returns
System.Int32
The index of the bone or -1 if not found. |
FindBone(String)
Finds the bone with the given name.
Declaration
[Unmanaged]
public int FindBone(string name)
Parameters
System.String
name
The name of the node used by the bone. |
Returns
System.Int32
The index of the bone or -1 if not found. |
FindNode(String)
Finds the node with the given name.
Declaration
[Unmanaged]
public int FindNode(string name)
Parameters
System.String
name
The name of the node. |
Returns
System.Int32
The index of the node or -1 if not found. |
GetBox(Matrix, Int32)
Gets the model bounding box in custom matrix world space (rig pose transformed by matrix, not animated).
Declaration
[Unmanaged]
public BoundingBox GetBox(Matrix world, int lodIndex = 0)
Parameters
Matrix
world
The transformation matrix. |
System.Int32
lodIndex
The Level Of Detail index. |
Returns
BoundingBox
The bounding box. |
GetBox(Int32)
Gets the model bounding box in local space (rig pose, not animated).
Declaration
[Unmanaged]
public BoundingBox GetBox(int lodIndex = 0)
Parameters
System.Int32
lodIndex
The Level Of Detail index. |
Returns
BoundingBox
The bounding box. |
SetupLODs(Int32[])
Setups the model LODs collection including meshes creation.
Declaration
[Unmanaged]
public bool SetupLODs(int[] meshesCountPerLod)
Parameters
System.Int32[]
meshesCountPerLod
The meshes count per lod array (amount of meshes per LOD). |
Returns
System.Boolean
True if failed, otherwise false. |
SetupSkeleton(SkeletonNode[])
Setups the skinned model skeleton. Uses the same nodes layout for skeleton bones and calculates the offset matrix by auto.
Declaration
[Unmanaged]
public bool SetupSkeleton(SkeletonNode[] nodes)
Parameters
SkeletonNode[]
nodes
The nodes hierarchy. The first node must be a root one (with parent index equal -1). |
Returns
System.Boolean
True if failed, otherwise false. |
SetupSkeleton(SkeletonNode[], SkeletonBone[], Boolean)
Setups the skinned model skeleton.
Declaration
[Unmanaged]
public bool SetupSkeleton(SkeletonNode[] nodes, SkeletonBone[] bones, bool autoCalculateOffsetMatrix)
Parameters
SkeletonNode[]
nodes
The nodes hierarchy. The first node must be a root one (with parent index equal -1). |
SkeletonBone[]
bones
The bones hierarchy. |
System.Boolean
autoCalculateOffsetMatrix
If true then the OffsetMatrix for each bone will be auto-calculated by the engine, otherwise the provided values will be used. |
Returns
System.Boolean
True if failed, otherwise false. |