mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make Body::dimensions method a const fn
This commit is contained in:
parent
545d04544a
commit
8ba6399c9b
@ -293,7 +293,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),
|
||||
@ -398,7 +398,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 collider_shape(&self) -> Collider {
|
||||
Collider::Box {
|
||||
|
@ -341,7 +341,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)
|
||||
@ -349,7 +349,7 @@ impl Body {
|
||||
Body::BoltFire => Vec3::new(0.1, 0.1, 0.1),
|
||||
Body::Crossbow => Vec3::new(3.0, 3.0, 1.5),
|
||||
Body::HaniwaSentry => Vec3::new(0.8, 0.8, 1.4),
|
||||
_ => Vec3::broadcast(0.5),
|
||||
_ => Vec3::new(0.5, 0.5, 0.5),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dimensions(&self) -> Vec3<f32> { Vec3::new(25.0, 50.0, 40.0) }
|
||||
pub const fn dimensions(&self) -> Vec3<f32> { Vec3::new(25.0, 50.0, 40.0) }
|
||||
|
||||
fn balloon_vol(&self) -> f32 {
|
||||
let spheroid_vol = |equat_d: f32, polar_d: f32| -> f32 {
|
||||
|
Loading…
Reference in New Issue
Block a user