AnimationController
Visualizza obsoleti
*Questo contenuto è tradotto usando AI (Beta) e potrebbe contenere errori. Per visualizzare questa pagina in inglese, clicca qui.
Un oggetto che consente alle animazioni di essere caricate e applicate a un personaggio o modello in luogo di un Humanoid . Crea un Animator e carica le animazioni per aggiornare Motor6Ds di detto personaggio per reagire nel modo descrittivo all'interno della risorsa di animazione richiam
Nota che il metodo Class.Animation
Campioni di codice
This code sample demonstrates how an AnimationController can be used in place of a Humanoid for non player character objects.
A basic rig is loaded using InsertService and the default Humanoid is replaced with an AnimationController. An AnimationTrack is then created and played.
Using an AnimationController to animation non-player objects
local InsertService = game:GetService("InsertService")
-- Load a model for demonstration
local npcModel = InsertService:LoadAsset(516159357):GetChildren()[1]
npcModel.Name = "NPC"
npcModel.PrimaryPart.Anchored = true
npcModel:SetPrimaryPartCFrame(CFrame.new(0, 5, 0))
npcModel.Parent = workspace
-- Replace the humanoid with an animationcontroller
local humanoid = npcModel:FindFirstChildOfClass("Humanoid")
humanoid:Destroy()
local animationController = Instance.new("AnimationController")
animationController.Parent = npcModel
-- Create and load an animation
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=507771019" -- Roblox dance emote
local animationTrack = animationController:LoadAnimation(animation)
-- Play the animation
animationTrack:Play()