use std::f32::consts::TAU; use bevy::prelude::*; use bevy_mod_outline::*; use bevy_mod_rounded_box::*; #[bevy_main] fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) .add_plugin(OutlinePlugin) .add_startup_system(setup) .add_system(rotate_cube) .run(); } #[derive(Component)] struct TheCube(); fn setup( mut commands: Commands, mut meshes: ResMut>, mut outlines: ResMut>, mut materials: ResMut>, ) { // Spawn cube et al. commands.spawn_bundle(PbrBundle { mesh: meshes.add(Mesh::from(bevy::prelude::shape::Plane { size: 5.0 })), material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), ..default() }); commands .spawn_bundle(PbrBundle { mesh: meshes.add(Mesh::from(RoundedBox { size: Vec3::new(1., 1., 1.), radius: 0.3, subdivisions: 5, })), material: materials.add(Color::rgb(0.1, 0.1, 0.9).into()), transform: Transform::from_xyz(0.0, 1.0, 0.0), ..default() }) .insert(outlines.add(Outline { colour: Color::rgba(0.0, 1.0, 0.0, 0.5), width: 50.0, })) .insert(TheCube()); commands.spawn_bundle(PointLightBundle { point_light: PointLight { intensity: 1500.0, shadows_enabled: true, ..default() }, transform: Transform::from_xyz(4.0, 8.0, 4.0), ..default() }); commands.spawn_bundle(PerspectiveCameraBundle { transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), ..default() }); } fn rotate_cube( mut cubes: Query<&mut Transform, With>, timer: Res