Documentation

Unity Engine

Download Unity

Unity Engine

RootMotionBoneId

The identifier of the bone whose motion gives the root motion of a clip.
Read time 1 minuteLast updated 4 hours ago

Definition

public StringHash RootMotionBoneId { get; readonly set; }

Remarks

By default, the value isn't set: it is the default
StringHash
, and the root motion bone is the root bone of the skeleton. Set it to choose another bone, for example a hips bone under a root that clips don't animate. The identifier of a bone is the StringHash of its path relative to the root of the hierarchy, for example
rigBuilder.RootMotionBoneId = "Skeleton/Hips"
. Set the default
StringHash
to go back to the root bone. RigBuilder.Clear also resets the value to the default.
RigBuilder.ToRigDefinition stores the index of the bone in RigDefinition.RootMotionBoneIndex. When a clip has no root motion curves, ClipSampler.SampleRootMotion returns the motion of this bone in character space, which includes the motion of its parent bones. ClipSampler.SampleExtractingRootMotion removes the root motion from this bone in the pose.
Add the bone before you set this value. If safety checks are enabled, setting it throws an
ArgumentException
when no bone of the skeleton has this identifier, and
ToRigDefinition
throws one when you removed the bone afterward.