|
|
|
|
@ -59,22 +59,33 @@ Uses linear scaling for consistent representation at all scales.
|
|
|
|
|
## Camera System |
|
|
|
|
|
|
|
|
|
### Camera Setup |
|
|
|
|
- Position: (0, 50, 100) initially |
|
|
|
|
- Position: (0, CAMERA_INITIAL_POSITION_Y, CAMERA_INITIAL_POSITION_Z) initially |
|
|
|
|
- Target: Origin (0, 0, 0) |
|
|
|
|
- Up vector: (0, 1, 0) |
|
|
|
|
- FOV: 45 degrees |
|
|
|
|
- FOV: CAMERA_INITIAL_FOV (45 degrees) |
|
|
|
|
- Projection: Perspective |
|
|
|
|
|
|
|
|
|
### Camera Control Constants |
|
|
|
|
- **Orbit rotation speed:** CAMERA_ORBIT_ANGLE_SPEED (0.02 radians per keypress) |
|
|
|
|
- **Zoom percentage:** ZOOM_PERCENTAGE (7% of current distance per keypress) |
|
|
|
|
- **Zoom delta limits:** ZOOM_MIN_DELTA (0.05) to ZOOM_MAX_DELTA (5.0) |
|
|
|
|
- **Initial height factor:** CAMERA_INITIAL_HEIGHT_FACTOR (0.3) |
|
|
|
|
- **Minimum distance fallback:** CAMERA_MIN_DISTANCE (0.1 for no target) |
|
|
|
|
|
|
|
|
|
### Camera Controls |
|
|
|
|
**Arrow Keys:** |
|
|
|
|
- Left/Right: Orbit around target (horizontal rotation) |
|
|
|
|
- Up/Down: Zoom in/out (preserve viewing angle) |
|
|
|
|
- Zoom speed is percentage-based: faster when far, slower when close |
|
|
|
|
- Zoom delta clamped to prevent too-slow or too-fast movement |
|
|
|
|
|
|
|
|
|
**Camera Follow Mode:** |
|
|
|
|
- Tracks selected body or spacecraft |
|
|
|
|
- Tracks selected body only (spacecraft selection handled by UI) |
|
|
|
|
- When spacecraft selected, camera follows spacecraft's parent body |
|
|
|
|
- Preserves relative offset when following |
|
|
|
|
- Updates target position each frame to follow moving objects |
|
|
|
|
- Maintains camera distance when switching between bodies |
|
|
|
|
- Initial camera position accounts for body size when switching targets |
|
|
|
|
|
|
|
|
|
**Camera Rotation Logic:** |
|
|
|
|
- Uses camera's up vector for horizontal orbit |
|
|
|
|
@ -83,8 +94,9 @@ Uses linear scaling for consistent representation at all scales.
|
|
|
|
|
|
|
|
|
|
**Follow State Transitions:** |
|
|
|
|
1. **Enable follow**: Store current offset from target |
|
|
|
|
2. **Body switch**: Recalculate offset to maintain distance |
|
|
|
|
2. **Body switch**: Recalculate offset using get_initial_camera_distance() |
|
|
|
|
3. **Frame update**: Move camera to maintain offset from moving target |
|
|
|
|
4. **Spacecraft selection**: Camera focuses on spacecraft's parent body |
|
|
|
|
|
|
|
|
|
## Object Rendering |
|
|
|
|
|
|
|
|
|
|