Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 12, 2011, 11:34:40 AM (13 years ago)
Author:
landauf
Message:

implemented feature to reset the mouse cursor to the center
used in NewHumanController to set cursor to the center of the screen every time the ControllableEntity is changed
avoids turning of the spaceship right after spawn, if the player looked around in spectator mode

needs testing with derived mouse input (joysticks should be unchanged).
input system experts may have a look at this. ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r7801 r7859  
    3838#include "core/CoreIncludes.h"
    3939#include "core/command/ConsoleCommand.h"
     40#include "core/input/KeyBinder.h"
     41#include "core/input/KeyBinderManager.h"
    4042#include "worldentities/ControllableEntity.h"
    4143#include "worldentities/pawns/Pawn.h"
     
    347349        this->firemode_ = -1;
    348350        hideArrows();
     351    }
     352
     353    void NewHumanController::centerCursor()
     354    {
     355        this->currentYaw_ = 0;
     356        this->currentPitch_ = 0;
     357
     358        KeyBinderManager::getInstance().getCurrent()->resetMouseAxes();
    349359    }
    350360
     
    481491    {
    482492        this->controlMode_ = 0;
    483         this->currentYaw_ = 0;
    484         this->currentPitch_ = 0;
     493        this->centerCursor();
    485494        if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
    486495        {
Note: See TracChangeset for help on using the changeset viewer.