From 545d04544a9bbaab072f6af6e15323c5ab4e743c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20B=C3=B6klin?= Date: Wed, 19 May 2021 14:21:14 +0200 Subject: [PATCH] Add Body::collider_shape method --- common/src/comp/body.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 21d9296172..4ac88ee978 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -16,6 +16,7 @@ pub mod theropod; use crate::{ assets::{self, Asset}, + comp::Collider, consts::{HUMAN_DENSITY, WATER_DENSITY}, make_case_elim, npc::NpcKind, @@ -399,6 +400,14 @@ impl Body { pub fn height(&self) -> f32 { self.dimensions().z } + pub fn collider_shape(&self) -> Collider { + Collider::Box { + radius: self.radius(), + z_min: 0.0, + z_max: self.height(), + } + } + pub fn base_energy(&self) -> u32 { match self { Body::BipedLarge(biped_large) => match biped_large.species {