mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
anims
This commit is contained in:
parent
14080da693
commit
0c788997a4
@ -3,7 +3,7 @@
|
||||
body: RandomWith("gnarling"),
|
||||
alignment: Alignment(Enemy),
|
||||
loadout: Extended(
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.chieftain_staff")),
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.chieftain")),
|
||||
base_asset: Loadout("common.loadout.dungeon.gnarling.chieftain"),
|
||||
inventory: [],
|
||||
),
|
||||
|
@ -3,7 +3,7 @@
|
||||
body: RandomWith("gnarling"),
|
||||
alignment: Alignment(Enemy),
|
||||
loadout: Extended(
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.axe")),
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.logger")),
|
||||
base_asset: Loadout("common.loadout.dungeon.gnarling.logger"),
|
||||
inventory: [],
|
||||
),
|
||||
|
@ -3,7 +3,7 @@
|
||||
body: RandomWith("gnarling"),
|
||||
alignment: Alignment(Enemy),
|
||||
loadout: Extended(
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.dagger")),
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.mugger")),
|
||||
base_asset: Loadout("common.loadout.dungeon.gnarling.mugger"),
|
||||
inventory: [],
|
||||
),
|
||||
|
@ -3,7 +3,7 @@
|
||||
body: RandomWith("gnarling"),
|
||||
alignment: Alignment(Enemy),
|
||||
loadout: Extended(
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.blowgun")),
|
||||
hands: TwoHanded(Item("common.items.npc_weapons.biped_small.gnarling.stalker")),
|
||||
base_asset: Loadout("common.loadout.dungeon.gnarling.stalker"),
|
||||
inventory: [],
|
||||
),
|
||||
|
@ -37,7 +37,7 @@
|
||||
vox_spec: ("npc.gnarling.chieftain.chest", (-4.5, -3.5, -1.0)),
|
||||
),
|
||||
"Mandragora": (
|
||||
vox_spec: ("npc.mandragora.male.chest", (-11.0, -11.0, -6.5)),
|
||||
vox_spec: ("npc.mandragora.male.chest", (-11.0, -11.0, 0.0)),
|
||||
),
|
||||
"Kappa": (
|
||||
vox_spec: ("npc.kappa.male.chest", (-6.5, -8.0, -7.0)),
|
||||
|
@ -64,7 +64,8 @@ impl Animation for AlphaAnimation {
|
||||
let subtract = global_time - timer;
|
||||
let check = subtract - subtract.trunc();
|
||||
let mirror = (check - 0.5).signum();
|
||||
let _move1 = move1base * pullback * mirror;
|
||||
let move1 = move1base * pullback * mirror;
|
||||
let move2 = move2base * pullback * mirror;
|
||||
let move1abs = move1base * pullback;
|
||||
let move2abs = move2base * pullback;
|
||||
next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
@ -167,7 +168,14 @@ impl Animation for AlphaAnimation {
|
||||
* Quaternion::rotation_y(move1abs * -0.4 + move2abs * 1.0)
|
||||
* Quaternion::rotation_z(-0.3 + move2abs * -2.2);
|
||||
},
|
||||
_ => {},
|
||||
_ => {
|
||||
next.chest.orientation = Quaternion::rotation_x(move2abs * -1.0)
|
||||
* Quaternion::rotation_z(move1 * 1.2 + move2 * -1.8);
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.2);
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(1.2);
|
||||
},
|
||||
}
|
||||
next
|
||||
}
|
||||
|
@ -4,13 +4,15 @@ pub mod dash;
|
||||
pub mod idle;
|
||||
pub mod run;
|
||||
pub mod shoot;
|
||||
pub mod spinmelee;
|
||||
pub mod stunned;
|
||||
pub mod wield;
|
||||
|
||||
// Reexports
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, dash::DashAnimation, idle::IdleAnimation,
|
||||
run::RunAnimation, shoot::ShootAnimation, stunned::StunnedAnimation, wield::WieldAnimation,
|
||||
run::RunAnimation, shoot::ShootAnimation, spinmelee::SpinMeleeAnimation,
|
||||
stunned::StunnedAnimation, wield::WieldAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
@ -141,7 +143,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Sahagin, _) => (0.0, 15.0),
|
||||
(Adlet, _) => (0.0, 11.0),
|
||||
(Gnarling, _) => (0.0, 7.5),
|
||||
(Mandragora, _) => (0.0, 10.5),
|
||||
(Mandragora, _) => (0.0, 4.0),
|
||||
(Kappa, _) => (0.0, 14.5),
|
||||
(Cactid, _) => (0.0, 7.0),
|
||||
(Gnoll, _) => (0.0, 15.5),
|
||||
@ -154,7 +156,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Sahagin, _) => (0.5, -7.0),
|
||||
(Adlet, _) => (0.0, -3.0),
|
||||
(Gnarling, _) => (0.0, -3.0),
|
||||
(Mandragora, _) => (0.0, -6.5),
|
||||
(Mandragora, _) => (0.0, 0.0),
|
||||
(Kappa, _) => (0.0, -3.0),
|
||||
(Cactid, _) => (0.0, -3.0),
|
||||
(Gnoll, _) => (0.5, -7.5),
|
||||
@ -180,7 +182,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Sahagin, _) => (3.5, 3.5, -2.0),
|
||||
(Adlet, _) => (4.5, -0.5, 2.0),
|
||||
(Gnarling, _) => (4.0, 0.0, 1.5),
|
||||
(Mandragora, _) => (4.0, -0.5, -2.5),
|
||||
(Mandragora, _) => (4.0, -0.5, 4.0),
|
||||
(Kappa, _) => (4.0, 3.5, -0.5),
|
||||
(Cactid, _) => (4.0, 0.5, -1.0),
|
||||
(Gnoll, _) => (3.5, 0.5, -1.0),
|
||||
|
91
voxygen/anim/src/biped_small/spinmelee.rs
Normal file
91
voxygen/anim/src/biped_small/spinmelee.rs
Normal file
@ -0,0 +1,91 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
BipedSmallSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct SpinMeleeAnimation;
|
||||
|
||||
type SpinMeleeAnimationDependency = (
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
f32,
|
||||
);
|
||||
|
||||
impl Animation for SpinMeleeAnimation {
|
||||
type Dependency<'a> = SpinMeleeAnimationDependency;
|
||||
type Skeleton = BipedSmallSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_small_spinmelee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_spinmelee")]
|
||||
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(
|
||||
active_tool_kind,
|
||||
velocity,
|
||||
_orientation,
|
||||
_last_ori,
|
||||
global_time,
|
||||
_avg_vel,
|
||||
_acc_vel,
|
||||
stage_section,
|
||||
timer,
|
||||
): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let anim_time = anim_time.min(1.0);
|
||||
let (move1base, tension, move2base, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.sqrt(), (anim_time * 10.0).sin(), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let subtract = global_time - timer;
|
||||
let check = subtract - subtract.trunc();
|
||||
let mirror = (check - 0.5).signum();
|
||||
let tension = tension * pullback;
|
||||
let move1abs = move1base * pullback;
|
||||
let move2abs = move2base * pullback;
|
||||
next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Spear) => {
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(move1abs * -0.2 + move2abs * 0.3)
|
||||
* Quaternion::rotation_z(move1abs * 0.5 + move2abs * -0.6);
|
||||
},
|
||||
_ => {
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(move1abs * 1.0 + move2abs * -1.5 + tension * 0.2);
|
||||
next.pants.orientation = Quaternion::rotation_x(move1abs * -0.5 + move2abs * 0.5);
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(1.2 + move1abs * 1.5 + move2abs * -1.0)
|
||||
* Quaternion::rotation_y(tension * 0.5);
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(1.2 + move1abs * 1.5 + move2abs * -1.0)
|
||||
* Quaternion::rotation_y(tension * -0.5);
|
||||
},
|
||||
}
|
||||
next
|
||||
}
|
||||
}
|
@ -213,7 +213,12 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_y(-0.2 * speednorm)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
},
|
||||
_ => {},
|
||||
_ => {
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.2);
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(1.2);
|
||||
},
|
||||
}
|
||||
|
||||
next
|
||||
|
@ -178,7 +178,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(StoneGolem, _) => (3.5, 0.5, -9.5),
|
||||
(Treant, _) => (3.5, -5.0, -8.5),
|
||||
(ClayGolem, _) => (3.5, -1.0, -8.5),
|
||||
(WoodGolem, _) => (2.5, -1.0, -5.5),
|
||||
(WoodGolem, _) => (2.5, 1.0, -5.5),
|
||||
},
|
||||
scaler: match (body.species, body.body_type) {
|
||||
(StoneGolem, _) => 1.5,
|
||||
|
@ -35,14 +35,17 @@ impl Animation for SpinMeleeAnimation {
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(movement2 * -2.0 * PI) * Quaternion::rotation_x(-0.2);
|
||||
Quaternion::rotation_z(movement1 * 0.5 * PI + movement2 * -2.5 * PI)
|
||||
* Quaternion::rotation_x(-0.2);
|
||||
|
||||
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
|
||||
next.upper_torso.orientation = Quaternion::rotation_z(movement2 * 2.0 * PI);
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + movement1 * -6.0);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_z(movement1 * -0.5 * PI + movement2 * 2.5 * PI);
|
||||
|
||||
next.lower_torso.position =
|
||||
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + movement1 * 5.0);
|
||||
next.lower_torso.orientation = Quaternion::rotation_z(movement2 * -2.0 * PI);
|
||||
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
|
||||
next.lower_torso.orientation =
|
||||
Quaternion::rotation_z(movement1 * 0.5 * PI + movement2 * -2.5 * PI);
|
||||
|
||||
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_l.orientation =
|
||||
@ -58,24 +61,16 @@ impl Animation for SpinMeleeAnimation {
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(movement1 * 0.2 * pullback);
|
||||
|
||||
next.leg_l.position = Vec3::new(
|
||||
-s_a.leg.0 + movement1 * 3.0,
|
||||
s_a.leg.1,
|
||||
s_a.leg.2 + movement1 * 5.0,
|
||||
) * 1.02;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + movement1 * 2.0) * 1.02;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.leg_r.position = Vec3::new(
|
||||
s_a.leg.0 - movement1 * 3.0,
|
||||
s_a.leg.1,
|
||||
s_a.leg.2 + movement1 * 5.0,
|
||||
) * 1.02;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + movement1 * 2.0) * 1.02;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 5.0);
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 4.0);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 5.0);
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 4.0);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
@ -3064,6 +3064,38 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::SpinMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Action => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::biped_small::SpinMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
rel_vel,
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
time,
|
||||
rel_avg_vel,
|
||||
state.acc_vel,
|
||||
Some(s.stage_section),
|
||||
state.state_time,
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::BasicRanged(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
|
||||
|
@ -546,8 +546,6 @@ impl Structure for GnarlingFortification {
|
||||
// Create towers
|
||||
self.wall_towers.iter().for_each(|point| {
|
||||
let wpos = point.xy() + self.origin;
|
||||
let darkwood = Fill::Block(Block::new(BlockKind::Wood, Rgb::new(55, 25, 8)));
|
||||
let darkwood2 = Fill::Block(Block::new(BlockKind::Wood, Rgb::new(71, 33, 11)));
|
||||
|
||||
// Tower base
|
||||
let tower_depth = 3;
|
||||
|
Loading…
Reference in New Issue
Block a user