Jump to content

Guide to the Godot game engine/Animation

From Wikibooks, open books for an open world

Animation methods

[edit | edit source]

Animation trees just play animation players, but they make it easier to animate properly, by controlling which animation occurs, based on a state machine, and they also make adding transition animations easier. So, it takes less work to go from a "sitting" animation to a "stand up from sitting" animation, to "walking" animation. However, they take a little while to set up.

AnimationPlayers allow you to control every frame, with fewer bugs than when animating directly from code, of the animation. They use "keyframes", which are points of the animation where a value is set. Some types can slowly transition to the next keyframe. Some are instantly set. You can also control whether they transition or just set. They are the fastest to set up, but the least versatile.

Tweens are started and manipulated with code, they just make it a bit simpler to do so, allowing you to animate a node's property over time, with ease-in and ease-out effects.

With code

[edit | edit source]

The most versatile method, but the most difficult to get right. It takes trial and error to fix bugs, since code usually doesn't run in the editor.

With shaders

[edit | edit source]

While little more versatile as AnimationPlayers, are the fastest, as they run on the GPU. They can do many things, including animating water and clouds.

Animating movement

[edit | edit source]

When animating movement, first consider how the object or creature moves. Does it propel itself forward like a rolling jelly creature, or does it walk on two legs like a human. Wherever possible, look at references in real life to help you make you animation look more realistic.

Easing

[edit | edit source]

Easing is used to make an animation seem less static. Easing in means an animation starts slow, then speeds up. Easing out means an animation that starts at a faster rate, then slows down over time.

Spinning

[edit | edit source]

In 3D, you can animate spinning by changing the rotation property. In 2D, it depend if you wanna make it spin around, or simulate rotating in the plane that doesn't exist in 2D. The latter is easier done by changing frames of a Sprite that uses a sprite sheet of a rotating object. Otherwise you can just use the rotation property in an AnimationPlayer or by code.

Animating the environment

[edit | edit source]

Animating water

[edit | edit source]

See your first 3D shader to make a terrain, then read your second 3D shader to turn it into animated water.

See also

[edit | edit source]

https://docs.godotengine.org/en/latest/tutorials/animation/index.html


Guide to the Godot game engine

Getting started [edit]
Installation
What is a node?
Programming
Resources and importing
Signals and methods
Your first game
Making it work
Debugging
Input
Physics
Saving and loading
Multiplayer
Making it look good
UI skinning
Animation
Advanced help
Servers (singletons)
Platform specific
Optimisation
Encryption
Exporting
Plugins
Miscellaneous
Helpful links
Authors and contributors
Print version


<-- previous back to top next -->