feat(camera): comprehensive camera system (C1)

Rebuild the camera around a single persistent MainCamera and the
Camera System design-doc model: two framing modes (Orbit = inspection/
docked tactical, Follow = track the ship) plus Cinematic as a boolean
overlay (free rotation + HUD hide + live gameplay), not a third mode.

Critical fixes (gap analysis A1-A3):
- A1: scenes now *reconfigure* the one startup camera instead of spawning
  a second one; despawn_in_system_scene no longer destroys MainCamera, so
  the session never loses its camera. .single_mut() on MainCamera now
  succeeds during flight.
- A2: Cinematic is a real overlay — toggle (KeyC), free-look rotation in
  any framing, HUD hidden while active, gameplay keeps running.
- A3: removed dead FollowCamera component + setup_follow_camera; tracking
  is unified in track_camera_target.

Gaps B1-B6:
- B1: adopted doc model (Cinematic overlay, not exclusive mode).
- B2: canonical isometric tactical_rotation() baseline.
- B3: smooth reframing via OrbitFocusGoal exponential-damp tween.
- B4: non-zero CameraState defaults.
- B5: consolidated the three orbit-control impls into one (dropped the
  starting_base local control + its Euler variant).
- B6: track_camera_target keeps OrbitCamera.target synced to the focus
  entity every frame.

Docked view now frames the actual station at a tactical iso distance.
cargo check + clippy clean for all newly-authored code; net -10 lines
(more dead code removed than added). 42 tests pass.
This commit is contained in:
2026-06-16 20:05:31 -04:00
parent aee13cb81a
commit 30b6678569
7 changed files with 420 additions and 430 deletions

View File

@@ -20,7 +20,6 @@ pub struct StartingBasePlugin;
impl Plugin for StartingBasePlugin {
fn build(&self, app: &mut App) {
app.init_resource::<StartingBaseDraft>()
.init_resource::<StartingBaseFocusGoal>()
.init_resource::<scene::SpawnedPoiSystem>()
.add_systems(
OnEnter(AppState::StartingBaseSelection),
@@ -34,7 +33,6 @@ impl Plugin for StartingBasePlugin {
Update,
(
escape_to_character_creation,
scene::starting_base_orbit_camera_control,
ui::candidate_button_handler,
scene::focus_starting_base_camera,
scene::animate_starting_base_selection,
@@ -69,22 +67,6 @@ pub struct StartingBaseFocusRequest {
pub candidate_index: usize,
}
/// Resolved focus target the starting-base camera tweens toward. Set by
/// [`crate::gameplay::starting_base::scene::focus_starting_base_camera`] when a
/// candidate is selected, then approached gradually by the orbit control
/// system, which clears `active` once the camera arrives (or the user takes
/// manual control by dragging / scrolling).
///
/// Persistent rather than inserted/removed on demand so the consumer can mutate
/// it via a single `ResMut` and keep the orbit control system's parameter count
/// manageable.
#[derive(Resource, Debug, Clone, Copy, Default)]
pub struct StartingBaseFocusGoal {
pub target: Vec3,
pub distance: f32,
pub active: bool,
}
#[derive(Component)]
pub struct StartingBaseSpawned;