Character body with running animation (#3)

* Add alien rig as child, what could go wrong

* Add running animation
This commit is contained in:
GitGhillie
2025-03-06 22:12:16 +01:00
committed by GitHub
parent 8e7d63725e
commit e50d3009ca
3 changed files with 10 additions and 0 deletions

Binary file not shown.

View File

@@ -21,6 +21,7 @@ fn setup(
) { ) {
// Build the animation graph // Build the animation graph
let (graph, node_indices) = AnimationGraph::from_clips([ let (graph, node_indices) = AnimationGraph::from_clips([
asset_server.load(GltfAssetLabel::Animation(2).from_asset(ALIEN_ASSET_PATH)),
asset_server.load(GltfAssetLabel::Animation(1).from_asset(ALIEN_ASSET_PATH)), asset_server.load(GltfAssetLabel::Animation(1).from_asset(ALIEN_ASSET_PATH)),
asset_server.load(GltfAssetLabel::Animation(0).from_asset(ALIEN_ASSET_PATH)), asset_server.load(GltfAssetLabel::Animation(0).from_asset(ALIEN_ASSET_PATH)),
]); ]);

View File

@@ -1,4 +1,5 @@
use crate::{ use crate::{
alien::ALIEN_ASSET_PATH,
camera::GameCameraRig, camera::GameCameraRig,
cash::{Cash, CashCollectEvent}, cash::{Cash, CashCollectEvent},
tb_entities::SpawnPoint, tb_entities::SpawnPoint,
@@ -64,9 +65,17 @@ fn spawn(
TnuaAvian3dSensorShape(Collider::cylinder(1.0, 0.0)), TnuaAvian3dSensorShape(Collider::cylinder(1.0, 0.0)),
)) ))
.with_child(( .with_child((
Name::from("head"),
Transform::from_translation(Vec3::new(0., 1.0, 0.)) Transform::from_translation(Vec3::new(0., 1.0, 0.))
.with_rotation(Quat::from_rotation_y(std::f32::consts::PI)), .with_rotation(Quat::from_rotation_y(std::f32::consts::PI)),
SceneRoot(mesh), SceneRoot(mesh),
))
.with_child((
Name::from("body rig"),
Transform::from_translation(Vec3::new(0., -1., 0.))
.with_rotation(Quat::from_rotation_y(std::f32::consts::PI))
.with_scale(Vec3::splat(1.5)),
SceneRoot(asset_server.load(GltfAssetLabel::Scene(0).from_asset(ALIEN_ASSET_PATH))),
)); ));
commands.spawn(AudioPlayer::new( commands.spawn(AudioPlayer::new(