From c19fa4c97596373c5cada26488e6cc661a03c9a5 Mon Sep 17 00:00:00 2001 From: Treeco <5021038-Treeco@users.noreply.gitlab.com> Date: Sun, 2 May 2021 21:49:33 +0100 Subject: [PATCH] Vastly improve glide ratios and soaring capability Character masses and dimensions have been vastly changed. This is necessary to limit drag - they were practically sails previously. Character proportions are now closer to those of IRL humans than to their voxel models. This may screw up entity collision, in which case body dimensions for aerodynamics and for everything else may need to be separated. Gliders now scale with character size, with a wingspan 3x their height and a chord 1x/3. Gliding is also now very very fast under 2.5g, but much tamer under Earth gravity. This may need dealing with. --- common/src/comp/body.rs | 58 +++++++++++++++----------------- common/src/consts.rs | 2 +- common/src/states/glide_wield.rs | 6 +++- common/src/states/utils.rs | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 21411bd035..e18ebfefe3 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -192,23 +192,19 @@ impl Body { Body::FishMedium(_) => 2.5, Body::FishSmall(_) => 1.0, Body::Golem(_) => 10_000.0, - Body::Humanoid(humanoid) => { - // humanoids are quite a bit larger than in real life, so we multiply their mass - // to scale it up proportionally (remember cube law) - 1.0 * match (humanoid.species, humanoid.body_type) { - (humanoid::Species::Orc, humanoid::BodyType::Male) => 120.0, - (humanoid::Species::Orc, humanoid::BodyType::Female) => 120.0, - (humanoid::Species::Human, humanoid::BodyType::Male) => 77.0, // ~✅ - (humanoid::Species::Human, humanoid::BodyType::Female) => 59.0, // ~✅ - (humanoid::Species::Elf, humanoid::BodyType::Male) => 77.0, - (humanoid::Species::Elf, humanoid::BodyType::Female) => 59.0, - (humanoid::Species::Dwarf, humanoid::BodyType::Male) => 70.0, - (humanoid::Species::Dwarf, humanoid::BodyType::Female) => 70.0, - (humanoid::Species::Undead, humanoid::BodyType::Male) => 70.0, - (humanoid::Species::Undead, humanoid::BodyType::Female) => 50.0, - (humanoid::Species::Danari, humanoid::BodyType::Male) => 80.0, - (humanoid::Species::Danari, humanoid::BodyType::Female) => 60.0, - } + Body::Humanoid(humanoid) => match (humanoid.species, humanoid.body_type) { + (humanoid::Species::Orc, humanoid::BodyType::Male) => 99.0, + (humanoid::Species::Orc, humanoid::BodyType::Female) => 68.0, + (humanoid::Species::Human, humanoid::BodyType::Male) => 70.0, + (humanoid::Species::Human, humanoid::BodyType::Female) => 56.0, + (humanoid::Species::Elf, humanoid::BodyType::Male) => 73.0, + (humanoid::Species::Elf, humanoid::BodyType::Female) => 56.0, + (humanoid::Species::Dwarf, humanoid::BodyType::Male) => 40.0, + (humanoid::Species::Dwarf, humanoid::BodyType::Female) => 30.0, + (humanoid::Species::Undead, humanoid::BodyType::Male) => 63.0, + (humanoid::Species::Undead, humanoid::BodyType::Female) => 48.0, + (humanoid::Species::Danari, humanoid::BodyType::Male) => 23.0, + (humanoid::Species::Danari, humanoid::BodyType::Female) => 22.0, }, Body::Object(obj) => obj.mass().0, Body::QuadrupedLow(body) => match body.species { @@ -290,21 +286,21 @@ impl Body { Body::FishSmall(_) => Vec3::new(0.3, 1.2, 0.6), Body::Golem(_) => Vec3::new(5.0, 5.0, 7.5), Body::Humanoid(humanoid) => { - let height = match (humanoid.species, humanoid.body_type) { - (humanoid::Species::Orc, humanoid::BodyType::Male) => 2.3, - (humanoid::Species::Orc, humanoid::BodyType::Female) => 2.2, - (humanoid::Species::Human, humanoid::BodyType::Male) => 2.3, - (humanoid::Species::Human, humanoid::BodyType::Female) => 2.2, - (humanoid::Species::Elf, humanoid::BodyType::Male) => 2.3, - (humanoid::Species::Elf, humanoid::BodyType::Female) => 2.2, - (humanoid::Species::Dwarf, humanoid::BodyType::Male) => 1.9, - (humanoid::Species::Dwarf, humanoid::BodyType::Female) => 1.8, - (humanoid::Species::Undead, humanoid::BodyType::Male) => 2.2, - (humanoid::Species::Undead, humanoid::BodyType::Female) => 2.1, - (humanoid::Species::Danari, humanoid::BodyType::Male) => 1.5, - (humanoid::Species::Danari, humanoid::BodyType::Female) => 1.4, + let scale = match (humanoid.species, humanoid.body_type) { + (humanoid::Species::Orc, humanoid::BodyType::Male) => 0.91, + (humanoid::Species::Orc, humanoid::BodyType::Female) => 0.81, + (humanoid::Species::Human, humanoid::BodyType::Male) => 0.81, + (humanoid::Species::Human, humanoid::BodyType::Female) => 0.76, + (humanoid::Species::Elf, humanoid::BodyType::Male) => 0.82, + (humanoid::Species::Elf, humanoid::BodyType::Female) => 0.76, + (humanoid::Species::Dwarf, humanoid::BodyType::Male) => 0.67, + (humanoid::Species::Dwarf, humanoid::BodyType::Female) => 0.62, + (humanoid::Species::Undead, humanoid::BodyType::Male) => 0.78, + (humanoid::Species::Undead, humanoid::BodyType::Female) => 0.72, + (humanoid::Species::Danari, humanoid::BodyType::Male) => 0.56, + (humanoid::Species::Danari, humanoid::BodyType::Female) => 0.56, }; - Vec3::new(1.5, 0.5, height) + Vec3::new(0.7 * scale, 0.4 * scale, 2.15 * scale) }, Body::Object(object) => object.dimensions(), Body::QuadrupedMedium(body) => match body.species { diff --git a/common/src/consts.rs b/common/src/consts.rs index f030d9742a..5bbe38e7cf 100644 --- a/common/src/consts.rs +++ b/common/src/consts.rs @@ -2,7 +2,7 @@ pub const MAX_PICKUP_RANGE: f32 = 8.0; pub const MAX_MOUNT_RANGE: f32 = 14.0; -pub const GRAVITY: f32 = 25.0; +pub const GRAVITY: f32 = 9.8; pub const FRIC_GROUND: f32 = 0.15; // Values for air taken from http://www-mdp.eng.cam.ac.uk/web/library/enginfo/aerothermal_dvd_only/aero/atmos/atmos.html diff --git a/common/src/states/glide_wield.rs b/common/src/states/glide_wield.rs index 23c0b9b807..56d2001cf6 100644 --- a/common/src/states/glide_wield.rs +++ b/common/src/states/glide_wield.rs @@ -21,7 +21,11 @@ impl CharacterBehavior for Data { // If not on the ground while wielding glider enter gliding state if !data.physics.on_ground { - update.character = CharacterState::Glide(glide::Data::new(10.0, 0.6, *data.ori)); + update.character = CharacterState::Glide(glide::Data::new( + data.body.dimensions().z * 3.0, + data.body.dimensions().z / 3.0, + *data.ori, + )); } if data .physics diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 1547bc9838..4be7645b37 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -169,7 +169,7 @@ impl Body { Body::FishMedium(_) => Some(50.0 * self.mass().0), Body::FishSmall(_) => Some(50.0 * self.mass().0), Body::Dragon(_) => Some(200.0 * self.mass().0), - Body::Humanoid(_) => Some(200.0 * self.mass().0), + Body::Humanoid(_) => Some(100.0 * self.mass().0), Body::Theropod(body) => match body.species { theropod::Species::Sandraptor | theropod::Species::Snowraptor