2023-09-12 04:47:37 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
use bevy_rapier3d::prelude::*;
|
|
|
|
|
2023-09-12 16:33:51 +00:00
|
|
|
pub fn spawn_ground(
|
|
|
|
mut commands: Commands,
|
|
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
|
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
|
|
|
) {
|
2023-09-12 04:47:37 +00:00
|
|
|
commands
|
2023-09-13 14:53:43 +00:00
|
|
|
.spawn(Collider::cuboid(50.0, 0.1, 50.0))
|
2023-09-12 04:47:37 +00:00
|
|
|
.insert(TransformBundle::from(Transform::from_xyz(0.0, -2.0, 0.0)))
|
|
|
|
.insert(RigidBody::Fixed)
|
|
|
|
.insert(PbrBundle {
|
2023-09-13 14:53:43 +00:00
|
|
|
mesh: meshes.add(shape::Plane::from_size(100.0).into()),
|
2023-09-12 04:47:37 +00:00
|
|
|
material: materials.add(StandardMaterial {
|
|
|
|
base_color: Color::WHITE,
|
|
|
|
perceptual_roughness: 1.0,
|
|
|
|
..default()
|
|
|
|
}),
|
|
|
|
..default()
|
|
|
|
});
|
2023-09-12 16:33:51 +00:00
|
|
|
}
|