Fix audio listener positionning code crash

This commit is contained in:
Marianne Gagnon 2015-11-23 19:05:51 -05:00
parent c806c1de49
commit 8ca0fea6fa

View File

@ -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()));
@ -532,8 +545,6 @@ void Camera::update(float dt)
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;