Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 20, 2011, 3:28:18 PM (14 years ago)
Author:
landauf
Message:
  • 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)
Location:
code/branches/usability/src/orxonox/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/orxonox/controllers/HumanController.cc

    r7863 r7930  
    6161    SetConsoleCommand("HumanController", "cycleNavigationFocus",   &HumanController::cycleNavigationFocus).addShortcut();
    6262    SetConsoleCommand("HumanController", "releaseNavigationFocus", &HumanController::releaseNavigationFocus).addShortcut();
     63    SetConsoleCommand("HumanController", "myposition",             &HumanController::myposition    ).addShortcut();
    6364
    6465    CreateUnloadableFactory(HumanController);
     
    200201    void HumanController::toggleGodMode()
    201202    {
    202         HumanController::getLocalControllerSingleton()->setGodMode( !HumanController::getLocalControllerSingleton()->getGodMode() );
     203        if (HumanController::localController_s)
     204            HumanController::localController_s->setGodMode(!HumanController::localController_s->getGodMode());
     205    }
     206
     207    void HumanController::myposition()
     208    {
     209        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     210        {
     211            const Vector3& position = HumanController::localController_s->controllableEntity_->getPosition();
     212            const Quaternion& orientation = HumanController::localController_s->controllableEntity_->getOrientation();
     213
     214            COUT(0) << "position=\"" << position.x << ", " << position.y << ", " << position.z << "\" ";
     215            COUT(0) << "orientation=\"" << orientation.w << ", " << orientation.x << ", " << orientation.y << ", " << orientation.z << "\"" << std::endl;
     216        }
    203217    }
    204218
  • code/branches/usability/src/orxonox/controllers/HumanController.h

    r7533 r7930  
    7373            static void suicide();
    7474            static void toggleGodMode();
     75            static void myposition();
    7576
    7677            static void addBots(unsigned int amount);
Note: See TracChangeset for help on using the changeset viewer.