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.
This commit is contained in:
Treeco 2021-05-02 21:49:33 +01:00
parent 607f8b289b
commit c19fa4c975
4 changed files with 34 additions and 34 deletions

View File

@ -192,23 +192,19 @@ impl Body {
Body::FishMedium(_) => 2.5, Body::FishMedium(_) => 2.5,
Body::FishSmall(_) => 1.0, Body::FishSmall(_) => 1.0,
Body::Golem(_) => 10_000.0, Body::Golem(_) => 10_000.0,
Body::Humanoid(humanoid) => { Body::Humanoid(humanoid) => match (humanoid.species, humanoid.body_type) {
// humanoids are quite a bit larger than in real life, so we multiply their mass (humanoid::Species::Orc, humanoid::BodyType::Male) => 99.0,
// to scale it up proportionally (remember cube law) (humanoid::Species::Orc, humanoid::BodyType::Female) => 68.0,
1.0 * match (humanoid.species, humanoid.body_type) { (humanoid::Species::Human, humanoid::BodyType::Male) => 70.0,
(humanoid::Species::Orc, humanoid::BodyType::Male) => 120.0, (humanoid::Species::Human, humanoid::BodyType::Female) => 56.0,
(humanoid::Species::Orc, humanoid::BodyType::Female) => 120.0, (humanoid::Species::Elf, humanoid::BodyType::Male) => 73.0,
(humanoid::Species::Human, humanoid::BodyType::Male) => 77.0, // ~✅ (humanoid::Species::Elf, humanoid::BodyType::Female) => 56.0,
(humanoid::Species::Human, humanoid::BodyType::Female) => 59.0, // ~✅ (humanoid::Species::Dwarf, humanoid::BodyType::Male) => 40.0,
(humanoid::Species::Elf, humanoid::BodyType::Male) => 77.0, (humanoid::Species::Dwarf, humanoid::BodyType::Female) => 30.0,
(humanoid::Species::Elf, humanoid::BodyType::Female) => 59.0, (humanoid::Species::Undead, humanoid::BodyType::Male) => 63.0,
(humanoid::Species::Dwarf, humanoid::BodyType::Male) => 70.0, (humanoid::Species::Undead, humanoid::BodyType::Female) => 48.0,
(humanoid::Species::Dwarf, humanoid::BodyType::Female) => 70.0, (humanoid::Species::Danari, humanoid::BodyType::Male) => 23.0,
(humanoid::Species::Undead, humanoid::BodyType::Male) => 70.0, (humanoid::Species::Danari, humanoid::BodyType::Female) => 22.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::Object(obj) => obj.mass().0, Body::Object(obj) => obj.mass().0,
Body::QuadrupedLow(body) => match body.species { Body::QuadrupedLow(body) => match body.species {
@ -290,21 +286,21 @@ impl Body {
Body::FishSmall(_) => Vec3::new(0.3, 1.2, 0.6), Body::FishSmall(_) => Vec3::new(0.3, 1.2, 0.6),
Body::Golem(_) => Vec3::new(5.0, 5.0, 7.5), Body::Golem(_) => Vec3::new(5.0, 5.0, 7.5),
Body::Humanoid(humanoid) => { Body::Humanoid(humanoid) => {
let height = match (humanoid.species, humanoid.body_type) { let scale = match (humanoid.species, humanoid.body_type) {
(humanoid::Species::Orc, humanoid::BodyType::Male) => 2.3, (humanoid::Species::Orc, humanoid::BodyType::Male) => 0.91,
(humanoid::Species::Orc, humanoid::BodyType::Female) => 2.2, (humanoid::Species::Orc, humanoid::BodyType::Female) => 0.81,
(humanoid::Species::Human, humanoid::BodyType::Male) => 2.3, (humanoid::Species::Human, humanoid::BodyType::Male) => 0.81,
(humanoid::Species::Human, humanoid::BodyType::Female) => 2.2, (humanoid::Species::Human, humanoid::BodyType::Female) => 0.76,
(humanoid::Species::Elf, humanoid::BodyType::Male) => 2.3, (humanoid::Species::Elf, humanoid::BodyType::Male) => 0.82,
(humanoid::Species::Elf, humanoid::BodyType::Female) => 2.2, (humanoid::Species::Elf, humanoid::BodyType::Female) => 0.76,
(humanoid::Species::Dwarf, humanoid::BodyType::Male) => 1.9, (humanoid::Species::Dwarf, humanoid::BodyType::Male) => 0.67,
(humanoid::Species::Dwarf, humanoid::BodyType::Female) => 1.8, (humanoid::Species::Dwarf, humanoid::BodyType::Female) => 0.62,
(humanoid::Species::Undead, humanoid::BodyType::Male) => 2.2, (humanoid::Species::Undead, humanoid::BodyType::Male) => 0.78,
(humanoid::Species::Undead, humanoid::BodyType::Female) => 2.1, (humanoid::Species::Undead, humanoid::BodyType::Female) => 0.72,
(humanoid::Species::Danari, humanoid::BodyType::Male) => 1.5, (humanoid::Species::Danari, humanoid::BodyType::Male) => 0.56,
(humanoid::Species::Danari, humanoid::BodyType::Female) => 1.4, (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::Object(object) => object.dimensions(),
Body::QuadrupedMedium(body) => match body.species { Body::QuadrupedMedium(body) => match body.species {

View File

@ -2,7 +2,7 @@
pub const MAX_PICKUP_RANGE: f32 = 8.0; pub const MAX_PICKUP_RANGE: f32 = 8.0;
pub const MAX_MOUNT_RANGE: f32 = 14.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; 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 // Values for air taken from http://www-mdp.eng.cam.ac.uk/web/library/enginfo/aerothermal_dvd_only/aero/atmos/atmos.html

View File

@ -21,7 +21,11 @@ impl CharacterBehavior for Data {
// If not on the ground while wielding glider enter gliding state // If not on the ground while wielding glider enter gliding state
if !data.physics.on_ground { 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 if data
.physics .physics

View File

@ -169,7 +169,7 @@ impl Body {
Body::FishMedium(_) => Some(50.0 * self.mass().0), Body::FishMedium(_) => Some(50.0 * self.mass().0),
Body::FishSmall(_) => Some(50.0 * self.mass().0), Body::FishSmall(_) => Some(50.0 * self.mass().0),
Body::Dragon(_) => Some(200.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 { Body::Theropod(body) => match body.species {
theropod::Species::Sandraptor theropod::Species::Sandraptor
| theropod::Species::Snowraptor | theropod::Species::Snowraptor