포즈는 연결된 상관 CFrame 에 적용된 Motor6D 에 적용된 BasePart 을 유지합니다.제어되는 부품은 포즈의 이름에 따라 달라집니다.
포즈는 애니메이션의 기본 구성 요소이며, Keyframes 로 구성되어 KeyframeSequences 됩니다.
포즈, 관절 및 계층
포즈가 이름으로 할당되었지만, 애니메이션 재생 중에 조작된 개체는 실제로 이 부분에 연결된 입니다.애니메이션 리그는 이러한 관절을 통해 모델의 루트 부분에서 분기합니다.
R15 캐릭터 리그에서 루트 부분은 HumanoidRootPart입니다.낮은 몸통은 '루트'라는 모터를 통해 인간형 루트 파트에 연결됩니다.따라서 CFrame '낮은 몸통'이라는 포즈의 Keyframe 에 적용된 모터는 '루트'라는 이름의 모터가 아니라 낮은 몸통 자체가 될 것입니다.
포즈는 공동 계층에 따라 Keyframe에 배열됩니다.즉, 포즈의 CFrame가 포즈와 부모 포즈와 연결된 부품에 연결된 모터에 적용됩니다.R15 캐릭터의 포즈 구조의 시각적 예제는 아래를 참조하십시오.
CFrame 포즈
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 를 포즈에 설정하는 것과 기능적으로 동일합니다.
참고, 이 함수는 포즈 매개변수로 다른 인스턴스가 주어질 때 오류가 발생하지 않으며 성공적으로 부모가 됩니다.
매개 변수
반환
코드 샘플
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() 함수를 사용하는 것과 동일합니다. on the 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
부모로 지정하여 하위 를 에서 제거합니다.이것은 새로운 포즈의 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