Aprender
Clase de motor
Animator

*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.



Referencia API
Propiedades
EvaluationThrottled
Solo lectura
No replicado
Escribir paralelo
Capacidades: Animation
Animator.EvaluationThrottled:boolean

PreferLodEnabled
Leer paralelo
Capacidades: Animation
Animator.PreferLodEnabled:boolean

RootMotion
Solo lectura
No replicado
No explorable
Escribir paralelo
Capacidades: Animation
Animator.RootMotion:CFrame

RootMotionWeight
Solo lectura
No replicado
No explorable
Escribir paralelo
Capacidades: Animation
Animator.RootMotionWeight:number

Métodos
ApplyJointVelocities
Capacidades: Animation
Animator:ApplyJointVelocities(motors:Variant):()
Parámetros
motors:Variant
Devuelve
()

GetPlayingAnimationTracks
Capacidades: Animation
Acceso a la simulación
Animator:GetPlayingAnimationTracks():{any}
Devuelve

GetTrackByAnimationId
Capacidades: Animation
Acceso a la simulación
Animator:GetTrackByAnimationId(animationId:ContentId):AnimationTrack?
Parámetros
animationId:ContentId
Muestras de código
Obtener pista de animación por 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()
-- Asegúrate de que el humanoide del personaje contenga un objeto Animator
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
-- Crea una nueva instancia de Animation y asigna un ID de recurso de animación
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = ANIM_ID
-- Carga la animación en el animador
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)
-- Reproduce la pista de animación después de un breve retraso
task.wait(3)
kickAnimationTrack:Play()
local startTime = tick()
RunService:BindToSimulation(function(deltaTime: number)
if tick() - startTime > 1 then
-- Obtén la pista por ID y detén su reproducción
local kickTrack = animator:GetTrackByAnimationId(ANIM_ID)
if kickTrack and kickTrack.IsPlaying then
kickTrack:Stop()
end
end
end)

LoadAnimation
Capacidades: Animation
Acceso a la simulación
Animator:LoadAnimation(animation:Animation):AnimationTrack
Parámetros
animation:Animation

RegisterEvaluationParallelCallback
Capacidades: Animation
Animator:RegisterEvaluationParallelCallback(callback:function):()
Parámetros
callback:function
Devuelve
()

StepAnimations
Seguridad del plugin
Capacidades: Animation
Animator:StepAnimations(deltaTime:number):()
Parámetros
deltaTime:number
Devuelve
()
Muestras de código
Vista previa de la animación en el estudio
local RunService = game:GetService("RunService")
local function previewAnimation(model, animation)
-- Encontrar el AnimationController y el Animator
local animationController = model:FindFirstChildOfClass("AnimationController")
local animator = animationController and animationController:FindFirstChildOfClass("Animator")
if not animator then return end
-- Cargar la animación para crear un AnimationTrack
local track = animationController:LoadAnimation(animation)
track:Play()
-- Previsualizar la animación
local startTime = tick()
while (tick() - startTime) < track.Length do
local step = RunService.Heartbeat:wait()
animator:StepAnimations(step)
end
-- Detener la animación
track:Stop(0)
animator:StepAnimations(0)
-- Restablecer las juntas
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)

Eventos
AnimationPlayed
Capacidades: Animation
Animator.AnimationPlayed(animationTrack:AnimationTrack):RBXScriptSignal
Parámetros
animationTrack:AnimationTrack

©2026 Roblox Corporation. Roblox, el logotipo de Roblox y "Powering Imagination" son algunas de nuestras marcas registradas y no registradas en los Estados Unidos y otros países.