Add mount pitch and roll for realistic taxi flight animation

Flying mounts now tilt and bank realistically during taxi flights:
- Pitch (up/down): calculated from spline tangent's z-component (altitude change)
- Roll (banking): proportional to turn rate, clamped to ~40 degrees
- Yaw: existing horizontal orientation from spline direction

Implementation:
- Added mountPitch_ and mountRoll_ to Renderer (radians)
- Updated TaxiOrientationCallback to pass yaw, pitch, roll
- Calculate pitch using asin(tangent.z) for altitude tilt
- Calculate roll from yaw change rate: -orientDiff * 2.5, clamped to ±0.7 rad
- Applied to mount rotation: glm::vec3(pitch, roll, yaw)

This fixes the "weirdness" where mounts flew sideways or without natural banking.
This commit is contained in:
Kelsi 2026-02-08 22:05:38 -08:00
parent 2e0a7e0039
commit 92031102e4
5 changed files with 34 additions and 12 deletions

View file

@ -719,11 +719,13 @@ void Application::setupUICallbacks() {
});
// Taxi orientation callback - update mount rotation during flight
gameHandler->setTaxiOrientationCallback([this](float orientationRadians) {
gameHandler->setTaxiOrientationCallback([this](float yaw, float pitch, float roll) {
if (renderer && renderer->getCameraController()) {
// Convert radians to degrees for camera controller
float yawDegrees = glm::degrees(orientationRadians);
// Convert radians to degrees for camera controller (character facing)
float yawDegrees = glm::degrees(yaw);
renderer->getCameraController()->setFacingYaw(yawDegrees);
// Set mount pitch and roll for realistic flight animation
renderer->setMountPitchRoll(pitch, roll);
}
});