small fixes

This commit is contained in:
jshipsey 2020-10-18 01:37:52 -04:00 committed by Robin Gilh
parent 7a62ddfd3f
commit caa048b1d5
14 changed files with 711 additions and 721 deletions

View File

@ -554,7 +554,7 @@
"body": {
"keyword": "biped_large",
"names": [
"Leroy Brown"
"Tobermory"
]
},
"species": {

Binary file not shown.

View File

@ -531,17 +531,15 @@ impl Tool {
},
]
} else if kind == "BeastClaws" {
vec![
BasicMelee {
energy_cost: 0,
buildup_duration: Duration::from_millis(500),
recover_duration: Duration::from_millis(250),
knockback: 25.0,
base_healthchange: -200,
range: 5.0,
max_angle: 120.0,
},
]
vec![BasicMelee {
energy_cost: 0,
buildup_duration: Duration::from_millis(500),
recover_duration: Duration::from_millis(250),
knockback: 25.0,
base_healthchange: -200,
range: 5.0,
max_angle: 120.0,
}]
} else {
vec![BasicMelee {
energy_cost: 0,

View File

@ -79,7 +79,11 @@ impl LoadoutBuilder {
"common.items.npc_weapons.npcweapon.stone_golems_fist",
));
},
_ => {},
golem::Species::Treant => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.npcweapon.stone_golems_fist",
));
},
},
Body::BipedLarge(biped_large) => match (biped_large.species, biped_large.body_type) {
(biped_large::Species::Occultsaurok, _) => {
@ -132,7 +136,6 @@ impl LoadoutBuilder {
"common.items.npc_weapons.sword.dullahan_sword",
));
},
_ => {},
},
Body::Humanoid(_) => {
if is_giant {

View File

@ -39,7 +39,7 @@ impl Body {
Body::Dragon(_) => 250.0,
Body::BirdSmall(_) => 75.0,
Body::FishSmall(_) => 40.0,
Body::BipedLarge(_) => 160.0,
Body::BipedLarge(_) => 75.0,
Body::Object(_) => 40.0,
Body::Golem(_) => 60.0,
Body::Theropod(_) => 135.0,

View File

@ -44,11 +44,7 @@ impl Animation for AlphaAnimation {
.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 accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos();
let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos();
let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos();
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.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())
@ -65,18 +61,14 @@ impl Animation for AlphaAnimation {
/ (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 10.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 10.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())
* ((anim_time as f32 * lab as f32 * 4.0).sin());
let movement = anim_time as f32 * 1.0;
let test = (anim_time as f32 * 1.75).sin();
let slower = (((1.0)
/ (0.05
+ 0.95
* ((anim_time as f32 * lab as f32 * 8.0 - 0.5 * PI).sin()).powf(2.0 as f32)))
/ (0.05
+ 0.95
* ((anim_time as f32 * lab as f32 * 8.0 - 0.5 * PI).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0 - 0.5 * PI).sin())
+ 1.0;
@ -90,7 +82,7 @@ impl Animation for AlphaAnimation {
.round())
/ 10.0;
let switch = if random > 0.5 { 1.0 } else { -1.0 };
let switch = if random > 0.5 { 1.0 } else { -1.0 };
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
@ -283,20 +275,29 @@ impl Animation for AlphaAnimation {
next.torso.scale = Vec3::one() / 8.0 * 1.01;
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-15.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(-0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-PI / 2.0);
next.hand_l.scale = Vec3::one() * 1.08;
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)
* Quaternion::rotation_z(-PI / 2.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(2.0, 0.0, -12.0);
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.orientation =
Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.orientation =
Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.57);
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
@ -314,7 +315,7 @@ impl Animation for AlphaAnimation {
next.upper_torso.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);
* Quaternion::rotation_y(0.0);
next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0);
next.lower_torso.orientation =
@ -366,10 +367,10 @@ impl Animation for AlphaAnimation {
}
next.control.scale = Vec3::one();
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.control.position = Vec3::new(-8.0, 7.0 + slower * 4.0, 1.0 + slower * -9.0);
next.control.orientation = Quaternion::rotation_x(-1.5 + slower * -1.2)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.5);
next.control.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01;
@ -452,8 +453,10 @@ impl Animation for AlphaAnimation {
},
Some(ToolKind::NpcWeapon(_)) => {
if switch > 0.0 {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0)) * Quaternion::rotation_x(-0.2);
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0))
* Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
@ -461,8 +464,8 @@ impl Animation for AlphaAnimation {
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.orientation =
Quaternion::rotation_z((twist * 0.5).min(1.0)) * Quaternion::rotation_x(0.0);
next.upper_torso.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0))
* Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
@ -470,8 +473,8 @@ impl Animation for AlphaAnimation {
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.orientation =
Quaternion::rotation_z((twist * -0.5).max(-1.0)) * Quaternion::rotation_x(0.0);
next.lower_torso.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0))
* Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.hand_r.position = Vec3::new(
@ -483,17 +486,18 @@ impl Animation for AlphaAnimation {
Quaternion::rotation_z(-1.5) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
next.arm_control_r.position = Vec3::new(0.0, 0.0,-4.0);
next.arm_control_r.orientation =
Quaternion::rotation_x(1.0)
next.arm_control_r.position = Vec3::new(0.0, 0.0, -4.0);
next.arm_control_r.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(slow * -1.35)
* Quaternion::rotation_z(-0.0);
next.arm_control_r.scale = Vec3::one() * 1.02;
next.tail.orientation = Quaternion::rotation_z(twist * 0.5);
} else {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0)) * Quaternion::rotation_x(-0.2);
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0))
* Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
@ -501,8 +505,8 @@ impl Animation for AlphaAnimation {
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.orientation =
Quaternion::rotation_z((twist * -0.5).max(-1.0)) * Quaternion::rotation_x(0.0);
next.upper_torso.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0))
* Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
@ -510,13 +514,12 @@ impl Animation for AlphaAnimation {
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.orientation =
Quaternion::rotation_z((twist * 0.5).min(1.0)) * Quaternion::rotation_x(0.0);
next.lower_torso.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0))
* Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.arm_control_l.position = Vec3::new(0.0, 0.0,-4.0);
next.arm_control_l.orientation =
Quaternion::rotation_x(1.0)
next.arm_control_l.position = Vec3::new(0.0, 0.0, -4.0);
next.arm_control_l.orientation = Quaternion::rotation_x(1.0)
* Quaternion::rotation_y(slow * 1.35)
* Quaternion::rotation_z(0.0);
next.arm_control_l.scale = Vec3::one() * 1.02;

View File

@ -2,7 +2,7 @@ use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::comp::item::ToolKind;
use std::{f32::consts::PI, ops::Mul};
pub struct ChargeAnimation;
@ -51,19 +51,6 @@ impl Animation for ChargeAnimation {
* 0.125,
);
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
let foothoril = (((1.0)
/ (0.4
+ (0.6)
@ -110,7 +97,6 @@ impl Animation for ChargeAnimation {
* ((anim_time as f32 * lab as f32 * 20.0).cos());
let short = (anim_time as f32 * lab as f32 * 16.0).sin();
let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin();
let stop = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
let stopa = ((anim_time as f32).powf(0.9 as f32)).min(5.0);
@ -374,7 +360,7 @@ impl Animation for ChargeAnimation {
next.main.position = Vec3::new(8.0, 8.5, 13.2);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_y(PI)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(

View File

@ -183,7 +183,7 @@ impl Animation for IdleAnimation {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
skeleton_attr.foot.2 + torso * -0.6,
);
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
@ -191,7 +191,7 @@ impl Animation for IdleAnimation {
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
skeleton_attr.foot.2 + torso * -0.6,
);
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();

View File

@ -245,8 +245,8 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Slysaurok, _) => (3.0, 0.5, -6.0),
},
foot: match (body.species, body.body_type) {
(Ogre, Male) => (4.0, 2.5, -14.0),
(Ogre, Female) => (4.0, 0.5, -14.0),
(Ogre, Male) => (4.0, 1.0, -13.5),
(Ogre, Female) => (4.0, 0.5, -13.5),
(Cyclops, _) => (4.0, 0.5, -17.0),
(Wendigo, _) => (5.0, 2.5, -17.0),
(Troll, _) => (6.0, 1.5, -13.0),
@ -256,10 +256,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Mightysaurok, _) => (3.5, 2.0, -12.0),
(Slysaurok, _) => (3.5, 2.0, -12.0),
},
beast: match (body.species, body.body_type) {
(Werewolf, _) => (true),
_ => (false),
},
beast: matches!((body.species, body.body_type), (Werewolf, _)),
}
}
}

