Pose

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

ポーズは、CFrame に接続された Motor6D に適用された BasePart を保持します。コントロールされているパーツは、ポーズの名前によります。

ポーズはアニメーションの基本的なビルディングブロックであり、Keyframes で構成される KeyframeSequencesです。

ポーズ、関節、および階層

ポーズは、BasePart に名前で割り当てられていますが、アニメーションプレイヤーで操作されるオブジェクトは、実際にはこの部分に接続されている Motor6D です。アニメーションリグは、モデルのルートパーツからモデルの枝分けされます。

R15 キャラクターリグでは、根部はヒューマノイドルートパートです。LowerTorso は 'Root' という名前のモーターに接続されます。ですから、 CFrame の Pose の下の Torso の名前は、Keyframe のモーター名に適用されます。したがって、 Dat

ポーズは、共同の階層に基づいて Keyframe に配置されます。これにより、ポーズの CFrame は、ポーズの親に接続されたパーツに適用されます。下の R15 キャラクターのビジュアル例は、ポーズの構造を示しています。

CFrame をポーズ

Roblox アニメーションシステムは、モーターの相対変換を操作することにより、Pose.CFrame に対応する Motor6D を適用します。オリジナルの Class.JointInstance.C1|C0</

コードサンプル

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.

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)

This code sample includes a function to reset the CFrame of the Poses in a 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

概要

プロパティ

PoseBase から継承した プロパティ

方法

  • AddSubPose(pose : Instance):void

    Class.Pose を親にすることで、Pose にサブ Class.Pose を追加します。

  • GetSubPoses():Instances

    Class.Pose|Poses のすべての子 Pose を含むアレイを返します。

  • RemoveSubPose(pose : Instance):void

    Class.Pose を子にして、Pose を親にすることで削除されます。

プロパティ

CFrame

並列読み取り

この CFrame は、Motor6DPose と対応するときに適用されます。オリジナルの 1>Class.Motor6D.C01> と 4>Class.Motor6D.C1

Pose オブジェクトは、共同階層に基づいて Keyframe に配置されます。これは、Pose.CFrame がポーズのパートに適用されるモーターに接続されることを意味します。これにより、0> Class.Pose.CFrame0> は、ポーズのパートの親に接

方法

AddSubPose

void

Class.Pose を親に追加することで、PoseInstance.Parent を設定します。機能的に新しいポーズの 1> Class.Instance.Parent1> をポーズに設定することと同じです。

注: この関数は、Pose 以外のインスタンスがポーズパラメータとして与えられた場合でもエラーしないです。親に成功します。

パラメータ

pose: Instance

追加する Pose


戻り値

void

コードサンプル

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.

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

Class.Pose に追加されたすべての子 Pose を含むアレイを返します。これは、Instance:GetChildren() の機能と同じです。

注:この関数は、Pose のすべての子、および、Pose が存在する場合、Instances の子をすべて返します。


戻り値

Instances

Poses の配列。

コードサンプル

This code sample includes a function to reset the CFrame of the Poses in a 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

RemoveSubPose

void

Class.Pose を削除する sub Pose から Class.Pose に親を付けることで、Instance.Parent を導入します。これは、新しいポーズの 1> Class.Instance.Parent1> を nil に設定することと機能的に同等です。

注: Pose 以外の Pose は、1>Class.Pose1> パラメータとして使用される場合、この関数はその 4>Class.Instance4> を削除し、エラーを提供しません。

パラメータ

pose: Instance

削除する Pose


戻り値

void

コードサンプル

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.

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

イベント