mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Set beam offset depending on body dimensions
This commit is contained in:
parent
7a73e4240b
commit
cf6bf74f7a
@ -147,14 +147,6 @@ impl<
|
||||
const EXTENSION: &'static str = "ron";
|
||||
}
|
||||
|
||||
// Utility enum used to build Stadium points
|
||||
// Read doc for [Body::sausage] for more.
|
||||
//
|
||||
// Actually can be removed I guess?
|
||||
// We can just determine shape form dimensions.
|
||||
//
|
||||
// But I want Dachshund in Veloren at least somewhere XD
|
||||
|
||||
impl Body {
|
||||
pub fn is_humanoid(&self) -> bool { matches!(self, Body::Humanoid(_)) }
|
||||
|
||||
|
@ -257,7 +257,16 @@ pub fn beam_offsets(
|
||||
velocity: Vec3<f32>,
|
||||
on_ground: Option<Block>,
|
||||
) -> Vec3<f32> {
|
||||
let body_radius = body.min_radius();
|
||||
let dim = body.dimensions();
|
||||
// The width (shoulder to shoulder) and length (nose to tail)
|
||||
let (width, length) = (dim.x, dim.y);
|
||||
let body_radius = if length > width {
|
||||
// Dachshund-like
|
||||
body.max_radius()
|
||||
} else {
|
||||
// Cyclops-like
|
||||
body.min_radius()
|
||||
};
|
||||
let body_offsets_z = height_offset(body, look_dir, velocity, on_ground);
|
||||
Vec3::new(
|
||||
body_radius * ori.x * 1.1,
|
||||
|
Loading…
Reference in New Issue
Block a user