use super::*;
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct PhysicsConfig {
#[get(type(copy))]
pub(crate) gravity: Point,
#[get(type(copy))]
pub(crate) cell_size: f32,
#[get(type(copy))]
pub(crate) position_correction: f32,
#[get(skip)]
pub(crate) arena_bounds: Option<Rect>,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct CollisionEvent {
#[get(type(copy))]
pub(crate) entity_a: EntityId,
#[get(type(copy))]
pub(crate) entity_b: EntityId,
#[get(type(copy))]
pub(crate) normal: Point,
#[get(type(copy))]
pub(crate) penetration: f32,
#[get(type(copy))]
pub(crate) is_trigger: bool,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct RaycastQuery2D {
#[get(type(copy))]
pub(crate) origin: Point,
#[get(type(copy))]
pub(crate) direction: Point,
#[get(type(copy))]
pub(crate) max_distance: f32,
#[get(type(copy))]
pub(crate) layer_mask: u32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct RaycastHit {
#[get(type(copy))]
pub(crate) entity: EntityId,
#[get(type(copy))]
pub(crate) point: Point,
#[get(type(copy))]
pub(crate) normal: Point,
#[get(type(copy))]
pub(crate) distance: f32,
}
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, New, PartialEq)]
pub struct PhysicsStepStats {
#[get(type(copy))]
pub(crate) bodies_integrated: usize,
#[get(type(copy))]
pub(crate) broad_phase_pairs: usize,
#[get(type(copy))]
pub(crate) collisions_detected: usize,
}
#[derive(Clone, Data, Debug)]
pub struct PhysicsWorld2D {
#[get(type(copy))]
pub(crate) config: PhysicsConfig,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) grid: HashMap<(i32, i32), Vec<usize>>,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) seen_pairs: HashSet<(usize, usize)>,
#[get(type(copy))]
pub(crate) last_stats: PhysicsStepStats,
}