mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'james/axe-hammer-keyframes' into 'master'
James/axe hammer keyframes See merge request veloren/veloren!1497
This commit is contained in:
commit
a8ac051f33
@ -193,7 +193,7 @@
|
||||
color: None
|
||||
),
|
||||
"common.items.weapons.axe.orc_axe-0": (
|
||||
vox_spec: ("weapon.axe.2haxe_orc-0", (-1.5, -3.0, -4.5)),
|
||||
vox_spec: ("weapon.axe.2haxe_orc-0", (-1.5, -6.0, -4.5)),
|
||||
color: None
|
||||
),
|
||||
"common.items.weapons.axe.worn_iron_axe-0": (
|
||||
|
@ -76,6 +76,7 @@ pub enum CharacterAbility {
|
||||
projectile_light: Option<LightEmitter>,
|
||||
projectile_gravity: Option<Gravity>,
|
||||
projectile_speed: f32,
|
||||
can_continue: bool,
|
||||
},
|
||||
RepeaterRanged {
|
||||
energy_cost: u32,
|
||||
@ -409,6 +410,7 @@ impl From<(&CharacterAbility, AbilityKey)> for CharacterState {
|
||||
projectile_light,
|
||||
projectile_gravity,
|
||||
projectile_speed,
|
||||
can_continue,
|
||||
energy_cost: _,
|
||||
} => CharacterState::BasicRanged(basic_ranged::Data {
|
||||
static_data: basic_ranged::StaticData {
|
||||
@ -419,11 +421,13 @@ impl From<(&CharacterAbility, AbilityKey)> for CharacterState {
|
||||
projectile_light: *projectile_light,
|
||||
projectile_gravity: *projectile_gravity,
|
||||
projectile_speed: *projectile_speed,
|
||||
can_continue: *can_continue,
|
||||
ability_key: key,
|
||||
},
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
continue_next: false,
|
||||
}),
|
||||
CharacterAbility::Boost {
|
||||
movement_duration,
|
||||
|
@ -175,15 +175,41 @@ impl Tool {
|
||||
},
|
||||
],
|
||||
Axe => vec![
|
||||
BasicMelee {
|
||||
energy_cost: 0,
|
||||
buildup_duration: Duration::from_millis(600),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_damage: (120.0 * self.base_power()) as u32,
|
||||
knockback: 0.0,
|
||||
range: 3.5,
|
||||
max_angle: 20.0,
|
||||
ComboMelee {
|
||||
stage_data: vec![
|
||||
combo_melee::Stage {
|
||||
stage: 1,
|
||||
base_damage: (90.0 * self.base_power()) as u32,
|
||||
max_damage: (110.0 * self.base_power()) as u32,
|
||||
damage_increase: (10.0 * self.base_power()) as u32,
|
||||
knockback: 8.0,
|
||||
range: 3.5,
|
||||
angle: 50.0,
|
||||
base_buildup_duration: Duration::from_millis(350),
|
||||
base_swing_duration: Duration::from_millis(75),
|
||||
base_recover_duration: Duration::from_millis(400),
|
||||
forward_movement: 0.5,
|
||||
},
|
||||
combo_melee::Stage {
|
||||
stage: 2,
|
||||
base_damage: (130.0 * self.base_power()) as u32,
|
||||
max_damage: (160.0 * self.base_power()) as u32,
|
||||
damage_increase: (15.0 * self.base_power()) as u32,
|
||||
knockback: 12.0,
|
||||
range: 3.5,
|
||||
angle: 30.0,
|
||||
base_buildup_duration: Duration::from_millis(500),
|
||||
base_swing_duration: Duration::from_millis(100),
|
||||
base_recover_duration: Duration::from_millis(500),
|
||||
forward_movement: 0.25,
|
||||
},
|
||||
],
|
||||
initial_energy_gain: 0,
|
||||
max_energy_gain: 100,
|
||||
energy_increase: 20,
|
||||
speed_increase: 0.05,
|
||||
max_speed_increase: 1.6,
|
||||
is_interruptible: false,
|
||||
},
|
||||
SpinMelee {
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
@ -214,15 +240,26 @@ impl Tool {
|
||||
},
|
||||
],
|
||||
Hammer => vec![
|
||||
BasicMelee {
|
||||
energy_cost: 0,
|
||||
buildup_duration: Duration::from_millis(600),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_damage: (120.0 * self.base_power()) as u32,
|
||||
knockback: 0.0,
|
||||
range: 3.5,
|
||||
max_angle: 20.0,
|
||||
ComboMelee {
|
||||
stage_data: vec![combo_melee::Stage {
|
||||
stage: 1,
|
||||
base_damage: (120.0 * self.base_power()) as u32,
|
||||
max_damage: (150.0 * self.base_power()) as u32,
|
||||
damage_increase: (10.0 * self.base_power()) as u32,
|
||||
knockback: 0.0,
|
||||
range: 3.5,
|
||||
angle: 20.0,
|
||||
base_buildup_duration: Duration::from_millis(600),
|
||||
base_swing_duration: Duration::from_millis(60),
|
||||
base_recover_duration: Duration::from_millis(300),
|
||||
forward_movement: 0.0,
|
||||
}],
|
||||
initial_energy_gain: 0,
|
||||
max_energy_gain: 100,
|
||||
energy_increase: 20,
|
||||
speed_increase: 0.05,
|
||||
max_speed_increase: 1.4,
|
||||
is_interruptible: false,
|
||||
},
|
||||
ChargedMelee {
|
||||
energy_cost: 1,
|
||||
@ -264,8 +301,8 @@ impl Tool {
|
||||
Bow => vec![
|
||||
BasicRanged {
|
||||
energy_cost: 0,
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(400),
|
||||
buildup_duration: Duration::from_millis(200),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
projectile: Projectile {
|
||||
hit_solid: vec![projectile::Effect::Stick],
|
||||
hit_entity: vec![
|
||||
@ -297,6 +334,7 @@ impl Tool {
|
||||
projectile_light: None,
|
||||
projectile_gravity: Some(Gravity(0.2)),
|
||||
projectile_speed: 100.0,
|
||||
can_continue: true,
|
||||
},
|
||||
ChargedRanged {
|
||||
energy_cost: 0,
|
||||
@ -441,6 +479,7 @@ impl Tool {
|
||||
}),
|
||||
projectile_gravity: Some(Gravity(0.5)),
|
||||
projectile_speed: 40.0,
|
||||
can_continue: false,
|
||||
},
|
||||
],
|
||||
Staff => vec![
|
||||
@ -488,6 +527,7 @@ impl Tool {
|
||||
}),
|
||||
projectile_gravity: Some(Gravity(0.3)),
|
||||
projectile_speed: 60.0,
|
||||
can_continue: true,
|
||||
},
|
||||
BasicBeam {
|
||||
buildup_duration: Duration::from_millis(250),
|
||||
@ -594,6 +634,7 @@ impl Tool {
|
||||
}),
|
||||
projectile_gravity: None,
|
||||
projectile_speed: 100.0,
|
||||
can_continue: false,
|
||||
},
|
||||
],
|
||||
Empty => vec![BasicMelee {
|
||||
|
@ -22,6 +22,8 @@ pub struct StaticData {
|
||||
pub projectile_speed: f32,
|
||||
/// What key is used to press ability
|
||||
pub ability_key: AbilityKey,
|
||||
/// Whether or not the ability can auto continue
|
||||
pub can_continue: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@ -35,6 +37,9 @@ pub struct Data {
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the attack fired already
|
||||
pub exhausted: bool,
|
||||
/// If in buildup, whether the attack has continued form previous attack; if
|
||||
/// in recover, whether the attack will continue to a new attack
|
||||
pub continue_next: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -84,18 +89,41 @@ impl CharacterBehavior for Data {
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
exhausted: true,
|
||||
continue_next: false,
|
||||
..*self
|
||||
});
|
||||
} else if self.timer < self.static_data.recover_duration {
|
||||
// Recovers
|
||||
if ability_key_is_pressed(data, self.static_data.ability_key) {
|
||||
// Recovers
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
continue_next: self.static_data.can_continue,
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
// Recovers
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
}
|
||||
} else if self.continue_next {
|
||||
// Restarts character state
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
..*self
|
||||
});
|
||||
})
|
||||
} else {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
|
@ -98,6 +98,10 @@ impl CharacterBehavior for Data {
|
||||
}
|
||||
}
|
||||
|
||||
let speed_modifer = 1.0
|
||||
+ self.static_data.max_speed_increase
|
||||
* (1.0 - self.static_data.speed_increase.powi(self.combo as i32));
|
||||
|
||||
match self.stage_section {
|
||||
StageSection::Buildup => {
|
||||
if self.timer < self.static_data.stage_data[stage_index].base_buildup_duration {
|
||||
@ -106,12 +110,7 @@ impl CharacterBehavior for Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
(1.0 + self.static_data.max_speed_increase
|
||||
* (1.0
|
||||
- self.static_data.speed_increase.powi(self.combo as i32)))
|
||||
* data.dt.0,
|
||||
))
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
@ -162,12 +161,7 @@ impl CharacterBehavior for Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
(1.0 + self.static_data.max_speed_increase
|
||||
* (1.0
|
||||
- self.static_data.speed_increase.powi(self.combo as i32)))
|
||||
* data.dt.0,
|
||||
))
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
@ -190,15 +184,7 @@ impl CharacterBehavior for Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
(1.0 + self.static_data.max_speed_increase
|
||||
* (1.0
|
||||
- self
|
||||
.static_data
|
||||
.speed_increase
|
||||
.powi(self.combo as i32)))
|
||||
* data.dt.0,
|
||||
))
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
next_stage: true,
|
||||
..*self
|
||||
@ -208,15 +194,7 @@ impl CharacterBehavior for Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
(1.0 + self.static_data.max_speed_increase
|
||||
* (1.0
|
||||
- self
|
||||
.static_data
|
||||
.speed_increase
|
||||
.powi(self.combo as i32)))
|
||||
* data.dt.0,
|
||||
))
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
|
@ -47,16 +47,11 @@ impl Animation for AlphaAnimation {
|
||||
* ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin());
|
||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||
let push = anim_time as f32 * lab as f32 * 4.0;
|
||||
let slow = (((5.0)
|
||||
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 9.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 9.0).sin());
|
||||
let axe = (((1.0)
|
||||
/ (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let slower = (((1.0)
|
||||
/ (0.0001 + 0.999 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
@ -103,64 +98,94 @@ impl Animation for AlphaAnimation {
|
||||
* Quaternion::rotation_z(1.4 + slow * -0.5);
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.2);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(0.2 + axe * 0.2);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_z(0.2 + axe * -0.1);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
|
||||
next.shorts.orientation = Quaternion::rotation_z(0.2 + axe * -0.2);
|
||||
|
||||
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
|
||||
|
||||
next.control.position = Vec3::new(2.0 + axe * -7.0, 11.0, 3.0);
|
||||
next.control.orientation = Quaternion::rotation_x(1.6)
|
||||
* Quaternion::rotation_y(-2.0 + axe * 0.5)
|
||||
* Quaternion::rotation_z(PI * 0.4);
|
||||
next.lantern.orientation = Quaternion::rotation_x(0.4);
|
||||
next.head.position = Vec3::new(
|
||||
0. + movement2 * 2.0,
|
||||
s_a.head.0 + movement2 * 2.0,
|
||||
s_a.head.1,
|
||||
);
|
||||
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
next.control.position = Vec3::new(
|
||||
s_a.ac.0 + movement1 * -1.0 + movement2 * -2.0 + movement3 * 0.0,
|
||||
s_a.ac.1 + movement1 * -3.0 + movement2 * 3.0 + movement3 * -3.5,
|
||||
s_a.ac.2 + movement1 * 6.0 + movement2 * -15.0 + movement3 * -2.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(
|
||||
s_a.ac.3 + movement1 * 0.0 + movement2 * -3.0 + movement3 * 0.4,
|
||||
) * Quaternion::rotation_y(
|
||||
s_a.ac.4 + movement1 * -0.0 + movement2 * -0.6 + movement3 * 0.8,
|
||||
) * Quaternion::rotation_z(
|
||||
s_a.ac.5 + movement1 * -2.0 + movement2 * -1.0 + movement3 * 2.5,
|
||||
);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_x(
|
||||
0.0 + movement1 * 0.6 + movement2 * -0.6 + movement3 * 0.4,
|
||||
) * Quaternion::rotation_y(
|
||||
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
|
||||
) * Quaternion::rotation_z(
|
||||
0.0 + movement1 * 1.5 + movement2 * -2.5 + movement3 * 1.5,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(
|
||||
0.0 + movement1 * -1.5 + movement2 * 2.5 + movement3 * -1.0,
|
||||
);
|
||||
},
|
||||
Some(ToolKind::Hammer) => {
|
||||
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
|
||||
next.hand_r.position = Vec3::new(3.0, 0.0, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_z(slower * 0.03)
|
||||
* Quaternion::rotation_x(slowersmooth * 0.1)
|
||||
* Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06)
|
||||
* Quaternion::rotation_z((slowersmooth * -0.4).max(0.0));
|
||||
next.control.position = Vec3::new(
|
||||
s_a.hc.0 + (movement1 * -13.0) * (1.0 - movement3),
|
||||
s_a.hc.1 + (movement2 * 5.0) * (1.0 - movement3),
|
||||
s_a.hc.2,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.hc.3 + (movement1 * 1.5 + movement2 * -2.5))
|
||||
* (1.0 - movement3)
|
||||
* Quaternion::rotation_y(s_a.hc.4 + (movement1 * 1.57))
|
||||
* (1.0 - movement3)
|
||||
* Quaternion::rotation_z(s_a.hc.5 + (movement2 * -0.5) * (1.0 - movement3));
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(
|
||||
(movement1 * 0.3 + movement2 * -0.5) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(
|
||||
(movement1 * 0.2 + movement2 * -0.5) * (1.0 - movement3),
|
||||
);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_z(slower * 0.18 + slowersmooth * 0.15)
|
||||
* Quaternion::rotation_x(0.0 + slower * 0.18 + slowersmooth * 0.15)
|
||||
* Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15);
|
||||
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_z(slower * -0.1 + slowersmooth * -0.075)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.1)
|
||||
* Quaternion::rotation_y(slower * -0.1);
|
||||
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_z(slower * -0.1 + slowersmooth * -0.075)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.1)
|
||||
* Quaternion::rotation_y(slower * -0.1);
|
||||
|
||||
next.lantern.orientation = Quaternion::rotation_x(slower * -0.7 + 0.4)
|
||||
* Quaternion::rotation_y(slower * 0.4);
|
||||
next.chest.orientation = Quaternion::rotation_x(
|
||||
(movement1 * 0.8 + movement2 * -1.2) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_y(
|
||||
(movement1 * 0.3 + movement2 * -0.4) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_z(
|
||||
(movement1 * 0.5 + movement2 * -0.5) * (1.0 - movement3),
|
||||
);
|
||||
|
||||
if velocity > 0.5 {
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * -6.0, s_a.foot.2);
|
||||
@ -180,12 +205,12 @@ impl Animation for AlphaAnimation {
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - slower * 2.0, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1)
|
||||
* Quaternion::rotation_z((slower * 0.5).max(0.0));
|
||||
}
|
||||
|
||||
next.control.position = Vec3::new(-8.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-1.5 + slower * 1.5)
|
||||
* Quaternion::rotation_y(slowersmooth * 0.35 - 0.3)
|
||||
* Quaternion::rotation_z(1.4 + slowersmooth * 0.2);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(movement1 * -0.2 + movement2 * 0.2);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(movement1 * -0.3 + movement2 * 0.3);
|
||||
}
|
||||
},
|
||||
Some(ToolKind::Debug) => {
|
||||
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
||||
|
@ -260,13 +260,13 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(_, _) => (-7.0, 7.0, 2.0, -0.1, 0.0, 0.0),
|
||||
},
|
||||
hhl: match (body.species, body.body_type) {
|
||||
(_, _) => (-0.5, -1.0, 10.0, 1.57, 0.0, 0.0),
|
||||
(_, _) => (-0.5, -1.0, 10.0, 4.71, 0.0, 0.0),
|
||||
},
|
||||
hhr: match (body.species, body.body_type) {
|
||||
(_, _) => (0.0, 0.0, 0.0, 1.57, 0.0, 0.0),
|
||||
(_, _) => (0.0, 0.0, 0.0, 4.71, 0.0, 0.0),
|
||||
},
|
||||
hc: match (body.species, body.body_type) {
|
||||
(_, _) => (6.0, 7.0, 1.0, -0.3, -1.57, 0.5),
|
||||
(_, _) => (6.0, 7.0, 1.0, -0.3, -1.57, 3.64),
|
||||
},
|
||||
sthl: match (body.species, body.body_type) {
|
||||
(_, _) => (0.0, 0.0, 1.0, 1.27, 0.0, 0.0),
|
||||
|
@ -136,7 +136,7 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
|
||||
next.back.orientation =
|
||||
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
|
||||
Quaternion::rotation_x(-0.05 + short * 0.02 + noisea * 0.02 + noiseb * 0.02);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 + s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2)
|
||||
|
@ -2,12 +2,22 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::comp::item::ToolKind;
|
||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct ShootAnimation;
|
||||
|
||||
type ShootAnimationDependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
impl Animation for ShootAnimation {
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
|
||||
type Dependency = ShootAnimationDependency;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -17,45 +27,48 @@ impl Animation for ShootAnimation {
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _second_tool_kind, velocity, _global_time): Self::Dependency,
|
||||
(
|
||||
active_tool_kind,
|
||||
_second_tool_kind,
|
||||
velocity,
|
||||
orientation,
|
||||
last_ori,
|
||||
_global_time,
|
||||
stage_section,
|
||||
): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
let foot = (((5.0)
|
||||
/ (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let foote = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
|
||||
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(exp * -0.4)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(exp * 0.1);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0 - exp * 1.5, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_z(0.4 + exp * 1.0)
|
||||
* Quaternion::rotation_x(0.0 + exp * 0.2)
|
||||
* Quaternion::rotation_y(exp * -0.08);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0 + exp * 1.0, s_a.belt.1);
|
||||
next.belt.orientation = next.chest.orientation * -0.1;
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + exp * 1.0, s_a.shorts.1);
|
||||
next.shorts.orientation = next.chest.orientation * -0.08;
|
||||
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||
.map(|o| o.magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let xmove = (movement1 as f32 * 6.0 * lab as f32 + PI).sin();
|
||||
let ymove = (movement1 as f32 * 6.0 * lab as f32 + PI * (0.5)).sin();
|
||||
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
|
||||
|
||||
@ -66,65 +79,98 @@ impl Animation for ShootAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_y(0.0);
|
||||
|
||||
next.control.position =
|
||||
Vec3::new(s_a.stc.0, s_a.stc.1 + exp * 5.0, s_a.stc.2 - exp * 5.0);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + exp * 0.4)
|
||||
* Quaternion::rotation_y(s_a.stc.4)
|
||||
* Quaternion::rotation_z(s_a.stc.5 + exp * 1.5);
|
||||
next.control.position = Vec3::new(
|
||||
s_a.stc.0 + (xmove * 3.0 + movement1 * -4.0) * (1.0 - movement3),
|
||||
s_a.stc.1 + (2.0 + ymove * 3.0 + movement2 * 3.0) * (1.0 - movement3),
|
||||
s_a.stc.2,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.stc.3 + (movement2 * 0.6) * (1.0 - movement3))
|
||||
* Quaternion::rotation_y(s_a.stc.4 + (movement1 * 0.5 + movement2 * -0.5))
|
||||
* Quaternion::rotation_z(
|
||||
s_a.stc.5
|
||||
- (0.2 + movement1 * -0.5 + movement2 * 0.8) * (1.0 - movement3),
|
||||
);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_z((movement1 * 0.3 + movement2 * 0.2) * (1.0 - movement3));
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(
|
||||
tilt * -2.5 + (movement1 * -0.2 + movement2 * -0.4) * (1.0 - movement3),
|
||||
);
|
||||
|
||||
if speed < 0.5 {
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(0.07) * Quaternion::rotation_z(0.0);
|
||||
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.08) * Quaternion::rotation_z(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(-0.5);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 3.0, s_a.foot.2);
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(0.5) * Quaternion::rotation_z(0.3);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
next.hand_l.position = Vec3::new(
|
||||
s_a.bhl.0 - exp * 2.0,
|
||||
s_a.bhl.1 - exp * 4.0,
|
||||
s_a.bhl.2 + exp * 6.0,
|
||||
);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3)
|
||||
* Quaternion::rotation_y(s_a.bhl.4 + exp * 0.8)
|
||||
* Quaternion::rotation_z(s_a.bhl.5 + exp * 0.9);
|
||||
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhl.3)
|
||||
* Quaternion::rotation_y(s_a.bhr.4)
|
||||
* Quaternion::rotation_z(s_a.bhr.5);
|
||||
let (_movement1, movement2, _movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_l.position = Vec3::new(
|
||||
s_a.bhl.0 + movement2 * -2.0,
|
||||
s_a.bhl.1 + movement2 * -6.0,
|
||||
s_a.bhl.2 + movement2 * -3.0,
|
||||
);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
|
||||
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||
|
||||
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, 4.0 + s_a.bc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + exp * 0.4);
|
||||
next.hold.position = Vec3::new(0.0, -1.0 + movement2 * 2.0, -5.2 + movement2 * 7.0);
|
||||
next.hold.orientation = Quaternion::rotation_x(-1.57);
|
||||
next.hold.scale = Vec3::one() * 1.0 * (1.0 - movement2);
|
||||
|
||||
next.control.position = Vec3::new(s_a.bc.0 + 11.0, s_a.bc.1 + 2.0, s_a.bc.2 + 8.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.0 + (movement2 as f32 * 0.1).sin())
|
||||
* Quaternion::rotation_y(s_a.bc.4 - 1.25)
|
||||
* Quaternion::rotation_z(s_a.bc.5 - 0.2 + (movement2 as f32 * -0.2).sin());
|
||||
next.chest.orientation = Quaternion::rotation_z(0.8);
|
||||
next.head.position = Vec3::new(0.0 - 2.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(tilt * -2.5 - 0.5 + (movement2 as f32 * 0.2).sin());
|
||||
if speed < 0.5 {
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_z(0.8 + (movement2 as f32 * 0.1).sin());
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(0.07)
|
||||
* Quaternion::rotation_z((movement2 as f32 * -0.1).sin());
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.08)
|
||||
* Quaternion::rotation_z((movement2 as f32 * -0.15).sin());
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(-0.5);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 3.0, s_a.foot.2);
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(0.5) * Quaternion::rotation_z(0.3);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
if velocity > 0.5 {
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 - foot * 1.0 + exp * -1.0,
|
||||
foote * 0.8 + exp * 1.5,
|
||||
s_a.foot.2,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(exp * 0.5)
|
||||
* Quaternion::rotation_z(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.15);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0 + foot * 1.0 + exp * 1.0,
|
||||
foote * -0.8 + exp * -1.0,
|
||||
s_a.foot.2,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(exp * -0.5)
|
||||
* Quaternion::rotation_z(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.torso.orientation = Quaternion::rotation_x(-0.15);
|
||||
} else {
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + exp * 2.5);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - exp * 2.0, s_a.foot.2);
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
|
||||
}
|
||||
next.back.orientation = Quaternion::rotation_x(-0.3);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(exp * -0.7 + 0.4) * Quaternion::rotation_y(exp * 0.4);
|
||||
next.lantern.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -5,15 +5,13 @@ use super::{
|
||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
}
|
||||
pub struct SpinAnimation;
|
||||
|
||||
impl Animation for SpinAnimation {
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
@ -25,7 +23,7 @@ impl Animation for SpinAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_spin")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency,
|
||||
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -34,7 +32,6 @@ impl Animation for SpinAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(1.8), 0.0),
|
||||
@ -54,90 +51,178 @@ impl Animation for SpinAnimation {
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
if let Some(ToolKind::Sword) = active_tool_kind {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Sword) => {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
|
||||
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.sc.0 + movement1 * 2.0 + movement2 * -4.0 + movement3 * -7.0,
|
||||
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement3 * -10.0,
|
||||
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
|
||||
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)
|
||||
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57);
|
||||
next.head.position = Vec3::new(
|
||||
0.0 + 2.0 + movement2 * -2.0,
|
||||
2.0 + movement2 * -2.0 + s_a.head.0,
|
||||
s_a.head.1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(movement2 * -0.4);
|
||||
next.control.position = Vec3::new(
|
||||
s_a.sc.0 + movement1 * 2.0 + movement2 * -4.0 + movement3 * -7.0,
|
||||
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement3 * -10.0,
|
||||
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
|
||||
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)
|
||||
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57);
|
||||
next.head.position = Vec3::new(
|
||||
0.0 + 2.0 + movement2 * -2.0,
|
||||
2.0 + movement2 * -2.0 + s_a.head.0,
|
||||
s_a.head.1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(movement2 * -0.4);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15)
|
||||
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
|
||||
* Quaternion::rotation_z(
|
||||
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
|
||||
next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15)
|
||||
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
|
||||
* Quaternion::rotation_z(
|
||||
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
|
||||
);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
|
||||
* Quaternion::rotation_z(movement2.sin() * 0.5);
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1)
|
||||
* Quaternion::rotation_z(movement2.sin() * 1.5);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
|
||||
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
|
||||
|
||||
next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28);
|
||||
},
|
||||
|
||||
Some(ToolKind::Axe) => {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
|
||||
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.ac.0 + (-3.0 + movement1 * 0.0 + movement2 * -2.0) * (1.0 - movement3),
|
||||
s_a.ac.1 + (-3.5 + movement1 * -4.6 + movement2 * 5.0) * (1.0 - movement3),
|
||||
s_a.ac.2 + (-11.0 + movement1 * 10.0 + movement2 * -4.0) * (1.0 - movement3),
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(
|
||||
s_a.ac.3 + (-2.6 + movement1 * 0.0 + movement2 * -0.6) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_y(
|
||||
s_a.ac.4 + (0.2 + movement1 * -0.5 + movement2 * 0.0) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_z(
|
||||
s_a.ac.5 + (-0.5 + movement1 * -3.0 + movement2 * 0.5) * (1.0 - movement3),
|
||||
);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x((0.4 + movement2 * -0.5) * (1.0 - movement3))
|
||||
* Quaternion::rotation_y(
|
||||
(0.0 + movement1 * -0.1 + movement2 * 0.0) * (1.0 - movement3),
|
||||
)
|
||||
* Quaternion::rotation_z(
|
||||
(0.5 + movement1 * -0.6 + movement2 * 0.6) * (1.0 - movement3),
|
||||
);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(movement1 * -0.2 + movement2 * 0.2);
|
||||
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.0 + movement1 * -0.2 + movement2 * 0.2);
|
||||
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_y(0.0 + movement1 * 0.0 + movement3 * -0.0)
|
||||
* Quaternion::rotation_z(
|
||||
(1.0 + movement1 * -0.5 + movement2 * 0.0) * (1.0 - movement3),
|
||||
);
|
||||
next.torso.position = Vec3::new(
|
||||
0.0,
|
||||
0.0,
|
||||
(-1.0
|
||||
+ 1.0 * (movement1 * 0.5 * PI).sin()
|
||||
+ 1.0 * (movement2 * 0.5 * PI + 0.5 * PI).sin())
|
||||
* (1.0 - movement3),
|
||||
);
|
||||
next.torso.orientation = Quaternion::rotation_z(
|
||||
movement1.powf(2.0) * -6.0 + movement2 * -1.7 + movement3 * 1.4,
|
||||
);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
|
||||
* Quaternion::rotation_z(movement2.sin() * 0.5);
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 + (movement1 * -1.0 + movement2 * -3.0) * (1.0 - movement3),
|
||||
s_a.foot.1,
|
||||
s_a.foot.2 + (movement2 * 6.0) * (1.0 - movement3),
|
||||
);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x((movement1 * 0.2 + movement2 * 0.5) * (1.0 - movement3))
|
||||
* Quaternion::rotation_y((movement2 * 0.5) * (1.0 - movement3));
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1)
|
||||
* Quaternion::rotation_z(movement2.sin() * 1.5);
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0,
|
||||
s_a.foot.1 + (movement1 * -2.0 + movement2 * -3.0) * (1.0 - movement3),
|
||||
s_a.foot.2,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(
|
||||
(movement1 * -0.5 + movement2 * -0.5) * (1.0 - movement3),
|
||||
);
|
||||
},
|
||||
|
||||
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
|
||||
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
|
||||
Some(ToolKind::Hammer) => {
|
||||
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(0.0, 6.0, -1.0);
|
||||
next.main.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28);
|
||||
next.control.position = Vec3::new(-4.5 + spinhalf * 4.0, 11.0, 8.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-1.7)
|
||||
* Quaternion::rotation_y(0.2 + spin * -2.0)
|
||||
* Quaternion::rotation_z(1.4 + spin * 0.1);
|
||||
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0 + spin * -0.8, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
|
||||
* Quaternion::rotation_x(0.0 + spin * -0.1)
|
||||
* Quaternion::rotation_y(spin * -0.2);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_z(spin * 0.1)
|
||||
* Quaternion::rotation_x(0.0 + spin * 0.1)
|
||||
* Quaternion::rotation_y(decel * -0.2);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
|
||||
next.belt.orientation = next.chest.orientation * -0.1;
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
|
||||
next.belt.orientation = next.chest.orientation * -0.08;
|
||||
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3));
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * 1.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(foot * -1.2);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, foot * -1.0, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
if let Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Dagger) = active_tool_kind {
|
||||
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(0.0, 6.0, -1.0);
|
||||
next.main.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
next.control.position = Vec3::new(-4.5 + spinhalf * 4.0, 11.0, 8.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-1.7)
|
||||
* Quaternion::rotation_y(0.2 + spin * -2.0)
|
||||
* Quaternion::rotation_z(1.4 + spin * 0.1);
|
||||
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0 + spin * -0.8, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
|
||||
* Quaternion::rotation_x(0.0 + spin * -0.1)
|
||||
* Quaternion::rotation_y(spin * -0.2);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_z(spin * 0.1)
|
||||
* Quaternion::rotation_x(0.0 + spin * 0.1)
|
||||
* Quaternion::rotation_y(decel * -0.2);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
|
||||
next.belt.orientation = next.chest.orientation * -0.1;
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
|
||||
next.belt.orientation = next.chest.orientation * -0.08;
|
||||
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3));
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * 1.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(foot * -1.2);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, foot * -1.0, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,8 @@ impl Animation for SpinMeleeAnimation {
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2);
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, s_a.head.1 + 1.0);
|
||||
|
||||
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(PI);
|
||||
|
@ -825,31 +825,65 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::BasicRanged(data) => {
|
||||
if data.exhausted {
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
} else {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
}
|
||||
CharacterState::ChargedRanged(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f64()
|
||||
},
|
||||
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::BasicRanged(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f64()
|
||||
},
|
||||
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::ChargedMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
@ -881,32 +915,6 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::ChargedRanged(data) => {
|
||||
if data.exhausted {
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
} else {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
}
|
||||
},
|
||||
CharacterState::RepeaterRanged(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
|
||||
@ -1167,6 +1175,7 @@ impl FigureMgr {
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user