Skeleton3D
A bone hierarchy with reference transforms and current 3D poses.
Skeleton3D is an Entity for skeletal animation. Bones are stored inside it, rather than as separate child Entities. Rest defines a reference local transform; Pose is the current local transform. Root-bone local space is skeleton space; child-bone local space is its parent-bone space.
GetBoneGlobalPose composes ancestor poses but remains in skeleton space. This example computes the world transform of an existing bone on a skeleton in the tree. It reads current state; for a particular modifier result, coordinate the call with that modifier update phase.
using Reckfell;
public static class BoneWorldExample
{
public static bool TryGetWorldTransform(Skeleton3D skeleton, string boneName,
out Transform3D worldTransform)
{
worldTransform = Transform3D.Identity;
if (!skeleton.IsInsideTree())
return false;
int index = skeleton.FindBone(boneName);
if (index < 0)
return false;
worldTransform = skeleton.GlobalTransform * skeleton.GetBoneGlobalPose(index);
return true;
}
}See retargeting for names and poses when transferring animation.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
Skeleton3DConstructor
public Skeleton3D();Properties4
AnimatePhysicalBonesProperty · Deprecated
public bool AnimatePhysicalBones { get; set; }If you follow the recommended workflow and explicitly have PhysicalBoneSimulator3D as a child of Skeleton3D, you can control whether it is affected by raycasting without running Skeleton3D.PhysicalBonesStartSimulation, by its SkeletonModifier3D.Active.
However, for old (deprecated) configurations, Skeleton3D has an internal virtual PhysicalBoneSimulator3D for compatibility. This property controls the internal virtual PhysicalBoneSimulator3D's SkeletonModifier3D.Active.
ModifierCallbackModeProcessProperty
public Skeleton3D.ModifierCallbackModeProcessEnum ModifierCallbackModeProcess { get; set; }Sets the processing timing for the Modifier.
MotionScaleProperty
public float MotionScale { get; set; }Positive multiplier for bone position animation tracks in AnimationMixer. Does not change the Entity transform or directly assigned SetBonePosePosition values. The native setter rejects values <= 0 and restores 1; do not use 0 to stop animation.
ShowRestOnlyProperty
public bool ShowRestOnly { get; set; }If true, forces the bones in their default rest pose, regardless of their values. In the editor, this also prevents the bones from being edited.
Methods60
AddBoneint
public int AddBone(string name);Adds a new bone with the given name. Returns the new bone's index, or -1 if this method fails.
Note: Bone names should be unique, non empty, and cannot include the : and / characters.
| Name | Type | Default |
|---|---|---|
name | string | — |
intAdvancevoid
public void Advance(double delta);Manually advance the child SkeletonModifier3Ds by the specified time (in seconds).
Note: The delta is temporarily accumulated in the Skeleton3D, and the deferred process uses the accumulated value to process the modification.
| Name | Type | Default |
|---|---|---|
delta | double | — |
ClearBonesvoid
public void ClearBones();Clear all the bones in this skeleton.
ClearBonesGlobalPoseOverridevoid · Deprecated
public void ClearBonesGlobalPoseOverride();Removes the global pose override on all bones in the skeleton.
CreateSkinFromRestTransformsSkin
public Skin CreateSkinFromRestTransforms();SkinFindBoneint
public int FindBone(string name);Returns the bone index that matches name as its name. Returns -1 if no bone with this name exists.
| Name | Type | Default |
|---|---|---|
name | string | — |
intForceUpdateAllBoneTransformsvoid · Deprecated
public void ForceUpdateAllBoneTransforms();Force updates the bone transforms/poses for all bones in the skeleton.
ForceUpdateBoneChildTransformvoid
public void ForceUpdateBoneChildTransform(int boneIdx);Force updates the bone transform for the bone at bone_idx and all of its children.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
GetAnimatePhysicalBonesbool
public bool GetAnimatePhysicalBones();boolGetBoneChildrenint[]
public int[] GetBoneChildren(int boneIdx);Returns an array containing the bone indexes of all the child node of the passed in bone, bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
int[]GetBoneCountint
public int GetBoneCount();Returns the number of bones in the skeleton.
intGetBoneGlobalPoseTransform3D
public Transform3D GetBoneGlobalPose(int boneIdx);Computes the current bone pose including its parents, in Skeleton3D coordinates. Global here does not mean world transform. For world space, multiply Skeleton3D.GlobalTransform by the result. The value depends on the current animation/modifier update phase.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
Transform3DTransform in Skeleton3D coordinates, without the Entity world transform.
GetBoneGlobalPoseNoOverrideTransform3D · Deprecated
public Transform3D GetBoneGlobalPoseNoOverride(int boneIdx);Returns the overall transform of the specified bone, with respect to the skeleton, but without any global pose overrides. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
Transform3DGetBoneGlobalPoseOverrideTransform3D · Deprecated
public Transform3D GetBoneGlobalPoseOverride(int boneIdx);Returns the global pose override transform for bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
Transform3DGetBoneGlobalRestTransform3D
public Transform3D GetBoneGlobalRest(int boneIdx);Reads the composition of the bone Rest and its ancestors in Skeleton3D coordinates. Does not use current animated poses or include the skeleton world transform.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
Transform3DTransform in Skeleton3D coordinates, without the Entity world transform.
GetBoneMetaVariant
public Variant GetBoneMeta(int boneIdx, StringName key);Returns the metadata with the given key for the bone at index bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
key | StringName | — |
VariantGetBoneMetaListReckfell.Collections.Array<StringName>
public Reckfell.Collections.Array<StringName> GetBoneMetaList(int boneIdx);Returns the list of all metadata keys for the bone at index bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
Reckfell.Collections.Array<StringName>GetBoneNamestring
public string GetBoneName(int boneIdx);Returns the name of the bone at index bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
stringGetBoneParentint
public int GetBoneParent(int boneIdx);Returns the bone index which is the parent of the bone at bone_idx. If -1, then bone has no parent.
Note: The parent bone returned will always be less than bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
intGetBonePoseTransform3D
public Transform3D GetBonePose(int boneIdx);Reads the current local bone transform relative to its parent bone, or the skeleton for a root. Not an additional transform automatically multiplied by Rest. Animation and modifiers can change the pose during their update phase.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
Transform3DLocal transform relative to the parent bone, or skeleton for a root.
GetBonePosePositionVector3
public Vector3 GetBonePosePosition(int boneIdx);Reads the position component of local Bone Pose relative to the parent bone; for a root bone, relative to the skeleton. Not a world position or a child bone accumulated position in the skeleton.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
Vector3Local position in parent-bone coordinates, or skeleton coordinates for a root.
GetBonePoseRotationQuaternion
public Quaternion GetBonePoseRotation(int boneIdx);Returns the pose rotation of the bone at bone_idx. The returned Quaternion is local to the bone with respect to the rotation of any parent bones.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
QuaternionGetBonePoseScaleVector3
public Vector3 GetBonePoseScale(int boneIdx);Returns the pose scale of the bone at bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
Vector3GetBoneRestTransform3D
public Transform3D GetBoneRest(int boneIdx);Reads the reference transform relative to the parent bone, or skeleton for a root. Separate data from the mutable current pose.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
Transform3DLocal transform relative to the parent bone, or skeleton for a root.
GetBoneSkinScaleVector3
public Vector3 GetBoneSkinScale(int boneIdx);Returns the skin scale of the bone at bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
Vector3GetConcatenatedBoneNamesStringName
public StringName GetConcatenatedBoneNames();Returns all bone names concatenated with commas (,) as a single StringName.
It is useful to set it as a hint for the enum property.
StringNameGetModifierCallbackModeProcessSkeleton3D.ModifierCallbackModeProcessEnum
public Skeleton3D.ModifierCallbackModeProcessEnum GetModifierCallbackModeProcess();Skeleton3D.ModifierCallbackModeProcessEnumGetMotionScalefloat
public float GetMotionScale();floatGetParentlessBonesint[]
public int[] GetParentlessBones();Returns an array with all of the bones that are parentless. Another way to look at this is that it returns the indexes of all the bones that are not dependent or modified by other bones in the Skeleton.
int[]GetVersionulong
public ulong GetVersion();Returns the number of times the bone hierarchy has changed within this skeleton, including renames. The Skeleton version is not serialized: only use within a single instance of Skeleton3D. Use for invalidating caches in IK solvers and other nodes which process bones.
ulongHasBoneMetabool
public bool HasBoneMeta(int boneIdx, StringName key);Returns true if the bone at index bone_idx has metadata with the given key.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
key | StringName | — |
boolIsBoneEnabledbool
public bool IsBoneEnabled(int boneIdx);Returns whether the bone pose for the bone at bone_idx is enabled.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boolIsShowRestOnlybool
public bool IsShowRestOnly();boolLocalizeRestsvoid
public void LocalizeRests();Returns all bones in the skeleton to their rest poses.
PhysicalBonesAddCollisionExceptionvoid · Deprecated
public void PhysicalBonesAddCollisionException(Rid exception);Adds a collision exception to the physical bone.
Works just like the RigidBody3D node.
| Name | Type | Default |
|---|---|---|
exception | Rid | — |
PhysicalBonesRemoveCollisionExceptionvoid · Deprecated
public void PhysicalBonesRemoveCollisionException(Rid exception);Removes a collision exception to the physical bone.
Works just like the RigidBody3D node.
| Name | Type | Default |
|---|---|---|
exception | Rid | — |
PhysicalBonesStartSimulationvoid · Deprecated
public void PhysicalBonesStartSimulation(Reckfell.Collections.Array<StringName> bones = null);Tells the PhysicalBone3D nodes in the Skeleton to start simulating and reacting to the physics world.
Optionally, a list of bone names can be passed-in, allowing only the passed-in bones to be simulated.
| Name | Type | Default |
|---|---|---|
bones | Reckfell.Collections.Array<StringName> | null |
PhysicalBonesStopSimulationvoid · Deprecated
public void PhysicalBonesStopSimulation();Tells the PhysicalBone3D nodes in the Skeleton to stop simulating.
RegisterSkinSkinReference
public SkinReference RegisterSkin(Skin skin);Binds the given Skin to the Skeleton.
| Name | Type | Default |
|---|---|---|
skin | Skin | — |
SkinReferenceResetBonePose2 overloads
public void ResetBonePose(int boneIdx);Copies Rest position, rotation and scale into one bone current local pose. Does not reset the animation player; later animation or modifiers can change the pose again. The overload without bool retains the separate Bone Skin Scale.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
public void ResetBonePose(int boneIdx, bool resetBoneSkinScale = false);Copies Rest position, rotation and scale into one bone current local pose. Does not reset the animation player; later animation or modifiers can change the pose again. The overload without bool retains the separate Bone Skin Scale.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
resetBoneSkinScale | bool | false |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
resetBoneSkinScaleWhen true, also reset separate Bone Skin Scale to (1, 1, 1); false retains it. Not a flag controlling ordinary Pose scale, which is copied from Rest in both cases.
ResetBonePoses2 overloads
public void ResetBonePoses();Resets every bone pose from its Rest. Does not change Rest data or stop animation. The overload without bool retains separate Bone Skin Scale values.
public void ResetBonePoses(bool resetBoneSkinScale = false);Resets every bone pose from its Rest. Does not change Rest data or stop animation. The overload without bool retains separate Bone Skin Scale values.
| Name | Type | Default |
|---|---|---|
resetBoneSkinScale | bool | false |
resetBoneSkinScaleWhen true, also reset separate Bone Skin Scale to (1, 1, 1); false retains it. Not a flag controlling ordinary Pose scale, which is copied from Rest in both cases.
SetAnimatePhysicalBonesvoid
public void SetAnimatePhysicalBones(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetBoneEnabledvoid
public void SetBoneEnabled(int boneIdx, bool enabled = true);Disables the pose for the bone at bone_idx if false, enables the bone pose if true.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
enabled | bool | true |
SetBoneGlobalPosevoid
public void SetBoneGlobalPose(int boneIdx, Transform3D pose);Sets the global pose transform, pose, for the bone at bone_idx.
Note: If other bone poses have been changed, this method executes a dirty poses recalculation and will cause performance to deteriorate. If you know that multiple global poses will be applied, consider using Skeleton3D.SetBonePose with precalculation.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
pose | Transform3D | — |
SetBoneGlobalPoseOverridevoid · Deprecated
public void SetBoneGlobalPoseOverride(int boneIdx, Transform3D pose, float amount, bool persistent = false);Sets the global pose transform, pose, for the bone at bone_idx.
amount is the interpolation strength that will be used when applying the pose, and persistent determines if the applied pose will remain.
Note: The pose transform needs to be a global pose! To convert a world transform from a Entity3D to a global bone pose, multiply the Transform3D.AffineInverse of the node's Entity3D.GlobalTransform by the desired world transform.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
pose | Transform3D | — |
amount | float | — |
persistent | bool | false |
SetBoneMetavoid
public void SetBoneMeta(int boneIdx, StringName key, Variant value);Sets the metadata with the given key to value for the bone at index bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
key | StringName | — |
value | Variant | — |
SetBoneNamevoid
public void SetBoneName(int boneIdx, string name);Sets the bone name, name, for the bone at bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
name | string | — |
SetBoneParentvoid
public void SetBoneParent(int boneIdx, int parentIdx);Sets the bone index parent_idx as the parent of the bone at bone_idx. If -1, then bone has no parent.
Note: parent_idx must be less than bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
parentIdx | int | — |
SetBonePosevoid
public void SetBonePose(int boneIdx, Transform3D pose);Sets the pose transform, pose, for the bone at bone_idx.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
pose | Transform3D | — |
SetBonePosePositionvoid
public void SetBonePosePosition(int boneIdx, Vector3 position);Replaces the local pose position relative to the parent bone, or skeleton for a root. Does not add position to Rest. Does not change Rest, rotation or scale; subsequent animation/modifier updates can overwrite the pose.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
position | Vector3 | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
positionNew position relative to the parent bone; relative to Skeleton3D for a root. Not a world position or an offset added to Rest.
SetBonePoseRotationvoid
public void SetBonePoseRotation(int boneIdx, Quaternion rotation);Sets the pose rotation of the bone at bone_idx to rotation. rotation is a Quaternion describing a rotation in the bone's local coordinate space with respect to the rotation of any parent bones.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
rotation | Quaternion | — |
SetBonePoseScalevoid
public void SetBonePoseScale(int boneIdx, Vector3 scale);Sets the pose scale of the bone at bone_idx to scale.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
scale | Vector3 | — |
SetBoneRestvoid
public void SetBoneRest(int boneIdx, Transform3D rest);Sets the local reference transform. Does not itself replace the current pose: use ResetBonePose or ResetBonePoses to return to the new Rest. Changing Rest affects skeleton reference geometry; verify skinning and animation separately.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
rest | Transform3D | — |
boneIdxExisting bone index: 0 <= boneIdx < GetBoneCount(). Check FindBone for -1 first.
restLocal reference bone transform relative to its parent. Convert consistently through ancestors for skeleton-wide coordinates.
SetBoneSkinScalevoid
public void SetBoneSkinScale(int boneIdx, Vector3 skinScale);Sets the skin scale of the bone at bone_idx to skin_scale. This scale does not affect bone children. This is useful for modifying the visual thickness of a skin.
Even if the skin is visually deformed, neither scaling nor repositioning of the bones occurs. This means that you may need to adjust the origin of the child bone to synchronize its joint position with the scaling by using BoneSpaceAdjuster3D.
Note: The skin scaling may corrupt the appearance of the gizmo for some SkeletonModifier classes, such as SpringBoneSimulator and IKModifier3D, which rely on bone lengths for skinning.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
skinScale | Vector3 | — |
SetModifierCallbackModeProcessvoid
public void SetModifierCallbackModeProcess(Skeleton3D.ModifierCallbackModeProcessEnum mode);| Name | Type | Default |
|---|---|---|
mode | Skeleton3D.ModifierCallbackModeProcessEnum | — |
SetMotionScalevoid
public void SetMotionScale(float motionScale);| Name | Type | Default |
|---|---|---|
motionScale | float | — |
SetShowRestOnlyvoid
public void SetShowRestOnly(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
UnparentBoneAndRestvoid
public void UnparentBoneAndRest(int boneIdx);Unparents the bone at bone_idx and sets its rest position to that of its parent prior to being reset.
| Name | Type | Default |
|---|---|---|
boneIdx | int | — |
Signals and events6
BoneEnabledChangedEvent
public event Skeleton3D.BoneEnabledChangedEventHandler BoneEnabledChanged;Emitted when the bone at bone_idx is toggled with Skeleton3D.SetBoneEnabled. Use Skeleton3D.IsBoneEnabled to check the new value.
| Name | Type | Default |
|---|---|---|
boneIdx | long | — |
BoneListChangedEvent
public event Action BoneListChanged;Emitted when the list of bones changes, such as when calling Skeleton3D.AddBone, Skeleton3D.SetBoneParent, Skeleton3D.UnparentBoneAndRest, or Skeleton3D.ClearBones.
PoseUpdatedEvent
public event Action PoseUpdated;Emitted when the pose is updated.
Note: During the update process, this signal is not fired, so modification by SkeletonModifier3D is not detected.
RestUpdatedEvent
public event Action RestUpdated;Emitted when the rest is updated.
ShowRestOnlyChangedEvent
public event Action ShowRestOnlyChanged;Emitted when the value of Skeleton3D.ShowRestOnly changes.
SkeletonUpdatedEvent
public event Action SkeletonUpdated;Emitted when the final pose has been calculated will be applied to the skin in the update process.
This means that all SkeletonModifier3D processing is complete. In order to detect the completion of the processing of each SkeletonModifier3D, use SkeletonModifier3D.ModificationProcessed.
Fields and constants1
NotificationUpdateSkeletonField
public const long NotificationUpdateSkeleton = 50;Notification received when this skeleton's pose needs to be updated. In that case, this is called only once per frame in a deferred process.
Skeleton3D.ModifierCallbackModeProcessEnum
| Value | Description |
|---|---|
Idle = 1 | Set a flag to process modification during process frames (see |
Manual = 2 | Do not process modification. Use |
Physics = 0 | Set a flag to process modification during physics frames (see |