AnimationController

Afficher les obsolètes

*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.

Un objet qui permet aux animations d'être chargées et appliquées à un personnage ou un modèle au lieu d'un Humanoid . Crée un Animator et charge les animations pour mettre à jour le Motor6Ds d'un personnage pour réagir de la manière décrite dans la ressource d'animation référencée par un

Remarquez que la méthode Class

Échantillons de code

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()

Propriétés

Méthodes

Évènements