more physics systems stuff
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user