You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
894 B
Rust
36 lines
894 B
Rust
//! This example demonstrates Bevy's immediate mode drawing API intended for visual debugging.
|
|
|
|
use bevy::prelude::*;
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins)
|
|
.add_systems(Startup, setup)
|
|
.add_systems(Update, system)
|
|
.run();
|
|
}
|
|
|
|
fn setup(mut commands: Commands) {
|
|
commands.spawn(Camera3dBundle {
|
|
transform: Transform::from_xyz(0., 1.5, 6.).looking_at(Vec3::ZERO, Vec3::Y),
|
|
..default()
|
|
});
|
|
// light
|
|
commands.spawn(PointLightBundle {
|
|
point_light: PointLight {
|
|
intensity: 1500.0,
|
|
shadows_enabled: true,
|
|
..default()
|
|
},
|
|
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
|
..default()
|
|
});
|
|
}
|
|
|
|
fn system(mut gizmos: Gizmos) {
|
|
gizmos.cuboid(
|
|
Transform::from_translation(Vec3::Y * 0.5).with_scale(Vec3::splat(1.)),
|
|
Color::BLACK,
|
|
);
|
|
}
|