View File

@ -23,6 +23,8 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let speedavg = Vec2::<f32>::from(avg_vel).magnitude();
*rate = 1.0;
let lab = 0.65; //.65
@ -58,23 +60,6 @@ impl Animation for RunAnimation {
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let foothoril2 = (((1.0)
/ (0.5
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.5).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.5).sin());
let foothorir2 = (((1.0)
/ (0.5
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin());
//let short = (anim_time as f32 * lab as f32 * 16.0).sin();
//let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin();
let amplitude = (speed / 21.0).max(0.25);
let amplitude2 = (speed * 1.4 / 21.0).powf(0.5).max(0.6);
let amplitude3 = (speed / 21.0).powf(0.5).max(0.35);
@ -145,7 +130,7 @@ impl Animation for RunAnimation {
if skeleton_attr.beast {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, 3.0 + skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_x(
look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * -0.18 + 0.6,
look.y * 0.3 + (speedavg * 0.05) + amplitude * short * -0.18,
) * Quaternion::rotation_z(
look.x * 0.3 / ((canceler).max(0.5)) + tilt * -1.2,
) * Quaternion::rotation_y(tilt * 0.8);
@ -296,10 +281,10 @@ impl Animation for RunAnimation {
next.torso.position = Vec3::new(
0.0,
0.0 + (short * 0.75).max(-2.0),
canceler * 2.0 + (short * 0.75).max(-2.0),
speedavg * 0.15 + (short * 0.75).max(-2.0),
) / 8.0;
next.torso.orientation =
Quaternion::rotation_x(x_tilt + amplitude * short * 0.1 + canceler * -0.7);
Quaternion::rotation_x(x_tilt + amplitude * short * 0.1 + speedavg * -0.045);
next.torso.scale = Vec3::one() / 8.0;
next.hold.scale = Vec3::one() * 0.0;

View File

@ -2,7 +2,7 @@ use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::comp::item::ToolKind;
use std::{f32::consts::PI, ops::Mul};
pub struct ShootAnimation;
@ -17,7 +17,7 @@ impl Animation for ShootAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_shoot")]
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, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -373,7 +373,7 @@ impl Animation for ShootAnimation {
next.main.position = Vec3::new(10.0, 12.5, 13.2);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_y(PI)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0);

File diff suppressed because it is too large Load Diff

View File

@ -128,7 +128,7 @@ impl Animation for WieldAnimation {
next.hand_r.orientation =
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, -3.0);
next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
next.control.position = Vec3::new(-7.0, 7.0, 2.0);

View File

@ -2211,8 +2211,8 @@ impl FigureMgr {
let target_base = match (
physics.on_ground,
vel.0.magnitude_squared() > MOVING_THRESHOLD_SQR, // Moving
physics.in_fluid.is_some(), // In water
vel.0.magnitude_squared() > 0.15, // Moving
physics.in_fluid.is_some(), // In water
) {
// Standing
(true, false, false) => anim::biped_large::IdleAnimation::update_skeleton(