Animator

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

Class.Animation|Animations 의 재생 및 복제에 대한 주 클래스. 모든 재생은 AnimationTracks 을 통해 처리됩니다.

또한 애니메이션 편집기애니메이션 사용 을 참조하여 게임에 미리 빌드 또는 사용자 정의 애니메이션을 생성하는 방법을 알아보십시오.

요약

속성

메서드

이벤트

속성

EvaluationThrottled

읽기 전용
복제되지 않음
찾아볼 수 없음
병렬 쓰기

PreferLodEnabled

병렬 읽기

RootMotion

읽기 전용
복제되지 않음
찾아볼 수 없음
병렬 쓰기

RootMotionWeight

읽기 전용
복제되지 않음
찾아볼 수 없음
병렬 쓰기

메서드

ApplyJointVelocities

void

현재 세트의 AnimationTracks 재생 시간과 현재 시간을 고려하여 부품 간의 상대 속도를 계산하고 Motor6D.Part1(Animator가 "자식"부품을 고려하는 순서로 적용합니다. 이 상대 속도 계산 및 할당은 순서대로 발생합니다.

이 메서드는 공동의 부품 중 하나가 현재 동일한 조립의 일부인 경우에만 적용됩니다. 예를 들어, 모터나 접합으로 직접 또는 간접적으로 연결되는 경우.

이 메서드는 대체 하거나 제거 하지 않습니다. 이 메서드를 호출 하기 전에 조인트를 비활성화 하거나 제거 해야 합니다.

이 주어진 Motor6Ds 은 Class.DataModel 의 후손이 아닙니다. 이 메서드를 호출하기 전에 DataModel 의 관절을 제거하는 것이 지원됩니다.

매개 변수

motors: Variant

반환

void

GetPlayingAnimationTracks

현재 재생 중인 목록을 반환합니다 AnimationTracks .


반환

LoadAnimation

이 함수는 지정된 Animation 을 이 Animator 에 로드하고, 플레이어가능한 AnimationTrack 를 반환합니다. 클라이언트가 네트워크 소유권을 가진 모델 내에서 1>

이 함수를 직접 사용하는 대신 Humanoid:LoadAnimation()AnimationController:LoadAnimation() 함수를 사용하지 마십시오. 이는 이 함수의 슬프게도 생성되는 다음과 같은 Animator 을 만들기 때문입니다. 이 경우 조심하지 않으면 복제

클라이언트 또는 서버에 애니메이션 로드

Class.AnimationTrack|AnimationTracks 을 올바르게 복제하려면 클라이언트나 서버에서 언제 로드되어야 하는지 알아야 합니다.

  • Class.Animator 는 플레이어의 클라이언트의 하위인 Class.Humanoid 또는 Class.AnimationController 인 경우 클라이언트의 다른 클라이언트에 시작된 애니메이션이 서버와 다른 클라이언트에 복제됩니다.

  • Class.Animator 는 플레이어 캐릭터의 후손이 아니므로 서버에서 애니메이션을 로드하고 시작해야 복제할 수 있습니다.

서버에서 만들어야 하고 애니메이션 복제를 위해 클라이언트에 복제되어야 하는 Animator 개체는 애니메이션 복제를 작동하려면 처음에 서버에 생성되어야 합니다. 로컬에서 Animator 이 생성되면 애니메이션 트랙/트랙

매개 변수

animation: Animation

사용할 Animation 이 있습니다.


반환

RegisterEvaluationParallelCallback

void

매개 변수

callback: function

반환

void

StepAnimations

void
플러그인 보안

플레이어에 로드된 모든 AnimationTrack.TimePosition 증가, 오프셋을 AnimationTracks 에 적용하여 모델과 연관된 클래스 Animator 에 적용하는 경우. 명령 바에서 사용하거나 플러그인에 의해 사용만 가능.

DeltaTime 매개 변수는 애니메이션 진행 상황에 대한 초 수를 증가시킵니다. 일반적으로 이 함수는 애니메이션 길이를 미리 볼 수 있도록 루프로 호출됩니다(예시 참조).

애니메이션이 플레이를 중지한 후 모델의 관절이 원래 위치로 수동으로 재설정되어야 합니다(예시 참조).

이 함수는 게임이 실행되지 않을 때 Animations 의 플레이백을 시뮬레이션하는 데 사용됩니다. 이를 통해 스크립트 실행과 같은 게임 실행의 결과를 없애고 애니메이션을 미리 볼 수 있습니다. 이 함수는

자체 사용자 애니메이션 편집기를 설계한 개발자는 이 함수를 사용하여 애니메이션을 미리 볼 것을 권장합니다, 왜냐하면 이것은 Roblox 애니메이션 편집기 플러그인의 메서드입니다.

매개 변수

deltaTime: number

초 단위 애니메이션 재생 시간이 증가합니다.


반환

void

코드 샘플

This code sample includes a function that can be used to preview an Animation on a Model in Roblox Studio, without needing to run the game. It utilizes the Animator.StepAnimations function, which is the same method the official Roblox Animation Editor uses.

Preview Animation in Studio

local RunService = game:GetService("RunService")
local function studioPreviewAnimation(model, animation)
-- find the AnimationController and Animator
local animationController = model:FindFirstChildOfClass("Humanoid")
or model:FindFirstChildOfClass("AnimationController")
local animator = animationController and animationController:FindFirstChildOfClass("Animator")
if not animationController or not animator then
return
end
-- load the Animation to create an AnimationTrack
local track = animationController:LoadAnimation(animation)
track:Play()
-- preview the animation
local startTime = tick()
while (tick() - startTime) < track.Length do
local step = RunService.Heartbeat:wait()
animator:StepAnimations(step)
end
-- stop the animation
track:Stop(0)
animator:StepAnimations(0)
-- reset the joints
for _, descendant in pairs(model:GetDescendants()) do
if descendant:IsA("Motor6D") then
local joint = descendant
joint.CurrentAngle = 0
joint.Transform = CFrame.new()
end
end
end
local character = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://507765644"
studioPreviewAnimation(character, animation)

이벤트

AnimationPlayed

Animator가 만든 애니메이션 트랙:플레이에 대한 모든 AnimationTrack:Play() 호출을 위해 화재됩니다.

매개 변수

animationTrack: AnimationTrack