use std::ops::DerefMut; /// This module is intended to be used as a fixed-point physics system. /// The hope is that this will make deterministic physics easier, /// and therefore networking a bit less of a pain. use bevy::{math::I64Vec2, prelude::*}; const FIXED_UPDATE_INTERVAL_MS: u128 = 10; // 100 fps physics #[derive(Default, Debug)] pub struct Physics2DPlugin; #[derive(Default, Debug, Resource)] pub struct Physics2DWorld { pub last_update: u128, } impl Plugin for Physics2DPlugin { fn build(&self, app: &mut bevy::app::App) { app.insert_resource(Physics2DWorld::default()) .add_systems(Update, (tick_physics, resolve_aabb_collisions).chain()); } } fn tick_physics( mut query: Query<&mut PhysicsBody2D>, mut p_world: ResMut, time: Res