use drew_physics::{Body, Vec2, World, WorldSettings};
fn main() {
println!("=== Test de simulation avec drew-physics ===");
let settings = WorldSettings {
gravity: Vec2::new(0.0, 9.81),
viscosity: 0.05,
bounds_min: Vec2::ZERO,
bounds_max: Vec2::new(240.0, 320.0),
};
let mut world = World::<4>::new(settings);
let mut bille = Body::new(Vec2::new(120.0, 10.0), 1.0, 8.0);
bille.velocity = Vec2::new(40.0, 0.0);
let _ = world.add_body(bille);
let dt = 0.016;
for step in 0..60 {
world.step(dt);
if let Some(body) = world.bodies[0] {
let x_px = body.position.x as i32;
let y_px = body.position.y as i32;
if step % 10 == 0 {
println!(
"Frame {:02} | Pos: ({:3}, {:3}) | Vel: ({:6.2}, {:6.2})",
step, x_px, y_px, body.velocity.x, body.velocity.y
);
}
}
}
}