Files
space-game/game/main/src/components/camera.rs
2025-07-20 13:58:37 -04:00

51 lines
941 B
Rust

use bevy::prelude::*;
#[derive(Component, Reflect)]
pub struct FreeCam(pub bool);
#[derive(Component, Default, Reflect)]
pub struct MainCamera;
#[derive(Component, Default, Reflect)]
pub struct CameraRoot;
#[derive(Component, Default, Reflect)]
pub struct CameraPitch(pub f32);
#[derive(Component, Reflect)]
pub struct Unfocused;
#[derive(Component, Reflect)]
#[require(FollowTarget)]
pub struct FollowCam {
pub target: Entity,
pub distance: f32,
pub height: f32,
}
#[derive(Component, Reflect)]
pub struct FollowTarget {
pub pos: Vec3,
pub rot: Quat,
pub up: Dir3,
}
impl Default for FollowTarget {
fn default() -> Self {
return Self {
pos: default(),
rot: default(),
up: Dir3::Y,
};
}
}
#[derive(Component, Default, Reflect)]
pub enum CameraMode {
#[default]
Player,
Ship,
Disabled,
}
#[derive(Component, Reflect)]
pub struct CameraAttachment(pub Entity);