#animation #graph #bevy #game-engine #editor #gamedev

app bevy_animation_graph_editor

Animation graph editor for the Bevy game engine

2 unstable releases

0.3.0 Mar 17, 2024
0.2.0 Feb 1, 2024

#652 in Game dev

Download history 5/week @ 2024-02-01 6/week @ 2024-02-15 12/week @ 2024-02-22 3/week @ 2024-02-29 126/week @ 2024-03-14 18/week @ 2024-03-21 39/week @ 2024-03-28 16/week @ 2024-04-04

199 downloads per month

MIT/Apache

425KB
10K SLoC

Crates.io Crates.io Crates.io Crates.io CI

Bevy Animation Graph

Motivation

Animation graphs are an essential tool for managing the complexity present in the animation pipelines for modern 3D games. When your game has tens of animations with complex blends and transitions, or you want to generate your animations procedurally from very few keyframes, simple animation clip playback is not enough.

This library aims to fill this gap in the Bevy ecosystem.

Current Features

  • Animation graphs are assets. They can be loaded from asset files, or created in code with an ergonomic API.
  • Visual graph editor.
  • Available nodes:
    • Animation chaining (i.e. play one node after another).
    • Two-bone inverse kinematics.
    • Looping.
    • Linear Blending (in bone space).
    • Mirror animation about the YZ plane.
    • Animation clip playback.
    • Apply a given rotation to some bones in a pose using a bone mask.
    • Arithmetic nodes:
      • F32: Add, Subtract, Multiply, Divide, Clamp.
      • Vec3: Rotation arc.
    • Speed up or slow down animation playback.
    • Animation graph node.
  • Nesting animation graphs as nodes within other graphs.
  • Export animation graphs in graphviz .dot format for visualization.
  • Output from graph nodes is cached to avoid unnecessary computations.
  • Support for custom nodes written in Rust (with the caveat that custom nodes cannot be serialized/deserialized as assets).

Planned Features

Being worked on:

  1. Finite state machines.
  2. Synchronization tracks.

Wishlist:

  1. Ragdoll and physics integration (inititally bevy_xpbd, possibly rapier later):
    1. Using a bone mask to specify which bones are kinematically driven, and which bones are simulated (i.e. ragdolled)
    2. Pose matching with joint motors (pending on joint motors being implemented in bevy_xpbd, currently WIP)
  2. FABRIK node (?).

Installation

This project is divided in two crates:

  • bevy_animation_graph is the library part of this project. This should be added as a dependency to your project in order to use animation graphs. To install the latest published version from crates.io run

    cargo add bevy_animation_graph
    

    or manually add the latest version to your Cargo.toml.

    To install the latest git master, add the following to Cargo.toml

    # ...
    [dependencies]
    # ...
    bevy_animation_graph = { git = "https://github.com/mbrea-c/bevy_animation_graph.git" }
    # ...
    
  • bevy_animation_graph_editor is the editor. You can install like you would install any other rust binary:

    # for the latest crates.io version
    cargo install bevy_animation_graph_editor
    # for the latest master
    cargo install --git https://github.com/mbrea-c/bevy_animation_graph bevy_animation_graph_editor
    # for the version from a local workspace
    cargo install --path <PATH_TO_WORKSPACE> bevy_animation_graph_editor
    
    # use the --force flag to force reinstall
    

Version table

bevy bevy_animation_graph bevy_animation_graph_editor
0.13 0.3 0.3
0.12 0.2 0.2

Usage and examples

The documentation in docs.rs contains an introduction of the library and editor and an explanation of a simple animation graph example. See also the video below for a demonstration of editor usage.

The complete example is also included in the examples/fox/ package.

A more complex example is included in the examples/human_ik/ package.

Screenshots

Locomotion graph example

Editor usage demonstration video

In YouTube:

Demo

Contributing or getting help

If you run into a bug or want to discuss potential new features, feel free to post an issue, open a PR or reach out to me in Discord (@mbreac in the Bevy discord, there's a crate-help post for bevy_animation_graph there: link).

FAQ

Is this ready for production?

Depends.

It can already be useful for small-ish projects, but I cannot guarantee API stability between different 0.x versions (it is a big library, it is relatively young and I don't have previous experience with animation programming, so I'm still figuring out the best ways of doing things). This means that it will likely be necessary to go into your animation graph assets and manually migrate them between versions, at least until I find a better way to handle migrations.

Additionally, there may will be bugs and other issues. I try to get them fixed as they come up.

Will you implement feature X?

If it's a small feature (e.g. some additional vector or floating point arithmetic node) it's likely that I have just not got around to it. If you open an issue I will probably implement it quickly. PRs are also welcome.

For larger features, it's better to start by opening an issue for discussion or pinging me in the Bevy discord.

Acknowledgements

Many thanks to Bobby Anguelov for his lectures on animation programming.

Dependencies

~45–85MB
~1.5M SLoC