ポーズは、関連する CFrame に接続された Motor6D に適用された BasePart を保持します。制御されるパーツは、ポーズの名前に依存します。
ポーズはアニメーションの基本的な構築ブロックであり、Keyframes で、KeyframeSequences を構成します。
ポーズ、ジョイント、階層
ポーズは名前で BasePart に割り当てられていますが、アニメーション再生中に操作されるオブジェクトは、実際にはこの部分に接続されている Motor6D です。アニメーションリグは、そのようなジョイントを介してモデルの根部から分岐します。
R15 キャラクターリグでは、根部は HumanoidRootPart です。LowerTorso は、「Root」というモーターによって HumanoidRootPart に接続されています。ため、CFrame ポーズの名前 'LowerTorso' の Keyframe には、モーター 'Root' に適用され、LowerTorso 自体には適用されません。
ポーズは、共同の階層に基づいて Keyframe 配置されます。これは、ポーズの CFrame が、ポーズに関連するパーツをポーズの親に接続するモーターに適用されることを意味します。R15 キャラクターのポーズの構造の視覚的な例は以下を参照してください。
ポーズCフレーム
Roblox アニメーションシステムは、モーターの相対変形、Motor6D プロパティを操作して、対応する Motor6D.Transform に Pose.CFrame を適用します。オリジナルの C0 と C1 の値は変更されません。
コードサンプル
This sample includes a function that will generate a 'blank' keyframe containing blank poses for all of the model's connected parts in the correct hierarchical order.
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)
This code sample includes a function to reset the CFrame of the Poses in a Keyframe.
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
概要
プロパティ
この は、 が変更されたときに対応する に適用されます。
次のポーズの値に到達するために使用する緩和方向。
次のポーズの値に到達するために使用する緩和スタイル。
方法
プロパティ
CFrame
この は、 が変更されたときに対応する に適用されます。オリジナルの Motor6D.C0 と Motor6D.C1 の値は変更されません。
Pose オブジェクトは、共同の階層に基づいて Keyframe 配置されます。これは、Pose.CFrame が、ポーズに関連するパーツをポーズの親に接続するモーターに適用されることを意味します。
方法
AddSubPose
親子関係を介して Pose を Pose に追加し、新しいポーズの Instance.Parent をポーズに設定すると機能的に同じです。
注: この機能は、Pose 以外のインスタンスがポーズパラメータとして指定され、成功して親になるときにエラーは発生しません。
パラメータ
戻り値
コードサンプル
This sample demonstrates quickly the Keyframe.AddPose, Keyframe.RemovePose and Pose.AddSubPose and Pose.RemoveSubPose functions. Note these are functionally equivalent to parenting and un-parenting the poses.
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
返すのは、Poses に追加されたすべてのサブ Pose を含む配列です。これは機能的に Instance:GetChildren() 関数を使用することと同じです。Pose 。
注: この機能は、Pose 、非Pose 、Instances が存在する場合を含め、すべての子供を返します。
戻り値
子の配列 Poses 。
コードサンプル
This code sample includes a function to reset the CFrame of the Poses in a Keyframe.
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
親子関係で Pose を削除して、Pose から nil を削除します。これは新しいポーズの Instance.Parent を nil に設定すると機能的に同じです。
注: 他の がパラメーターとして使用される場合、この関数はそれを削除し、エラーを提供しません。
パラメータ
戻り値
コードサンプル
This sample demonstrates quickly the Keyframe.AddPose, Keyframe.RemovePose and Pose.AddSubPose and Pose.RemoveSubPose functions. Note these are functionally equivalent to parenting and un-parenting the poses.
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