use bevy::{prelude::*, render::mesh::PlaneMeshBuilder}; use smooth_bevy_cameras::{ controllers::fps::{FpsCameraBundle, FpsCameraController, FpsCameraPlugin}, LookTransformPlugin, }; fn main() { App::new() .insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins) .add_plugins(LookTransformPlugin) .add_plugins(FpsCameraPlugin::default()) .add_systems(Startup, setup) .run(); } /// set up a simple 3D scene fn setup( mut commands: Commands, mut meshes: ResMut>, mut materials: ResMut>, ) { // plane commands.spawn(PbrBundle { mesh: meshes.add(Mesh::from(PlaneMeshBuilder::from_size(Vec2::splat(5.0)))), material: materials.add(Color::srgb(0.3, 0.5, 0.3)), ..Default::default() }); // cube commands.spawn(PbrBundle { mesh: meshes.add(Mesh::from(Cuboid::from_size(Vec3::splat(1.0)))), material: materials.add(Color::srgb(0.8, 0.7, 0.6)), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..Default::default() }); // light commands.spawn(PointLightBundle { transform: Transform::from_xyz(4.0, 8.0, 4.0), ..Default::default() }); commands .spawn(Camera3dBundle::default()) .insert(FpsCameraBundle::new( FpsCameraController::default(), Vec3::new(-2.0, 5.0, 5.0), Vec3::new(0., 0., 0.), Vec3::Y, )); }