19 lines
678 B
Rust
19 lines
678 B
Rust
|
use bevy::prelude::*;
|
||
|
use bevy_rapier3d::prelude::*;
|
||
|
|
||
|
pub fn spawn_ground(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>,
|
||
|
mut materials: ResMut<Assets<StandardMaterial>>,) {
|
||
|
commands
|
||
|
.spawn(Collider::cuboid(20.0, 0.1, 20.0))
|
||
|
.insert(TransformBundle::from(Transform::from_xyz(0.0, -2.0, 0.0)))
|
||
|
.insert(RigidBody::Fixed)
|
||
|
.insert(PbrBundle {
|
||
|
mesh: meshes.add(shape::Plane::from_size(40.0).into()),
|
||
|
material: materials.add(StandardMaterial {
|
||
|
base_color: Color::WHITE,
|
||
|
perceptual_roughness: 1.0,
|
||
|
..default()
|
||
|
}),
|
||
|
..default()
|
||
|
});
|
||
|
}
|