mod nphysics_world;
pub use self::nphysics_world::*;
use crate::object::*;
use crate::private::Sealed;
#[cfg(any(test, feature = "use-mocks"))]
use mockiato::mockable;
use myelin_geometry::*;
use std::fmt::Debug;
#[cfg_attr(any(test, feature = "use-mocks"), mockable)]
pub trait World: Debug + Sealed {
fn step(&mut self);
fn add_body(&mut self, body: PhysicalBody) -> BodyHandle;
fn remove_body(&mut self, body_handle: BodyHandle) -> Option<PhysicalBody>;
fn body(&self, handle: BodyHandle) -> Option<PhysicalBody>;
fn apply_force(&mut self, body_handle: BodyHandle, force: Force) -> Option<()>;
fn set_simulated_timestep(&mut self, timestep: f64);
fn bodies_in_area(&self, area: Aabb) -> Vec<BodyHandle>;
fn bodies_in_polygon(&self, area: &Polygon) -> Vec<BodyHandle>;
fn bodies_in_ray(&self, origin: Point, direction: Vector) -> Vec<BodyHandle>;
}
#[cfg(any(test, feature = "use-mocks"))]
impl Sealed for WorldMock<'_> {}
#[derive(Debug, PartialEq, Clone)]
pub struct PhysicalBody {
pub shape: Polygon,
pub location: Point,
pub rotation: Radians,
pub mobility: Mobility,
pub passable: bool,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BodyHandle(pub usize);