[Orxonox-commit 3167] r7860 - in code/trunk/src/orxonox/worldentities: . pawns
landauf at orxonox.net
landauf at orxonox.net
Sat Feb 12 11:37:25 CET 2011
Author: landauf
Date: 2011-02-12 11:37:25 +0100 (Sat, 12 Feb 2011)
New Revision: 7860
Modified:
code/trunk/src/orxonox/worldentities/ControllableEntity.cc
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
Log:
fixed a few issues related to the free mouse look mode (default CTRL key):
- cursor is now moved to the center of the screen after leaving the mouse look mode
- spaceship doesn't spin anymore after leaving the mode
- camera doesn't drag back to the original position after leaving the mode, but jumps back immediately
Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc 2011-02-12 10:34:40 UTC (rev 7859)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc 2011-02-12 10:37:25 UTC (rev 7860)
@@ -39,7 +39,7 @@
#include "Scene.h"
#include "infos/PlayerInfo.h"
-#include "controllers/Controller.h"
+#include "controllers/NewHumanController.h"
#include "graphics/Camera.h"
#include "worldentities/CameraPosition.h"
#include "overlays/OverlayGroup.h"
@@ -203,10 +203,14 @@
this->camera_->attachToNode(this->cameraPositionRootNode_);
this->currentCameraPosition_ = 0;
}
-
+
// disable mouse look if the new camera position doesn't allow it
if (this->currentCameraPosition_ && !this->currentCameraPosition_->getAllowMouseLook() && this->bMouseLook_)
this->mouseLook();
+
+ // disable drag if in mouse look
+ if (this->bMouseLook_)
+ this->getCamera()->setDrag(false);
}
}
@@ -218,7 +222,15 @@
this->bMouseLook_ = !this->bMouseLook_;
if (!this->bMouseLook_)
+ {
this->cameraPositionRootNode_->setOrientation(Quaternion::IDENTITY);
+ this->cameraPositionRootNode_->_update(true, false); // update the camera node because otherwise the camera will drag back in position which looks strange
+
+ NewHumanController* controller = dynamic_cast<NewHumanController*>(this->getController());
+ if (controller)
+ controller->centerCursor();
+ }
+
if (this->getCamera())
{
if (!this->bMouseLook_ && this->currentCameraPosition_->getDrag())
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-02-12 10:34:40 UTC (rev 7859)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-02-12 10:37:25 UTC (rev 7860)
@@ -141,9 +141,10 @@
{
this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
- this->localAngularAcceleration_.setValue(0, 0, 0);
}
-
+
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+
if(!this->bBoostCooldown_ && this->boostPower_ < this->initialBoostPower_)
{
this->boostPower_ += this->boostPowerRate_*dt;
@@ -160,7 +161,7 @@
}
}
}
-
+
void SpaceShip::boostCooledDown(void)
{
this->bBoostCooldown_ = false;
@@ -204,13 +205,13 @@
Pawn::rotateRoll(value);
}
-
+
// TODO: something seems to call this function every tick, could probably handled a little more efficiently!
void SpaceShip::setBoost(bool bBoost)
{
if(bBoost == this->bBoost_)
return;
-
+
if(bBoost)
this->boost();
else
More information about the Orxonox-commit
mailing list