[Orxonox-commit 4070] r8741 - in code/branches/ai2/src/orxonox: controllers worldentities/pawns
jo at orxonox.net
jo at orxonox.net
Sun Jul 10 21:53:17 CEST 2011
Author: jo
Date: 2011-07-10 21:53:17 +0200 (Sun, 10 Jul 2011)
New Revision: 8741
Modified:
code/branches/ai2/src/orxonox/controllers/ArtificialController.h
code/branches/ai2/src/orxonox/worldentities/pawns/SpaceShip.cc
Log:
Correction of camera bug.
Modified: code/branches/ai2/src/orxonox/controllers/ArtificialController.h
===================================================================
--- code/branches/ai2/src/orxonox/controllers/ArtificialController.h 2011-07-10 15:46:32 UTC (rev 8740)
+++ code/branches/ai2/src/orxonox/controllers/ArtificialController.h 2011-07-10 19:53:17 UTC (rev 8741)
@@ -141,18 +141,18 @@
void targetDied();
static bool sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype); // hack
- void boostControl();
+ void boostControl(); //<! Sets and resets the boost parameter of the spaceship. Bots alternate between boosting and saving boost.
bool bHasTargetPosition_;
Vector3 targetPosition_;
WeakPtr<Pawn> target_;
bool bShooting_;
- int numberOfWeapons; //< Used for weapon init function. Displayes number of weapons available for a bot.
+ int numberOfWeapons; //<! Used for weapon init function. Displayes number of weapons available for a bot.
bool weapons[WeaponSystem::MAX_WEAPON_MODES]; //<! Displays if a weapon is available - managed by setupWeapons()
- int projectiles[WeaponSystem::MAX_WEAPON_MODES]; //<! Displays amount of projectiles. - managed by setupWeapons()
- float botlevel_; //< Makes the level of a bot configurable.
- float timeout_; //< Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
+ int projectiles[WeaponSystem::MAX_WEAPON_MODES]; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
+ float botlevel_; //<! Makes the level of a bot configurable.
+ float timeout_; //<! Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
enum Mode {DEFAULT, ROCKET, DEFENCE, MOVING};//TODO; implement DEFENCE, MOVING modes
Mode mode_; //TODO: replace single value with stack-like implementation: std::vector<Mode> mode_;
Modified: code/branches/ai2/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/ai2/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-07-10 15:46:32 UTC (rev 8740)
+++ code/branches/ai2/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-07-10 19:53:17 UTC (rev 8741)
@@ -325,17 +325,20 @@
void SpaceShip::resetCamera()
{
- Camera *camera = this->getCamera();
+ if(this->hasLocalController() && this->hasHumanController())
+ {
+ Camera *camera = this->getCamera();
- if (camera == 0)
- {
- COUT(2) << "Failed to reset camera!";
- return;
+ if (camera == 0)
+ {
+ COUT(2) << "Failed to reset camera!";
+ return;
+ }
+
+ this->shakeDt_ = 0;
+ camera->setPosition(this->cameraOriginalPosition_);
+ camera->setOrientation(this->cameraOriginalOrientation_);
}
-
- this->shakeDt_ = 0;
- camera->setPosition(this->cameraOriginalPosition_);
- camera->setOrientation(this->cameraOriginalOrientation_);
}
void SpaceShip::backupCamera()
More information about the Orxonox-commit
mailing list