[Orxonox-commit 1425] r6143 - code/branches/presentation2/src/orxonox/controllers
wirthmi at orxonox.net
wirthmi at orxonox.net
Wed Nov 25 13:42:38 CET 2009
Author: wirthmi
Date: 2009-11-25 13:42:38 +0100 (Wed, 25 Nov 2009)
New Revision: 6143
Modified:
code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
Log:
updateTarget() fixed
Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc 2009-11-25 12:08:45 UTC (rev 6142)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc 2009-11-25 12:42:38 UTC (rev 6143)
@@ -134,10 +134,19 @@
} // if
}
*/
- if( !NewHumanController::localController_s->getControllableEntity()->isInMouseLook() )
- this->updateTarget();
- HumanController::localController_s->getControllableEntity()->fire(firemode);
+ if (firemode == 1 && this->controlMode_ == 1) {
+ //unlocked steering, steer on right mouse click
+ //HumanController::yaw(new Vector2(this->currentYaw_, 0));
+ //HumanController::pitch(new Vector2(this->currentPitch_, 0));
+ }
+ else {
+ if( !NewHumanController::localController_s->getControllableEntity()->isInMouseLook() )
+ this->updateTarget();
+
+ HumanController::localController_s->getControllableEntity()->fire(firemode);
+ }
+
}
void NewHumanController::updateTarget()
@@ -189,18 +198,20 @@
if ( !isSightable )
continue;
}
-
- if( this->getControllableEntity()->getTarget() != wePtr )
+
+ if ( this->getControllableEntity() && this->getControllableEntity()->getTarget() != wePtr )
+ {
this->getControllableEntity()->setTarget(wePtr);
+ }
+ if( pawn )
+ {
+ pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance );
+ }
+
itr->movable->getParentSceneNode()->showBoundingBox(true);
//std::cout << itr->movable->getParentSceneNode()->_getDerivedPosition() << endl;
//return mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance; //or itr->movable->getParentSceneNode()->_getDerivedPosition()
- if ( pawn )
- {
- pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance ); // or itr->movable->getParentSceneNode()->_getDerivedPosition()
- pawn->setTarget( wePtr );
- }
return;
}
@@ -208,9 +219,10 @@
if ( pawn )
{
pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 1200 );
- if( this->getControllableEntity()->getTarget() != 0 )
- pawn->setTarget( 0 );
}
+
+ if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0 )
+ this->getControllableEntity()->setTarget( 0 );
//return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z * 2000);
@@ -222,9 +234,8 @@
// SUPER(NewHumanController, yaw, value);
if (this->controlMode_ == 0)
HumanController::yaw(value);
-
+
this->currentYaw_ = value.x;
- //std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl;
}
void NewHumanController::pitch(const Vector2& value)
@@ -233,8 +244,9 @@
if (this->controlMode_ == 0)
HumanController::pitch(value);
+std::cout << value << endl;
+
this->currentPitch_ = value.x;
- //std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl;
}
void NewHumanController::changeMode() {
@@ -246,7 +258,7 @@
else
NewHumanController::localController_s->controlMode_ = 0;
}
-
+
void NewHumanController::changedControllableEntity()
{
this->controlMode_ = 0;
More information about the Orxonox-commit
mailing list