Engine-Klasse
AnimationController
*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.
Zusammenfassung
Methoden
LoadAnimation(animation: Animation):AnimationTrack |
Events
AnimationPlayed(animationTrack: AnimationTrack):RBXScriptSignal |
Code-Beispiele
Verwenden eines AnimationControllers zur Animation von Nicht-Spieler-Objekten
local InsertService = game:GetService("InsertService")
-- Lade ein Modell zur 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
-- Ersetze den Humanoid durch einen AnimationController
local humanoid = npcModel:FindFirstChildOfClass("Humanoid")
humanoid:Destroy()
local animationController = Instance.new("AnimationController")
animationController.Parent = npcModel
-- Erstelle und lade eine Animation
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=507771019" -- Roblox Tanz-Emote
local animationTrack = animationController:LoadAnimation(animation)
-- Spiele die Animation ab
animationTrack:Play()API-Referenz
Methoden
GetPlayingAnimationTracks
LoadAnimation
Events
AnimationPlayed