random pos?

bevy-rapier
Zynh0722 2024-02-15 02:44:49 -08:00
parent c113fdaf92
commit da25ffb0bf
1 changed files with 10 additions and 3 deletions

View File

@ -21,10 +21,17 @@ fn model(app: &App) -> Model {
.build() .build()
.unwrap(); .unwrap();
Model { let boundary = app.window_rect();
_window, let mut particles = Vec::new();
particles: Vec::new(),
for _ in 0..100 {
let x = random_range(boundary.left(), boundary.right());
let y = random_range(boundary.top(), boundary.bottom());
let particle = Particle::new(Vec2::new(x, y));
particles.push(particle);
} }
Model { _window, particles }
} }
// Handle events related to the window and update the model if necessary // Handle events related to the window and update the model if necessary