From 8ca0fea6fa1ad90e0f5b82b3ae675e1c22a8440b Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Mon, 23 Nov 2015 19:05:51 -0500 Subject: [PATCH] Fix audio listener positionning code crash --- src/graphics/camera.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index facb4bd5e..dfbc6add7 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -524,6 +524,19 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle, */ void Camera::update(float dt) { + if (m_kart == NULL) + { + if (race_manager->getNumLocalPlayers() < 2) + { + Vec3 pos(m_camera->getPosition()); + SFXManager::get()->positionListener(pos, + Vec3(m_camera->getTarget()) - pos, + Vec3(0, 1, 0)); + } + + return; // cameras not attached to kart must be positioned manually + } + if (race_manager->getNumLocalPlayers() < 2) { Vec3 heading(sin(m_kart->getHeading()), 0.0f, cos(m_kart->getHeading())); @@ -531,9 +544,7 @@ void Camera::update(float dt) heading, Vec3(0, 1, 0)); } - - if (m_kart == NULL) return; // cameras not attached to kart must be positioned manually - + float above_kart, cam_angle, side_way, distance; bool smoothing;