Module dotrix::animation [−][src]
Animation components and systems
Enabling animation
To add skeletal animation support to your game you only need to add a skeletal_animation
system using crate::Dotrix
builder.
use dotrix_core::{ Dotrix, ecs::System, systems::skeletal_animation, }; fn main() { Dotrix::application("My Game") .with_system(System::from(skeletal_animation)) .run() }
Spawning animated models
Animated entities can be added to the World
using crate::components::Model
component
with configured crate::assets::Skin
and Animator
component constructed with
Animation
asset.
use dotrix_core::{ ecs::Mut, components::{ Model, Animator }, services::{ Assets, World } }; fn my_system(mut world: Mut<World>, mut assets: Mut<Assets>) { assets.import("assets/MyFile.gltf"); let mesh = assets.register("MyFile::model::mesh"); let skin = assets.register("MyFile::model::skin"); let texture = assets.register("MyFile::model::texture"); let animation = assets.register("MyFile::animation"); world.spawn(Some(( Model { mesh, texture, skin, ..Default::default() }, Animator::looped(animation), ))); }
Structs
Animator | Component to control model animation |
Enums
State | Animation playback state |
Functions
skeletal_animation | System handling skeletal animation |