Allow 360° orbit, add Center View button and XYZ reference axes
Camera (apps/game/src/camera.rs): - Replace yaw/pitch with a single Quat rotation. Mouse drag now does yaw-around-world-Y * rotation * pitch-around-local-X, which is gimbal-free and allows true 360° tumbling in any direction. - Remove pitch clamps (ORBIT_MIN_PITCH / ORBIT_MAX_PITCH). - Add ResetOrbitCamera resource + apply_orbit_reset system that snaps the orbit camera back to default on demand. - OrbitCamera::reset() helper. Galaxy scene (apps/game/src/gameplay/galaxy_creation/): - New axes.rs: spawn_axes() draws three emissive cylinders through the origin (X=red, Y=green, Z=blue) as children of the scene root so they rebuild with the rest of the galaxy. - UI adds a 'Center View' button below Regenerate that inserts ResetOrbitCamera; handled by reset_view_button_handler. - Help text now mentions drag/zoom/escape.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//! click-to-select is handled in [`super::selection`]; the slider/info panels
|
||||
//! live in [`super::ui`].
|
||||
|
||||
mod axes;
|
||||
mod params;
|
||||
mod selection;
|
||||
mod ui;
|
||||
@@ -13,6 +14,7 @@ use bevy::prelude::*;
|
||||
use rand::rngs::StdRng;
|
||||
use rand::{Rng, SeedableRng};
|
||||
|
||||
use crate::camera::apply_orbit_reset;
|
||||
use crate::state::AppState;
|
||||
|
||||
pub use params::{GalaxyParams, SelectedStar};
|
||||
@@ -32,10 +34,12 @@ impl Plugin for GalaxyCreationPlugin {
|
||||
escape_to_main_menu,
|
||||
ui::param_button_handler,
|
||||
ui::refresh_control_panel_values,
|
||||
ui::reset_view_button_handler,
|
||||
regenerate_galaxy_on_param_change,
|
||||
selection::select_star_on_click,
|
||||
selection::animate_selected_star,
|
||||
selection::refresh_info_panel,
|
||||
apply_orbit_reset,
|
||||
)
|
||||
.chain()
|
||||
.run_if(in_state(AppState::GalaxyCreation)),
|
||||
@@ -239,6 +243,9 @@ fn spawn_galaxy_scene(
|
||||
GalaxyCreationSpawned,
|
||||
))
|
||||
.with_children(|parent| {
|
||||
// XYZ reference axes through the origin.
|
||||
axes::spawn_axes(parent, meshes, materials);
|
||||
|
||||
// Star systems.
|
||||
for sys in systems {
|
||||
let (mesh, material) = if sys.faction_index == 0 && sys.position.length() < 40.0
|
||||
|
||||
Reference in New Issue
Block a user