//! Custom physics items //! TODO: Refactor in terms of Rapier2D, *or* implement colliders and remove it. use crate::WorldSize; use bevy::prelude::*; #[derive(Component)] pub(crate) struct Position(pub(crate) bevy::math::Vec2); #[derive(Component)] pub(crate) struct Velocity(pub(crate) bevy::math::Vec2); #[derive(Component)] pub(crate) struct Rotation(pub(crate) f32); /// Marker for any entity that should wrap on screen edges #[derive(Component)] pub(crate) struct Wrapping; // TODO: Combine movement integration steps into one function // They need to be ordered so the physics is deterministic. Bevy can enforce // order, but it makes more sense to cut out the extra machinery and have one // single function. Probably better for cache locality or whatever, too. /* Add velocity to position */ pub(crate) fn integrate_velocity( mut query: Query<(&mut Transform, &Velocity)>, time: Res