เรียนรู้
Engine Class
Animator

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
เหตุการณ์
สมาชิกที่ได้รับทอด

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
EvaluationThrottled
อ่านอย่างเดียว
ไม่ซ้ำ
เขียนพร้อมๆ กัน
ความสามารถ: Animation
Animator.EvaluationThrottled:boolean

PreferLodEnabled
อ่านพร้อมๆ กัน
ความสามารถ: Animation
Animator.PreferLodEnabled:boolean

RootMotion
อ่านอย่างเดียว
ไม่ซ้ำ
ไม่สามารถเรียกดู
เขียนพร้อมๆ กัน
ความสามารถ: Animation
Animator.RootMotion:CFrame

RootMotionWeight
อ่านอย่างเดียว
ไม่ซ้ำ
ไม่สามารถเรียกดู
เขียนพร้อมๆ กัน
ความสามารถ: Animation
Animator.RootMotionWeight:number

วิธีการ
ApplyJointVelocities
ความสามารถ: Animation
Animator:ApplyJointVelocities(motors:Variant):()
พารามิเตอร์
motors:Variant
ส่งค่ากลับ
()

GetPlayingAnimationTracks
ความสามารถ: Animation
การเข้าถึงการจำลองสถานการณ์
Animator:GetPlayingAnimationTracks():{any}
ส่งค่ากลับ

GetTrackByAnimationId
ความสามารถ: Animation
การเข้าถึงการจำลองสถานการณ์
Animator:GetTrackByAnimationId(animationId:ContentId):AnimationTrack?
พารามิเตอร์
animationId:ContentId
ส่งค่ากลับ
ตัวอย่างโค้ด
ดึงแทรกอนิเมชันโดย ID
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ANIM_ID = "rbxassetid://2515090838"
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
-- ตรวจสอบให้แน่ใจว่ามนุษย์ของตัวละครมีวัตถุ Animator
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
-- สร้างอินสแตนซ์ Animation ใหม่และกำหนด ID แอสเซ็ตอนิเมชัน
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = ANIM_ID
-- โหลดอนิเมชันลงบน Animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)
-- เล่นแทรกอนิเมชันหลังจากดีเลย์สั้นๆ
task.wait(3)
kickAnimationTrack:Play()
local startTime = tick()
RunService:BindToSimulation(function(deltaTime: number)
if tick() - startTime > 1 then
-- ดึงแทรกโดย ID และหยุดการเล่นของมัน
local kickTrack = animator:GetTrackByAnimationId(ANIM_ID)
if kickTrack and kickTrack.IsPlaying then
kickTrack:Stop()
end
end
end)

LoadAnimation
ความสามารถ: Animation
การเข้าถึงการจำลองสถานการณ์
Animator:LoadAnimation(animation:Animation):AnimationTrack
พารามิเตอร์
animation:Animation
ส่งค่ากลับ

RegisterEvaluationParallelCallback
ความสามารถ: Animation
Animator:RegisterEvaluationParallelCallback(callback:function):()
พารามิเตอร์
callback:function
ส่งค่ากลับ
()

StepAnimations
การรักษาความปลอดภัยของปลั๊กอิน
ความสามารถ: Animation
Animator:StepAnimations(deltaTime:number):()
พารามิเตอร์
deltaTime:number
ส่งค่ากลับ
()
ตัวอย่างโค้ด
ตัวอย่างการแสดงอนิเมชันใน Studio
local RunService = game:GetService("RunService")
local function previewAnimation(model, animation)
-- ค้นหา AnimationController และ Animator
local animationController = model:FindFirstChildOfClass("AnimationController")
local animator = animationController and animationController:FindFirstChildOfClass("Animator")
if not animator then return end
-- โหลด Animation เพื่อสร้าง AnimationTrack
local track = animationController:LoadAnimation(animation)
track:Play()
-- ดูภาพนิ่งการเคลื่อนไหว
local startTime = tick()
while (tick() - startTime) < track.Length do
local step = RunService.Heartbeat:wait()
animator:StepAnimations(step)
end
-- หยุดการเคลื่อนไหว
track:Stop(0)
animator:StepAnimations(0)
-- รีเซ็ตข้อต่อ
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"
previewAnimation(character, animation)

เหตุการณ์
AnimationPlayed
ความสามารถ: Animation
Animator.AnimationPlayed(animationTrack:AnimationTrack):RBXScriptSignal
พารามิเตอร์
animationTrack:AnimationTrack

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