more physics systems stuff

This commit is contained in:
JP Stringham
2026-02-08 08:54:48 -05:00
parent 406042ad1f
commit b628ce1d68
4 changed files with 40 additions and 13 deletions

View File

@@ -1,6 +1,28 @@
use bevy::{ecs::component::Component, math::I64Vec2};
/// 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::{
app::{Plugin, Update},
ecs::{component::Component, system::Query},
math::I64Vec2,
};
const MAX_SPEED: i64 = 256;
const MAX_SPEED: i64 = 400;
#[derive(Default, Debug)]
pub struct Physics2DPlugin {}
impl Plugin for Physics2DPlugin {
fn build(&self, app: &mut bevy::app::App) {
app.add_systems(Update, tick_physics);
}
}
fn tick_physics(mut query: Query<&mut PhysicsBody2D>) {
query.iter_mut().for_each(|mut pb| {
pb.tick();
});
}
#[derive(Default, Debug, Component)]
pub struct PhysicsBody2D {