can use shoot pose

This commit is contained in:
2025-05-10 00:19:58 +02:00
parent 07c4c43b6c
commit 334eacfd1c
8 changed files with 48 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ pub struct CharacterAnimations {
pub idle: AnimationNodeIndex,
pub run: AnimationNodeIndex,
pub jump: AnimationNodeIndex,
pub shooting: Option<AnimationNodeIndex>,
pub graph: Handle<AnimationGraph>,
}
@@ -148,18 +149,29 @@ fn setup_once_loaded(
.map(|(name, animation)| (name.to_string(), animation.clone()))
.collect::<HashMap<_, _>>();
let (graph, node_indices) = AnimationGraph::from_clips([
let mut clips = vec![
animations["idle"].clone(),
animations["run"].clone(),
animations["jump"].clone(),
]);
];
// // Insert a resource with the current scene information
if let Some(shooting_animation) = animations.get("shoot") {
clips.push(shooting_animation.clone());
}
let (graph, node_indices) = AnimationGraph::from_clips(clips);
// Insert a resource with the current scene information
let graph_handle = graphs.add(graph);
let animations = CharacterAnimations {
idle: node_indices[0],
run: node_indices[1],
jump: node_indices[2],
shooting: if node_indices.len() == 4 {
Some(node_indices[3])
} else {
None
},
graph: graph_handle.clone(),
};