diff --git a/src/editor.rs b/src/editor.rs index fcd9f91..5d13c39 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -18,7 +18,7 @@ impl Plugin for EditorPlugin { Update, ( handle_window_close.run_if(on_event::()), - // plane_gizmos, + plane_gizmos, // fly_camera, ) .run_if(in_state(EditorState::Open)), @@ -83,6 +83,7 @@ fn init_editor(mut commands: Commands) { target: RenderTarget::Window(WindowRef::Entity(editor_window)), ..default() }, + transform: Transform::from_xyz(10.0, 10.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y), ..default() }, )) @@ -157,9 +158,27 @@ fn handle_window_close( }); } -fn _plane_gizmos(mut _gizmos: Gizmos) { - todo!() - // gizmos.line(Vec3::ZERO, Vec3::X, Color::GREEN); +fn plane_gizmos(mut gizmos: Gizmos) { + let r = 20.0; + let start = -r as i8; + let end = r as i8; + (start..=end).into_iter().for_each(|n| { + { + let offset = Vec3::Z * (n as f32); + gizmos.line(Vec3::NEG_X * r + offset, Vec3::X * r + offset, Color::GRAY); + } + { + let offset = Vec3::X * (n as f32); + gizmos.line(Vec3::NEG_Z * r + offset, Vec3::Z * r + offset, Color::GRAY); + } + }); + + // World origin arrows + { + gizmos.arrow(Vec3::ZERO, Vec3::X, Color::RED); + gizmos.arrow(Vec3::ZERO, Vec3::Y, Color::DARK_GREEN); + gizmos.arrow(Vec3::ZERO, Vec3::Z, Color::BLUE); + } } fn _fly_camera(mut _camera: Query<&mut Transform, (With, With)>) {