Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7857 for code


Ignore:
Timestamp:
Feb 11, 2011, 5:17:39 PM (14 years ago)
Author:
landauf
Message:
  • fixed a crash if mouse look was switched on and off for a ControllableEntity without CameraPosition
  • disabled mouse look for Spectator
  • disable mouse look if camera switches to a position which doesn't allow mouse look
Location:
code/trunk/src/orxonox/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/worldentities/ControllableEntity.cc

    r7534 r7857  
    204204                this->currentCameraPosition_ = 0;
    205205            }
     206           
     207            // disable mouse look if the new camera position doesn't allow it
     208            if (this->currentCameraPosition_ && !this->currentCameraPosition_->getAllowMouseLook() && this->bMouseLook_)
     209                this->mouseLook();
    206210        }
    207211    }
     
    209213    void ControllableEntity::mouseLook()
    210214    {
    211         this->bMouseLook_ = !this->bMouseLook_;
    212 
    213         if (!this->bMouseLook_)
    214             this->cameraPositionRootNode_->setOrientation(Quaternion::IDENTITY);
    215         if (this->getCamera())
    216         {
    217             if (!this->bMouseLook_&& this->currentCameraPosition_->getDrag())
    218                 this->getCamera()->setDrag(true);
    219             else
    220                 this->getCamera()->setDrag(false);
     215        // enable mouse look only if allowed - disabling it works always
     216        if (this->currentCameraPosition_ && (this->currentCameraPosition_->getAllowMouseLook() || this->bMouseLook_))
     217        {
     218            this->bMouseLook_ = !this->bMouseLook_;
     219
     220            if (!this->bMouseLook_)
     221                this->cameraPositionRootNode_->setOrientation(Quaternion::IDENTITY);
     222            if (this->getCamera())
     223            {
     224                if (!this->bMouseLook_ && this->currentCameraPosition_->getDrag())
     225                    this->getCamera()->setDrag(true);
     226                else
     227                    this->getCamera()->setDrag(false);
     228            }
    221229        }
    222230    }
  • code/trunk/src/orxonox/worldentities/pawns/Spectator.h

    r7163 r7857  
    5656            virtual void fired(unsigned int firemode);
    5757            virtual void greet();
     58            virtual void mouseLook() {}
    5859
    5960        protected:
Note: See TracChangeset for help on using the changeset viewer.