use sitting animation by default when sprite mounted

This commit is contained in:
Isse 2023-04-25 09:48:16 +02:00
parent 192356f6c5
commit 78dc394c48
3 changed files with 29 additions and 4 deletions

View File

@ -50,7 +50,7 @@
), ),
custom_indices: { custom_indices: {
1: Air(ChairSingle, 4), 1: Air(Helm),
}, },
), ),
SailBoat: ( SailBoat: (

View File

@ -482,7 +482,7 @@ impl SpriteKind {
#[inline] #[inline]
pub fn mount_offset(&self) -> Option<(Vec3<f32>, Vec3<f32>)> { pub fn mount_offset(&self) -> Option<(Vec3<f32>, Vec3<f32>)> {
match self { match self {
SpriteKind::ChairSingle | SpriteKind::ChairDouble => Some(( SpriteKind::ChairSingle | SpriteKind::ChairDouble | SpriteKind::Bench => Some((
Vec3 { Vec3 {
x: 0.0, x: 0.0,
y: 0.0, y: 0.0,

View File

@ -47,7 +47,7 @@ use common::{
mounting::{Rider, VolumeRider}, mounting::{Rider, VolumeRider},
resources::{DeltaTime, Time}, resources::{DeltaTime, Time},
states::{equipping, idle, utils::StageSection, wielding}, states::{equipping, idle, utils::StageSection, wielding},
terrain::{Block, TerrainChunk, TerrainGrid}, terrain::{Block, TerrainChunk, TerrainGrid, SpriteKind},
uid::UidAllocator, uid::UidAllocator,
util::Dir, util::Dir,
vol::{ReadVol, RectRasterableVol}, vol::{ReadVol, RectRasterableVol},
@ -2170,7 +2170,32 @@ impl FigureMgr {
skeleton_attr, skeleton_attr,
) )
}, },
_ => target_base, _ => {
if let Some(sprite) = is_volume_rider.and_then(|is_volume_rider| is_volume_rider.block.get_sprite()) {
match sprite {
SpriteKind::Helm => {
anim::character::DanceAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
_ => {
anim::character::SitAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
}
} else {
target_base
}
}
}; };
state.skeleton = Lerp::lerp(&state.skeleton, &target_bones, dt_lerp); state.skeleton = Lerp::lerp(&state.skeleton, &target_bones, dt_lerp);