Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5913 for code


Ignore:
Timestamp:
Oct 8, 2009, 11:23:13 PM (15 years ago)
Author:
rgrieder
Message:

Using the Camera position instead of the ControllableEntity position for the sound listener.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/orxonox/controllers/HumanController.cc

    r5896 r5913  
    3636#include "infos/PlayerInfo.h"
    3737#include "overlays/Map.h"
     38#include "graphics/Camera.h"
    3839#include "sound/SoundManager.h"
    3940#include "Radar.h"
     
    8081    void HumanController::tick(float dt)
    8182    {
    82         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    83         {
    84             if (GameMode::playsSound())
     83        if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     84        {
     85            // Update sound listener
     86            Camera* camera = HumanController::localController_s->controllableEntity_->getCamera();
     87            if (camera)
    8588            {
    86                 // Update sound listener
    87                 SoundManager::getInstance().setListenerPosition(HumanController::localController_s->controllableEntity_->getPosition());
    88                 SoundManager::getInstance().setListenerOrientation(HumanController::localController_s->controllableEntity_->getOrientation());
     89                SoundManager::getInstance().setListenerPosition(camera->getPosition());
     90                SoundManager::getInstance().setListenerOrientation(camera->getOrientation());
    8991            }
     92            else
     93                COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
    9094        }
    9195    }
Note: See TracChangeset for help on using the changeset viewer.