mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
spin anim
This commit is contained in:
parent
133e79ffd5
commit
8070a38a89
@ -184,13 +184,13 @@ impl Tool {
|
||||
is_interruptible: true,
|
||||
},
|
||||
SpinMelee {
|
||||
buildup_duration: Duration::from_millis(150),
|
||||
buildup_duration: Duration::from_millis(1000),
|
||||
swing_duration: Duration::from_millis(500),
|
||||
recover_duration: Duration::from_millis(150),
|
||||
recover_duration: Duration::from_millis(100),
|
||||
base_damage: (100.0 * self.base_power()) as u32,
|
||||
knockback: 0.0,
|
||||
range: 3.5,
|
||||
energy_cost: 200,
|
||||
energy_cost: 0,
|
||||
is_infinite: false,
|
||||
is_helicopter: false,
|
||||
forward_speed: 1.0,
|
||||
|
@ -57,7 +57,6 @@ impl CharacterBehavior for Data {
|
||||
update.vel.0 = Vec3::new(data.inputs.move_dir.x, data.inputs.move_dir.y, 0.0) * 5.0;
|
||||
} else {
|
||||
handle_orientation(data, &mut update, 1.0);
|
||||
forward_move(data, &mut update, 0.1, self.static_data.forward_speed);
|
||||
}
|
||||
|
||||
if self.stage_section == StageSection::Buildup
|
||||
@ -103,6 +102,8 @@ impl CharacterBehavior for Data {
|
||||
} else if self.stage_section == StageSection::Swing
|
||||
&& self.timer < self.static_data.swing_duration
|
||||
{
|
||||
forward_move(data, &mut update, 0.1, self.static_data.forward_speed);
|
||||
|
||||
// Swings
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
static_data: self.static_data,
|
||||
|
@ -53,6 +53,7 @@ impl Animation for SpinMeleeAnimation {
|
||||
} else {
|
||||
lab as f32 * anim_time as f32 * 0.9
|
||||
};
|
||||
let movement = anim_time as f32 * 1.0;
|
||||
|
||||
//feet
|
||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||
@ -60,11 +61,89 @@ impl Animation for SpinMeleeAnimation {
|
||||
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Sword(_)) => {
|
||||
next.l_hand.position = Vec3::new(-0.75, -1.0, 2.5);
|
||||
next.l_hand.orientation =
|
||||
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.position = Vec3::new(0.75, -1.5, -0.5);
|
||||
next.r_hand.orientation =
|
||||
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.main.orientation = Quaternion::rotation_x(-0.1)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.head.position =
|
||||
Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
|
||||
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {},
|
||||
StageSection::Swing => {},
|
||||
StageSection::Recover => {},
|
||||
StageSection::Buildup => {
|
||||
next.control.position =
|
||||
Vec3::new(-7.0, 7.0 + movement * -8.0, 2.0 + movement * -6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(movement * -0.5)
|
||||
* Quaternion::rotation_y(movement * 0.3)
|
||||
* Quaternion::rotation_z(movement * -1.5);
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0 + movement * -1.0,
|
||||
skeleton_attr.chest.1 + movement * -2.5,
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement * -1.1)
|
||||
* Quaternion::rotation_z(movement * -0.35);
|
||||
next.belt.orientation = Quaternion::rotation_z(movement * 0.35);
|
||||
next.shorts.orientation = Quaternion::rotation_z(movement * 0.5);
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head.0 - 2.0 + movement * -6.0,
|
||||
skeleton_attr.head.1 + movement * -4.0,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_x(movement * 0.9)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(movement * 0.05);
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + movement * 4.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(movement * 0.2);
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + movement * -12.0,
|
||||
skeleton_attr.foot.2 + movement * 1.0 + quick * 1.0,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(movement * -1.0)
|
||||
* Quaternion::rotation_z(movement * -0.8);
|
||||
},
|
||||
StageSection::Swing => {
|
||||
next.head.position =
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(movement * PI * 2.0);
|
||||
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_y(0.3);
|
||||
next.head.position =
|
||||
Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2);
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.head.position =
|
||||
Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1);
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-PI / 2.0 + movement * PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0 + movement * PI / 2.0);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15 + movement * 0.15);
|
||||
next.chest.orientation = Quaternion::rotation_y(0.3 + movement * -0.3)
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
@ -124,51 +203,55 @@ impl Animation for SpinMeleeAnimation {
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
if velocity.z.abs() > 0.1 {
|
||||
next.l_foot.position =
|
||||
Vec3::new(-skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.position =
|
||||
Vec3::new(skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(1.0);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
} else if speed < 0.5 {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
2.0 + quick * -6.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.position =
|
||||
Vec3::new(skeleton_attr.foot.0, 4.0, skeleton_attr.foot.2);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
|
||||
* Quaternion::rotation_y(-0.4);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
} else {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
2.0 + quick * -6.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
2.0 + quick * 6.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
};
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
if velocity.z.abs() > 0.1 {
|
||||
next.l_foot.position =
|
||||
Vec3::new(-skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.position = Vec3::new(skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(1.0);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
} else if speed < 0.5 {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
2.0 + quick * -6.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(0.5 + slowersmooth * 0.2) * Quaternion::rotation_z(0.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.position = Vec3::new(skeleton_attr.foot.0, 4.0, skeleton_attr.foot.2);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(0.5 - slowersmooth * 0.2) * Quaternion::rotation_y(-0.4);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
} else {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
2.0 + quick * -6.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(0.5 + slowersmooth * 0.2) * Quaternion::rotation_z(0.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
2.0 + quick * 6.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(0.5 - slowersmooth * 0.2) * Quaternion::rotation_z(0.0);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
};
|
||||
next.lantern.position = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
|
Loading…
Reference in New Issue
Block a user