[Orxonox-commit 3239] r7930 - code/branches/usability/src/orxonox/controllers
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 20 15:28:19 CET 2011
Author: landauf
Date: 2011-02-20 15:28:18 +0100 (Sun, 20 Feb 2011)
New Revision: 7930
Modified:
code/branches/usability/src/orxonox/controllers/HumanController.cc
code/branches/usability/src/orxonox/controllers/HumanController.h
Log:
- fixed crash when calling toggleGodMode command without controllable entity
- added slightly hacky command "myposition" which prints the current position and orientation of the controllable entity in XML format to the console, as a tool for level creators (note: uses the position of the entity, not the camera - use spectator to be sure)
Modified: code/branches/usability/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/usability/src/orxonox/controllers/HumanController.cc 2011-02-20 14:11:30 UTC (rev 7929)
+++ code/branches/usability/src/orxonox/controllers/HumanController.cc 2011-02-20 14:28:18 UTC (rev 7930)
@@ -60,6 +60,7 @@
SetConsoleCommand("HumanController", "killBots", &HumanController::killBots ).addShortcut().defaultValues(0);
SetConsoleCommand("HumanController", "cycleNavigationFocus", &HumanController::cycleNavigationFocus).addShortcut();
SetConsoleCommand("HumanController", "releaseNavigationFocus", &HumanController::releaseNavigationFocus).addShortcut();
+ SetConsoleCommand("HumanController", "myposition", &HumanController::myposition ).addShortcut();
CreateUnloadableFactory(HumanController);
@@ -199,9 +200,22 @@
void HumanController::toggleGodMode()
{
- HumanController::getLocalControllerSingleton()->setGodMode( !HumanController::getLocalControllerSingleton()->getGodMode() );
+ if (HumanController::localController_s)
+ HumanController::localController_s->setGodMode(!HumanController::localController_s->getGodMode());
}
+ void HumanController::myposition()
+ {
+ if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+ {
+ const Vector3& position = HumanController::localController_s->controllableEntity_->getPosition();
+ const Quaternion& orientation = HumanController::localController_s->controllableEntity_->getOrientation();
+
+ COUT(0) << "position=\"" << position.x << ", " << position.y << ", " << position.z << "\" ";
+ COUT(0) << "orientation=\"" << orientation.w << ", " << orientation.x << ", " << orientation.y << ", " << orientation.z << "\"" << std::endl;
+ }
+ }
+
void HumanController::addBots(unsigned int amount)
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype())
Modified: code/branches/usability/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/usability/src/orxonox/controllers/HumanController.h 2011-02-20 14:11:30 UTC (rev 7929)
+++ code/branches/usability/src/orxonox/controllers/HumanController.h 2011-02-20 14:28:18 UTC (rev 7930)
@@ -72,6 +72,7 @@
static void suicide();
static void toggleGodMode();
+ static void myposition();
static void addBots(unsigned int amount);
static void killBots(unsigned int amount = 0);
More information about the Orxonox-commit
mailing list