{"id":16078163,"url":"https://github.com/lucarickler/bevy-simple-state-machine","last_synced_at":"2025-03-17T17:30:26.214Z","repository":{"id":57747171,"uuid":"521982513","full_name":"LucaRickler/bevy-simple-state-machine","owner":"LucaRickler","description":"Rudimentary animation state machine system for Bevy Engine","archived":false,"fork":false,"pushed_at":"2024-02-17T21:43:38.000Z","size":87,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T09:51:22.614Z","etag":null,"topics":["bevy-plugin","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucaRickler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-06T15:24:41.000Z","updated_at":"2025-02-06T00:59:07.000Z","dependencies_parsed_at":"2024-10-27T15:37:50.287Z","dependency_job_id":"0f994e02-4a1b-43cb-99da-1dc462c4d564","html_url":"https://github.com/LucaRickler/bevy-simple-state-machine","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"e8260a9d08996bdf5011ba9054e51576a571b373"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickler%2Fbevy-simple-state-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickler%2Fbevy-simple-state-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickler%2Fbevy-simple-state-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaRickler%2Fbevy-simple-state-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucaRickler","download_url":"https://codeload.github.com/LucaRickler/bevy-simple-state-machine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244077852,"owners_count":20394354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bevy-plugin","rust"],"created_at":"2024-10-09T10:08:17.659Z","updated_at":"2025-03-17T17:30:25.932Z","avatar_url":"https://github.com/LucaRickler.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bevy Simple State Machine\n\n[![Crates.io](https://img.shields.io/crates/v/bevy-simple-state-machine)](https://crates.io/crates/bevy-simple-state-machine)\n[![docs](https://docs.rs/bevy-simple-state-machine/badge.svg)](https://docs.rs/bevy-simple-state-machine/)\n[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](./LICENSE)\n\nPlugin for the [Bevy Engine](https://bevyengine.org) which implements\na rudimentary animation state machine system.\n\nTo use this, you have to add the `SimpleStateMachinePlugin` to you app:\n\n```rust\nApp::new()\n    .add_plugins(DefaultPlugins)\n    .add_plugins(SimpleStateMachinePlugin::new());\n```\n\nAnd then insert an `AnimationStateMachine` component on your entities:\n\n```rust\nfn setup(mut commands: Commands) {\n    let starting_state = \"idle\";\n    let my_states_map = HashMap::from([\n        (\"idle\".to_string(), AnimationState{\n            name: \"idle\".to_string(),\n            clip: idle_clip_handle,\n            interruptible: true,\n        }),\n        (\"run\".to_string(), AnimationState{\n            name: \"run\".to_string(),\n            clip: run_clip_handle,\n            interruptible: true,\n        }),\n    ]);\n    let my_states_transitions_vec = vec![\n        StateMachineTransition::immediate(\n            AnimationStateRef::from_string(\"idle\"),\n            AnimationStateRef::from_string(\"run\"),\n            StateMachineTrigger::from(|vars| vars[\"run\"].is_bool(true)),\n        ),\n    ];\n    let state_machine_vars = HashMap::from([\n        (\"run\".to_string(), StateMachineVariableType::Bool(false)),    \n    ]);\n     \n    commands.spawn_bundle(SpatialBundle::default())\n        .insert(AnimationPlayer::default())\n        .insert(AnimationStateMachine::new(\n            starting_state,\n            my_states_map,\n            my_states_transitions_vec,\n            state_machine_vars,\n        ));\n}\n```\n\nAnd then you can control it changing the values of the state machine variables\n \n```rust\nstate_machine.update_variable(\"run\", StateMachineVariableType::Bool(true));\n```\n\n## Currently supported features:\n\n - Custom transition conditions\n - Transitions from wildcard state AnyState\n - Events emitted on transition end\n - Internal state machine variables\n\nCurrently, transitions end on the same frame they are triggered.\n\n---\n## Bevy Compatibility:\n\n| Bevy Version | Plugin Version       |\n|--------------|----------------------|\n| `0.13`       | `main`               |\n| `0.13`       | `0.6.0`              |\n| `0.12`       | `0.5.0`              |\n| `0.11`       | `0.4.0`              |\n| `0.10`       | `0.3.0`              |\n| `0.9`        | `0.2.0`              |\n| `0.8`        | `0.1.0`              |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucarickler%2Fbevy-simple-state-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucarickler%2Fbevy-simple-state-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucarickler%2Fbevy-simple-state-machine/lists"}