Camera feeling great
This commit is contained in:
@@ -73,18 +73,28 @@ Camera-relative direction is derived from the active `Camera3D`'s basis — the
|
||||
|
||||
## Camera
|
||||
|
||||
`OverworldCamera` orbits around `targetNode` using yaw/pitch angles driven by `camera_orbit_*` inputs.
|
||||
`OverworldCamera` orbits around `targetNode` using yaw/pitch angles. It operates in two modes: `CameraMode.FREE` (stays where placed) and `CameraMode.CENTERED` (lerps to orbit directly behind the player).
|
||||
|
||||
| Export | Default | Purpose |
|
||||
|---|---|---|
|
||||
| `targetNode:Node3D` | — | Node to orbit (assign Player in scene) |
|
||||
| `pivotOffset:Vector3` | `(0, 1.2, 0)` | Orbit point above entity origin |
|
||||
| `distance:float` | `10.0` | Orbit radius |
|
||||
| `pitchMin/Max:float` | `-10° / 70°` | Vertical clamp |
|
||||
| `orbitSensitivity:float` | `120.0` | Degrees/sec at full input |
|
||||
| `collisionMask:int` | — | Layers the camera avoids (terrain = layer 1) |
|
||||
| `distance:float` | `7.0` | Orbit radius |
|
||||
| `minDistance:float` | `2.0` | Minimum camera distance (collision won't push closer) |
|
||||
| `pitchMin/Max:float` | `-80° / 70°` | Vertical clamp |
|
||||
| `orbitSensitivity:float` | `144.0` | Degrees/sec at full controller input |
|
||||
| `orbitAcceleration:float` | `600.0` | Controller ramp speed (deg/s²) |
|
||||
| `mouseSensitivity:float` | `0.3` | Right-click drag sensitivity |
|
||||
| `centeredDelay:float` | `2.0` | Seconds of walking + no camera input before switching to CENTERED |
|
||||
| `centeredFollowRate:float` | `3.0` | Lerp rate in CENTERED mode (higher = faster; 3 ≈ 1s to fully center) |
|
||||
| `centeredPitch:float` | `30.0` | Target pitch in CENTERED mode |
|
||||
| `collisionMask:int` | `1` | Physics layers the camera avoids; entities are on layer 2 and excluded by default |
|
||||
|
||||
If the ray from pivot to desired camera position hits `collisionMask`, the camera is pulled in to just in front of the hit point (with `COLLISION_MARGIN = 0.3`), clamped to `minDistance`.
|
||||
**Mode transitions:**
|
||||
- FREE → CENTERED: after `centeredDelay` seconds of player movement with no camera input, or immediately via `center_camera` (G / LB)
|
||||
- CENTERED → FREE: any manual camera input (controller stick or right-click drag)
|
||||
|
||||
Collision resolution uses a sphere-plane circle intersection so the camera satisfies both `minDistance` and terrain clearance simultaneously (`COLLISION_MARGIN = 0.3`).
|
||||
|
||||
## Adding a new map
|
||||
|
||||
|
||||
Reference in New Issue
Block a user