AnimationController
Veraltete anzeigen
*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.
Ein Objekt, das Animationen in einem Character oder Model auf ein Character oder Model laden und anwenden kann, anstelle eines Humanoid. Erstellt ein Animator und lädt Animationen, um das gesagte Character zu aktualisieren, in dem Motor6Ds der Animation Asset referenziert wird, das
Beachten Sie, dass die Methode Class
Code-Beispiele
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()