mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Define humanoid dimensions as measured in-game
Make Body::dimensions and Body::height methods const Modify humanoid dimensions for calculation of drag
This commit is contained in:
parent
44a73dffe1
commit
84b1e286cb
@ -292,7 +292,7 @@ impl Body {
|
||||
|
||||
/// The width (shoulder to shoulder), length (nose to tail) and height
|
||||
/// respectively
|
||||
pub fn dimensions(&self) -> Vec3<f32> {
|
||||
pub const fn dimensions(&self) -> Vec3<f32> {
|
||||
match self {
|
||||
Body::BipedLarge(body) => match body.species {
|
||||
biped_large::Species::Cyclops => Vec3::new(4.6, 3.0, 6.5),
|
||||
@ -323,22 +323,30 @@ impl Body {
|
||||
Body::FishMedium(_) => Vec3::new(0.5, 2.0, 0.8),
|
||||
Body::FishSmall(_) => Vec3::new(0.3, 1.2, 0.6),
|
||||
Body::Golem(_) => Vec3::new(5.0, 5.0, 7.5),
|
||||
Body::Humanoid(humanoid) => {
|
||||
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(0.7 * scale, 0.4 * scale, 2.15 * scale)
|
||||
Body::Humanoid(humanoid) => match humanoid.species {
|
||||
humanoid::Species::Orc => match humanoid.body_type {
|
||||
humanoid::BodyType::Male => Vec3::new(1.25, 0.7, 2.0),
|
||||
humanoid::BodyType::Female => Vec3::new(1.15, 0.6, 1.8),
|
||||
},
|
||||
|
||||
humanoid::Species::Human => match humanoid.body_type {
|
||||
humanoid::BodyType::Male => Vec3::new(1.1, 0.55, 1.8),
|
||||
humanoid::BodyType::Female => Vec3::new(1.0, 0.55, 1.7),
|
||||
},
|
||||
|
||||
humanoid::Species::Elf => Vec3::new(1.0, 0.6, 1.7),
|
||||
|
||||
humanoid::Species::Dwarf => match humanoid.body_type {
|
||||
humanoid::BodyType::Male => Vec3::new(0.9, 0.55, 1.5),
|
||||
humanoid::BodyType::Female => Vec3::new(0.85, 0.45, 1.4),
|
||||
},
|
||||
|
||||
humanoid::Species::Undead => match humanoid.body_type {
|
||||
humanoid::BodyType::Male => Vec3::new(1.0, 0.5, 1.7),
|
||||
humanoid::BodyType::Female => Vec3::new(0.95, 0.5, 1.65),
|
||||
},
|
||||
|
||||
humanoid::Species::Danari => Vec3::new(0.75, 0.65, 1.25),
|
||||
},
|
||||
Body::Object(object) => object.dimensions(),
|
||||
Body::QuadrupedMedium(body) => match body.species {
|
||||
@ -400,7 +408,7 @@ impl Body {
|
||||
dim.x.max(dim.y) / 2.0
|
||||
}
|
||||
|
||||
pub fn height(&self) -> f32 { self.dimensions().z }
|
||||
pub const fn height(&self) -> f32 { self.dimensions().z }
|
||||
|
||||
pub fn base_energy(&self) -> u32 {
|
||||
match self {
|
||||
|
@ -366,7 +366,7 @@ impl Body {
|
||||
Mass(m)
|
||||
}
|
||||
|
||||
pub fn dimensions(&self) -> Vec3<f32> {
|
||||
pub const fn dimensions(&self) -> Vec3<f32> {
|
||||
match self {
|
||||
Body::Arrow | Body::ArrowSnake | Body::MultiArrow | Body::ArrowTurret => {
|
||||
Vec3::new(0.01, 0.8, 0.01)
|
||||
@ -375,9 +375,9 @@ impl Body {
|
||||
Body::Crossbow => Vec3::new(3.0, 3.0, 1.5),
|
||||
Body::HaniwaSentry => Vec3::new(0.8, 0.8, 1.4),
|
||||
Body::SeaLantern => Vec3::new(0.5, 0.5, 1.0),
|
||||
Body::Snowball => Vec3::broadcast(2.5),
|
||||
Body::Snowball => Vec3::new(2.5, 2.5, 2.5),
|
||||
Body::Tornado => Vec3::new(2.0, 2.0, 3.4),
|
||||
_ => Vec3::broadcast(0.5),
|
||||
_ => Vec3::new(0.5, 0.5, 0.5),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dimensions(&self) -> Vec3<f32> {
|
||||
pub const fn dimensions(&self) -> Vec3<f32> {
|
||||
match self {
|
||||
Body::DefaultAirship => Vec3::new(25.0, 50.0, 40.0),
|
||||
Body::AirBalloon => Vec3::new(25.0, 50.0, 40.0),
|
||||
|
@ -214,13 +214,15 @@ impl Body {
|
||||
/// Skin friction is the drag arising from the shear forces between a fluid
|
||||
/// and a surface, while pressure drag is due to flow separation. Both are
|
||||
/// viscous effects.
|
||||
///
|
||||
/// This coefficient includes the reference area.
|
||||
fn parasite_drag_coefficient(&self) -> f32 {
|
||||
// Reference area and drag coefficient assumes best-case scenario of the
|
||||
// orientation producing least amount of drag
|
||||
match self {
|
||||
// Cross-section, head/feet first
|
||||
Body::BipedLarge(_) | Body::BipedSmall(_) | Body::Golem(_) | Body::Humanoid(_) => {
|
||||
let dim = self.dimensions().xy().map(|a| a * 0.5);
|
||||
let dim = self.dimensions().xy().map(|a| 0.7 * a * 0.5);
|
||||
const CD: f32 = 0.7;
|
||||
CD * PI * dim.x * dim.y
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user