From 23301d822adc3a3eceeee05c4094ae157853df29 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 18 Feb 2014 08:18:33 +1100 Subject: [PATCH] Experimentally adjust camera up vector depending on kart roll, which means the camera will now follow the gravity changes. --- src/graphics/camera.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index f58b43941..814f3371e 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -533,7 +533,10 @@ void Camera::positionCamera(float dt, float above_kart, float cam_angle, wanted_target - m_camera->getPosition()); } } - + + // Rotate the up vector (0,1,0) by the rotation ... which is just column 1 + Vec3 up = m_kart->getTrans().getBasis().getColumn(1); + m_camera->setUpVector(up.toIrrVector()); } // positionCamera // ----------------------------------------------------------------------------