This example demonstrates how to play animations in a model in the Galacean editor. Through simple steps, you will learn how to load a 3D model with animations and control its animation playback. This guide is suitable for beginners to understand the animation system of the Galacean editor and lays the foundation for more complex animation applications.
Before starting, we need a model with animations. If you don't have a model, you can download one from mixamo.
It is strongly recommended to convert FBX models to GLB/GLTF format using third-party tools such as Blender in actual projects. Galacean currently only supports parsing GLB/GLTF models. Although you can directly drag FBX into the editor for automatic conversion, this method may result in excessively large animation data in the converted model and may cause restoration issues. Using professional tools for conversion allows better control over conversion quality and file size.
There are three ways to import models:
Upload
-> Model
Model
Click the expand button on the model asset
You can see that the model contains an AnimationClip
(detailed introduction) asset (if the model contains multiple animations, there will be multiple AnimationClip
assets here)
And an AnimatorController
(detailed introduction) asset
To control the playback of animations, we need to edit the content of the AnimatorController
. The AnimatorController
in the model is read-only, so we need to create an AnimatorController
ourselves.
There are two ways to create an AnimatorController
:
Create
-> Animation Controller
+
and select Animation Controller
AnimatorState
button to add an AnimatorState
AnimatorState
(for an introduction to the properties of the Animation State, please refer to the AnimatorStateMachine document), and bind the AnimationClip.entry
to this AnimatorState
and click the connection line to change the Duration
to 0 (for a detailed introduction to Animation Transition, please refer to the AnimatorStateMachine document). This way, when this AnimatorController is applied, it will immediately play this AnimatorState
.Animator
component (detailed introduction). The component is generally on the root entity of the model instance, which is the first child entity under the model entity in the editor.AnimatorController
we just created