Pose

Show Deprecated

A Pose holds the CFrame applied to the Motor6D connected to its associated BasePart. The part which is controlled depends on the name of the Pose.

Poses are the fundamental building blocks of animations and, with Keyframes, make up KeyframeSequences.

Poses, joints and hierarchy

Although a Pose is assigned to a BasePart by name, the object manipulated during animation playback is actually the Motor6D connected to this part. Animation rigs branch out from the model's root part through such joints.

In a R15 character rig, the root part is the HumanoidRootPart. The LowerTorso is connected to the HumanoidRootPart by the a motor named 'Root'. Therefore, the CFrame of a Pose named 'LowerTorso' in a Keyframe would be applied to the motor named 'Root', and not the LowerTorso itself.

Poses are arranged in a Keyframe based on joint hierarchy. This means, the Pose's CFrame is applied to the motor connecting the part associated with the pose to the part associated with the pose's parent. See below for a visual example of the structure of Poses on a R15 character.

Pose CFrame

The Roblox animation system applies Pose.CFrame to the corresponding Motor6D by manipulating the relative transformation of the motor, the Motor6D.Transform property. The original C0 and C1 values are not changed.

Code Samples

Keyframe Generate Poses

local function generateKeyframe(model)
if not model.PrimaryPart then
warn("No primary part set")
return
end
local rootPart = model.PrimaryPart:GetRootPart()
if not rootPart then
warn("Root part not found")
return
end
local partsAdded = {}
partsAdded[rootPart] = true
local function addPoses(part, parentPose)
-- get all of the joints attached to the part
for _, joint in pairs(part:GetJoints()) do
-- we're only interested in Motor6Ds
if joint:IsA("Motor6D") then
-- find the connected part
local connectedPart = nil
if joint.Part0 == part then
connectedPart = joint.Part1
elseif joint.Part1 == part then
connectedPart = joint.Part0
end
if connectedPart then
-- make sure we haven't already added this part
if not partsAdded[connectedPart] then
partsAdded[connectedPart] = true
-- create a pose
local pose = Instance.new("Pose")
pose.Name = connectedPart.Name
parentPose:AddSubPose(pose)
-- recurse
addPoses(connectedPart, pose)
end
end
end
end
end
local keyframe = Instance.new("Keyframe")
-- populate the keyframe
local rootPose = Instance.new("Pose")
rootPose.Name = rootPart.Name
addPoses(rootPart, rootPose)
keyframe:AddPose(rootPose)
return keyframe
end
local character = script.Parent
local keyframe = generateKeyframe(character)
print(keyframe)
Keyframe Reset Poses

local function resetPoses(parent)
-- both functions are equivalent to GetChildren
local poses = parent:IsA("Keyframe") and parent:GetPoses() or parent:IsA("Pose") and parent:GetSubPoses()
for _, pose in pairs(poses) do
if pose:IsA("Pose") then
pose.CFrame = CFrame.new()
-- recurse
resetPoses(pose)
end
end
end

Summary

Properties

Properties inherited from PoseBase

Methods

Properties

CFrame

Read Parallel

This CFrame applies to the Motor6D corresponding with the Pose when the Motor6D.Transform is changed. The original Motor6D.C0 and Motor6D.C1 values are not changed.

Pose objects are arranged in a Keyframe based on joint hierarchy. This means, that the Pose.CFrame is applied to the motor connecting the part associated with the pose to the part associated with the pose's parent.

Methods

AddSubPose

void

Adds a sub Pose to the Pose by parenting it to it. It is functionally identical to setting the new pose's Instance.Parent to the pose.

Note, this function will not error when an instance other than a Pose is given as the pose parameter and will parent it successfully.

Parameters

pose: Instance

The Pose to be added.


Returns

void

Code Samples

Keyframe Add/Remove Pose

local keyframe = Instance.new("Keyframe")
keyframe.Parent = workspace
local pose = Instance.new("Pose")
pose.EasingStyle = Enum.PoseEasingStyle.Cubic
pose.EasingDirection = Enum.PoseEasingDirection.Out
local pose2 = Instance.new("Pose")
pose2.EasingStyle = Enum.PoseEasingStyle.Cubic
pose2.EasingDirection = Enum.PoseEasingDirection.Out
keyframe:AddPose(pose) -- pose.Parent = keyframe
task.wait(2)
keyframe:RemovePose(pose) -- pose.Parent = nil
task.wait(2)
keyframe:AddPose(pose) -- pose.Parent = keyframe
task.wait(2)
pose:AddSubPose(pose2) -- pose2.Parent = pose
task.wait(2)
pose:RemoveSubPose(pose2) -- pose2.Parent = nil

GetSubPoses

Instances

Returns an array containing all sub Poses that have been added to a Pose. This is functionally the same as using the Instance:GetChildren() function on the Pose.

Note: this function returns all children of the Pose, including non Pose Instances if any are present.


Returns

Instances

An array of sub Poses.

Code Samples

Keyframe Reset Poses

local function resetPoses(parent)
-- both functions are equivalent to GetChildren
local poses = parent:IsA("Keyframe") and parent:GetPoses() or parent:IsA("Pose") and parent:GetSubPoses()
for _, pose in pairs(poses) do
if pose:IsA("Pose") then
pose.CFrame = CFrame.new()
-- recurse
resetPoses(pose)
end
end
end

RemoveSubPose

void

Removes a sub Pose from the Pose by parenting it to nil. This is functionally identical to setting the new pose's Instance.Parent to nil.

Note: If an Instance other than Pose is used as a Pose parameter, this function removes that Instance and does not provide an error.

Parameters

pose: Instance

The Pose to be removed.


Returns

void

Code Samples

Keyframe Add/Remove Pose

local keyframe = Instance.new("Keyframe")
keyframe.Parent = workspace
local pose = Instance.new("Pose")
pose.EasingStyle = Enum.PoseEasingStyle.Cubic
pose.EasingDirection = Enum.PoseEasingDirection.Out
local pose2 = Instance.new("Pose")
pose2.EasingStyle = Enum.PoseEasingStyle.Cubic
pose2.EasingDirection = Enum.PoseEasingDirection.Out
keyframe:AddPose(pose) -- pose.Parent = keyframe
task.wait(2)
keyframe:RemovePose(pose) -- pose.Parent = nil
task.wait(2)
keyframe:AddPose(pose) -- pose.Parent = keyframe
task.wait(2)
pose:AddSubPose(pose2) -- pose2.Parent = pose
task.wait(2)
pose:RemoveSubPose(pose2) -- pose2.Parent = nil

Events