From b754d9c87988b66cd8176080f575b04cb48973d3 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Tue, 21 Sep 2010 12:25:17 +0000 Subject: [PATCH] Fixed camera aiming at incorrect (previous) position when restarting a race. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6107 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/camera.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index ad4ddfb8e..0a0ab8c57 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -232,6 +232,12 @@ void Camera::setInitialTransform() { m_camera->setPosition( m_kart->getXYZ().toIrrVector() + core::vector3df(0, 25, -50) ); + // Reset the target from the previous target (in case of a restart + // of a race) - otherwise the camera will initially point in the wrong + // direction till smoothMoveCamera has corrected this. Setting target + // to position doesn't make sense, but smoothMoves will adjust the + // value before the first frame is rendered + m_camera->setTarget(m_camera->getPosition()); m_camera->setRotation(core::vector3df(0, 0, 0)); m_camera->setRotation( core::vector3df( 0.0f, 0.0f, 0.0f ) ); m_camera->setFOV(m_fov);