feat: Folgekamera folgt der Fahrtrichtung

- Kamera nutzt die Bahn-Tangente statt des Koerper-Yaw
- Rueckwaerts bleibt sie auf der Bahnseite und zeigt die Laeuferin von vorn
- Element-Marker behalten die letzte Fahrtrichtung
- 61 Praesentations-Assertions (1193 gesamt)
This commit is contained in:
torsten 2026-10-31 15:43:14 +01:00
parent 81be37101f
commit a8c5e61faf
6 changed files with 151 additions and 12 deletions

View file

@ -190,6 +190,44 @@ func _test_presentation() -> void:
"clear pose clears the trail"
)
presentation.update_pose(
Vector2(0.0, 0.0),
Vector2.RIGHT,
forward_segment
)
presentation.update_camera_now()
_check(
_vec3_matches(
presentation.get_camera_travel_forward(),
Vector3(1.0, 0.0, 0.0)
),
"forward camera follows the path direction"
)
var camera_before := presentation.camera.position
presentation.update_pose(
Vector2(0.0, 0.0),
Vector2.LEFT,
backward_segment
)
presentation.update_camera_now()
_check(
_vec3_matches(
presentation.get_camera_travel_forward(),
Vector3(1.0, 0.0, 0.0)
),
"backward camera keeps the travel direction"
)
_check(
presentation.camera.position.distance_to(camera_before) < 0.01,
"backward skating does not swing the camera"
)
_check(
absf(
angle_difference(presentation.get_skater_yaw(), -PI * 0.5)
) < 0.001,
"the skater faces the camera when skating backward"
)
presentation.set_active(false)
_check(not presentation.visible, "inactive presentation is hidden")
_check(not presentation.camera.current, "inactive presentation releases the camera")
@ -306,6 +344,14 @@ func _color_matches(actual: Color, expected: Color) -> bool:
)
func _vec3_matches(
actual: Vector3,
expected: Vector3,
tolerance: float = 0.001
) -> bool:
return actual.distance_to(expected) <= tolerance
func _check(condition: bool, message: String) -> void:
_assertions += 1
if not condition: