Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1362 for code/trunk/src


Ignore:
Timestamp:
May 22, 2008, 2:56:48 PM (17 years ago)
Author:
scheusso
Message:

merged hud3 branch into trunk and changed camera orientation

Location:
code/trunk/src/orxonox
Files:
7 edited
12 copied

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/CMakeLists.txt

    r1293 r1362  
    66  console/InGameConsole.cc
    77  hud/HUD.cc
     8  hud/BarOverlayElement.cc
     9  hud/RadarOverlayElement.cc
     10  hud/RadarObject.cc
    811  particle/ParticleInterface.cc
    912  tolua/tolua_bind.cc
  • code/trunk/src/orxonox/Orxonox.cc

    r1349 r1362  
    348348    // Load the HUD
    349349    COUT(3) << "Orxonox: Loading HUD..." << std::endl;
    350     Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
    351     orxonoxHUD_ = new HUD();
    352     orxonoxHUD_->setEnergyValue(20);
    353     orxonoxHUD_->setEnergyDistr(20,20,60);
    354     hudOverlay->show();
     350    orxonoxHUD_ = new HUD(1);
    355351
    356352    COUT(3) << "Orxonox: Loading Console..." << std::endl;
     
    488484
    489485      // show the current time in the HUD
    490       orxonoxHUD_->setTime((int)now, 0);
    491       orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
     486//      orxonoxHUD_->setTime((int)now, 0);
     487//      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
    492488      if (eventTimes[3].back() - eventTimes[3].front() != 0)
    493         orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front())));
     489//        orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front())));
    494490
    495491      // Iterate through all Tickables and call their tick(dt) function
  • code/trunk/src/orxonox/console/InGameConsole.cc

    r1293 r1362  
    8181    }
    8282
    83     void InGameConsole::execute(){
     83    void InGameConsole::execute(){     
    8484        newline();
    8585        if (!CommandExecutor::execute(this->ib_->get())){
  • code/trunk/src/orxonox/hud/HUD.cc

    r1070 r1362  
    11/*
    2  *   ORXONOX - the hottest 3D action shooter ever to exist
    3  *                    > www.orxonox.net <
    4  *
    5  *
    6  *   License notice:
    7  *
    8  *   This program is free software; you can redistribute it and/or
    9  *   modify it under the terms of the GNU General Public License
    10  *   as published by the Free Software Foundation; either version 2
    11  *   of the License, or (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    21  *
    22  *   Author:
    23  *      Yuning Chai
    24  *   Co-authors:
    25  *      ...
    26  *
    27  */
     2*   ORXONOX - the hottest 3D action shooter ever to exist
     3*
     4*
     5*   License notice:
     6*
     7*   This program is free software; you can redistribute it and/or
     8*   modify it under the terms of the GNU General Public License
     9*   as published by the Free Software Foundation; either version 2
     10*   of the License, or (at your option) any later version.
     11*
     12*   This program is distributed in the hope that it will be useful,
     13*   but WITHOUT ANY WARRANTY; without even the implied warranty of
     14*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15*   GNU General Public License for more details.
     16*
     17*   You should have received a copy of the GNU General Public License
     18*   along with this program; if not, write to the Free Software
     19*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     20*
     21*   Author:
     22*      Yuning Chai
     23*   Co-authors:
     24*      Felix Schulthess
     25*
     26*/
     27
    2828
    2929#include "OrxonoxStableHeaders.h"
     30#include <OgreOverlay.h>
     31#include <OgreOverlayContainer.h>
     32#include <OgreOverlayManager.h>
     33#include <OgreSceneNode.h>
     34#include <OgreEntity.h>
     35#include <OgreStringConverter.h>
     36#include "core/Debug.h"
     37#include "objects/SpaceShip.h"
    3038#include "HUD.h"
    31 
    32 #include <OgreOverlayManager.h>
    33 #include <OgreOverlayElement.h>
    34 #include <OgreStringConverter.h>
    35 
     39#include "BarOverlayElement.h"
     40#include "RadarOverlayElement.h"
     41#include "OverlayElementFactories.h"
    3642
    3743namespace orxonox
    3844{
    39   using namespace Ogre;
     45    using namespace Ogre;
    4046
    41   HUD::HUD(void)
    42   {
    43     init();
     47    HUD::HUD(int zoom){
     48        om = &Ogre::OverlayManager::getSingleton();
    4449
    45     setTime(99,55);
     50                // create Factories
     51        BarOverlayElementFactory *barOverlayElementFactory = new BarOverlayElementFactory();
     52        om->addOverlayElementFactory(barOverlayElementFactory);
     53        RadarOverlayElementFactory *radarOverlayElementFactory = new RadarOverlayElementFactory();
     54        om->addOverlayElementFactory(radarOverlayElementFactory);
    4655
    47     setTargetWindowName("HURRA");
    48     setTargetWindowDistance(12);
    49     setTargetWindowStatus("Dead");
    50     setTargetWindowDistance(30);
     56        orxonoxHUD = om->create("Orxonox/HUD");
     57        container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container"));
     58        // test
     59        test = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "test123"));
     60        test->show();
     61        test->setMetricsMode(Ogre::GMM_RELATIVE);
     62        test->setDimensions(0.8, 0.8);
     63        test->setPosition(0.02, 0.02);
     64        test->setFontName("Console");
     65        test->setCaption("init");
    5166
    52     setEnergyValue(60);
     67        // create energy bar
     68        energyBar = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "energyBar"));
     69        energyBar->show();
     70        // create speedo bar
     71        speedoBar = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "speedoBar"));
     72        speedoBar->show();
     73        // create radar
     74        radar = static_cast<RadarOverlayElement*>(om->createOverlayElement("Radar", "radar"));
     75        radar->show();
    5376
    54     setShieldLeftTopValue(true);
    55     setShieldRightTopValue(false);
    56     setShieldLeftBottomValue(false);
    57     setShieldRightBottomValue(true);
     77                // set up screen-wide container
     78        container->show();
    5879
    59     setRocket1(11);
    60     setRocket2(22);
    61     setRocket3(33);
    62     setRocket4(44);
     80        orxonoxHUD->add2D(container);
     81        orxonoxHUD->show();
     82        container->setLeft(0.0);
     83        container->setTop(0.0);
     84        container->setWidth(1.0);
     85        container->setHeight(1.0);
     86        container->setMetricsMode(Ogre::GMM_RELATIVE);
     87        container->addChild(test);
     88        energyBar->init(0.01, 0.94, 0.4, container);
     89        energyBar->setValue(1);
     90        speedoBar->init(0.01, 0.90, 0.4, container);
     91        radar->init(0.5, 0.9, 0.2, container);
     92        radar->addObject(Vector3(1500.0, 0.0, 100.0));
     93        radar->addObject(Vector3(0.0, 4000.0, 0.0));
     94        radar->addObject(Vector3(0.0, 0.0, 6800.0));
     95        RadarOverlayElement::cycleFocus();
     96    }
    6397
    64     setEnergyDistr(33,33,34);
     98    void HUD::tick(float dt)
     99    {
     100        int d = radar->getDist2Focus()/10;
     101        if(d) test->setCaption("Distance: " + Ogre::StringConverter::toString(d));
     102        else test->setCaption("");
    65103
    66     setPrimar(3);
     104        energyBar->resize();
    67105
    68     energyDistrPixelX_ = 100;
    69     energyDistrPixelY_ = 86;
     106        float v = SpaceShip::instance_s->getVelocity().length();
     107        float vmax = SpaceShip::instance_s->getMaxSpeed();
     108        speedoBar->setValue(v/vmax);
     109        speedoBar->resize();
    70110
    71   }
     111        radar->resize();
     112        radar->update();
     113    }
    72114
    73 
    74   HUD::~HUD( void ){
    75 
    76   }
    77 
    78   void HUD::setTime(int i, int j){
    79     timeMin_=i;
    80     timeSec_=j;
    81     timeText_->setCaption(StringConverter::toString(timeMin_) + ":" + StringConverter::toString(timeSec_));
    82   }
    83 
    84   void HUD::setTargetWindowName(std::string i){
    85     targetWindowName_=i;
    86     targetWindowNameText_->setCaption( targetWindowName_ );
    87   }
    88 
    89   void HUD::setTargetWindowStatus(std::string i){
    90     targetWindowStatus_=i;
    91     targetWindowStatusText_->setCaption( targetWindowStatus_ );
    92   }
    93 
    94   void HUD::setTargetWindowDistance(int i){
    95     targetWindowDistance_=i;
    96     targetWindowDistanceText_->setCaption(StringConverter::toString(targetWindowDistance_) + "km" );
    97   }
    98 
    99   void HUD::setTargetWindowHitRating(int i){
    100     targetWindowHitRating_=i;
    101     targetWindowHitRatingText_->setCaption(StringConverter::toString(targetWindowHitRating_) + "%" );
    102   }
    103 
    104   void HUD::setEnergyValue(int i){
    105     energyValue_=i;
    106     energyLength_->setWidth((int)((float)energyValue_/(float)100*200));
    107   }
    108 
    109   void HUD::setShieldLeftTopValue(bool i){
    110     shieldLeftTopValue_=i;
    111     if (shieldLeftTopValue_) shieldLeftTop_->show();
    112     else shieldLeftTop_->hide();
    113   }
    114 
    115   void HUD::setShieldRightTopValue(bool i){
    116     shieldRightTopValue_=i;
    117     if (shieldRightTopValue_) shieldRightTop_->show();
    118     else shieldRightTop_->hide();
    119   }
    120 
    121   void HUD::setShieldLeftBottomValue(bool i){
    122     shieldLeftBottomValue_=i;
    123     if (shieldLeftBottomValue_) shieldLeftBottom_->show();
    124     else shieldLeftBottom_->hide();
    125   }
    126 
    127   void HUD::setShieldRightBottomValue(bool i){
    128     shieldRightBottomValue_=i;
    129     if (shieldRightBottomValue_) shieldRightBottom_->show();
    130     else shieldRightBottom_->hide();
    131   }
    132 
    133   void HUD::setRocket1(int i){
    134     rocket1_=i;
    135     rocketNum1_->setCaption(StringConverter::toString(rocket1_));
    136   }
    137 
    138   void HUD::setRocket2(int i){
    139     rocket2_=i;
    140     rocketNum2_->setCaption(StringConverter::toString(rocket2_));
    141   }
    142 
    143   void HUD::setRocket3(int i){
    144     rocket3_=i;
    145     rocketNum3_->setCaption(StringConverter::toString(rocket3_));
    146   }
    147 
    148   void HUD::setRocket4(int i){
    149     rocket4_=i;
    150     rocketNum4_->setCaption(StringConverter::toString(rocket4_));
    151   }
    152 
    153   void HUD::setEnergyDistr(float s, float e, float l){
    154     energyDistrShield_=s;
    155     energyDistrEngine_=e;
    156     energyDistrLaser_=l;
    157 
    158     float energyDistrShieldInv_ = 100 - energyDistrShield_;
    159     float energyDistrEngineInv_ = 100 - energyDistrEngine_;
    160     float energyDistrLaserInv_ = 100 - energyDistrLaser_;
    161 
    162     float energyDistrT_ = -energyDistrPixelX_/((energyDistrPixelX_-energyDistrPixelX_/2*energyDistrShieldInv_/(energyDistrShieldInv_+energyDistrEngineInv_))*energyDistrLaserInv_*(energyDistrShieldInv_+energyDistrEngineInv_)/energyDistrShieldInv_/(energyDistrLaserInv_+energyDistrEngineInv_)+energyDistrPixelX_/2+energyDistrPixelX_/2*energyDistrEngineInv_/(energyDistrEngineInv_+energyDistrLaserInv_));
    163     float energyDistrX_ = (-energyDistrPixelX_/2-energyDistrPixelX_/2*energyDistrEngineInv_/(energyDistrEngineInv_+energyDistrLaserInv_))*energyDistrT_;
    164     float energyDistrY_ = energyDistrPixelY_+energyDistrPixelY_*energyDistrLaserInv_/(energyDistrLaserInv_+energyDistrEngineInv_)*energyDistrT_;
    165 
    166     energyDistrPoint_->setLeft((int)energyDistrX_-3);
    167     energyDistrPoint_->setTop((int)energyDistrY_-3);
    168 
    169   }
    170 
    171   void HUD::setPrimar(int i){
    172     primarValue_=i;
    173     if(i==1){
    174       primarChoice_->setLeft(2);
    175       primarChoice_->setWidth(48);
     115    HUD::~HUD(void){
    176116    }
    177     if(i==2){
    178       primarChoice_->setLeft(51);
    179       primarChoice_->setWidth(49);
    180     }
    181     else{
    182       primarChoice_->setLeft(101);
    183       primarChoice_->setWidth(48);
    184     }
    185   }
     117}
    186118
    187119
    188120
    189   void HUD::init(void)
    190   {
    191     timeText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/Time/Text");
    192121
    193     targetWindowNameText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/Name");
    194     targetWindowDistanceText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/DistanceText");
    195     targetWindowStatusText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/StatusText");
    196     targetWindowHitRatingText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/HitRatingText");
    197122
    198     energyLength_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyBackground");
    199123
    200     shieldLeftTop_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldLeftTop");
    201     shieldRightTop_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldRightTop");
    202     shieldLeftBottom_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldLeftBottom");
    203     shieldRightBottom_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldRightBottom");
    204 
    205     rocketNum1_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum1");
    206     rocketNum2_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum2");
    207     rocketNum3_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum3");
    208     rocketNum4_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum4");
    209 
    210     // FIXME: unused vars!
    211     float energyDistrPixelX_ = 100;
    212     float energyDistrPixelY_ = 86;
    213     energyDistrPoint_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyDistrPoint");
    214 
    215     primarChoice_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/PrimarChoice");
    216   }
    217 
    218 }
  • code/trunk/src/orxonox/hud/HUD.h

    r1056 r1362  
    11/*
    2  *   ORXONOX - the hottest 3D action shooter ever to exist
    3  *                    > www.orxonox.net <
    4  *
    5  *
    6  *   License notice:
    7  *
    8  *   This program is free software; you can redistribute it and/or
    9  *   modify it under the terms of the GNU General Public License
    10  *   as published by the Free Software Foundation; either version 2
    11  *   of the License, or (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    21  *
    22  *   Author:
    23  *      Yuning Chai
    24  *   Co-authors:
    25  *      ...
    26  *
    27  */
     2*   ORXONOX - the hottest 3D action shooter ever to exist
     3*
     4*
     5*   License notice:
     6*
     7*   This program is free software; you can redistribute it and/or
     8*   modify it under the terms of the GNU General Public License
     9*   as published by the Free Software Foundation; either version 2
     10*   of the License, or (at your option) any later version.
     11*
     12*   This program is distributed in the hope that it will be useful,
     13*   but WITHOUT ANY WARRANTY; without even the implied warranty of
     14*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15*   GNU General Public License for more details.
     16*
     17*   You should have received a copy of the GNU General Public License
     18*   along with this program; if not, write to the Free Software
     19*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     20*
     21*   Author:
     22*      Yuning Chai
     23*   Co-authors:
     24*      Felix Schulthess
     25*
     26*/
     27
    2828
    2929#ifndef _HUD_H__
    3030#define _HUD_H__
    3131
     32#include <string.h>
     33#include <OgreOverlayElement.h>
     34#include <OgreTextAreaOverlayElement.h>
     35#include <OgrePrerequisites.h>
     36
    3237#include "OrxonoxPrereqs.h"
    33 
    34 #include <string>
    35 
    36 #include <OgrePrerequisites.h>
     38#include "core/Tickable.h"
     39#include "BarOverlayElement.h"
     40#include "RadarOverlayElement.h"
    3741
    3842
    3943namespace orxonox
    4044{
    41   class _OrxonoxExport HUD
    42   {
    43   private:
    44     Ogre::OverlayElement* timeText_;
    45     Ogre::OverlayElement* targetWindowNameText_;
    46     Ogre::OverlayElement* targetWindowStatusText_;
    47     Ogre::OverlayElement* targetWindowDistanceText_;
    48     Ogre::OverlayElement* targetWindowHitRatingText_;
    49     Ogre::OverlayElement* energyLength_;
    50     Ogre::OverlayElement* shieldLeftTop_;
    51     Ogre::OverlayElement* shieldRightTop_;
    52     Ogre::OverlayElement* shieldLeftBottom_;
    53     Ogre::OverlayElement* shieldRightBottom_;
    54     Ogre::OverlayElement* rocketNum1_;
    55     Ogre::OverlayElement* rocketNum2_;
    56     Ogre::OverlayElement* rocketNum3_;
    57     Ogre::OverlayElement* rocketNum4_;
    58     Ogre::OverlayElement* energyDistrPoint_;
    59     Ogre::OverlayElement* primarChoice_;
     45    class _OrxonoxExport HUD : public Tickable
     46    {
     47        private:
     48            Ogre::OverlayManager* om;
     49            Ogre::Overlay* orxonoxHUD;
     50            Ogre::OverlayContainer* container;
     51            Ogre::TextAreaOverlayElement* test;
     52            BarOverlayElement* energyBar;
     53            BarOverlayElement* speedoBar;
     54            RadarOverlayElement* radar;
    6055
    61     int timeMin_;
    62     int timeSec_;
     56        public:
     57            HUD(int zoom);
     58            ~HUD();
     59            virtual void tick(float);
    6360
    64     std::string targetWindowName_;
    65     std::string targetWindowStatus_;
    66     int targetWindowDistance_;
    67     int targetWindowHitRating_;
    68 
    69     int energyValue_;
    70 
    71     bool shieldLeftTopValue_;
    72     bool shieldRightTopValue_;
    73     bool shieldLeftBottomValue_;
    74     bool shieldRightBottomValue_;
    75 
    76     int rocket1_;
    77     int rocket2_;
    78     int rocket3_;
    79     int rocket4_;
    80 
    81     float energyDistrShield_;
    82     float energyDistrEngine_;
    83     float energyDistrLaser_;
    84 
    85     float energyDistrPixelX_;
    86     float energyDistrPixelY_;
    87 
    88     int primarValue_;
    89 
    90   public:
    91     HUD( void );
    92     ~HUD( void );
    93     void init( void );
    94 
    95     void setTime(int i, int j);
    96     void setTargetWindowName(std::string i);
    97     void setTargetWindowStatus(std::string i);
    98     void setTargetWindowDistance(int i);
    99     void setTargetWindowHitRating(int i);
    100     void setEnergyValue(int i);
    101     void setShieldLeftTopValue(bool i);
    102     void setShieldRightTopValue(bool i);
    103     void setShieldLeftBottomValue(bool i);
    104     void setShieldRightBottomValue(bool i);
    105     void setRocket1(int i);
    106     void setRocket2(int i);
    107     void setRocket3(int i);
    108     void setRocket4(int i);
    109     void setEnergyDistr(float s, float e, float l);
    110     void setPrimar(int i);
    111 
    112   };
     61    };
    11362}
    11463
    115 #endif /* _HUD_H__ */
     64#endif
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1360 r1362  
    3030#include "SpaceShip.h"
    3131
    32 #include <string>
    33 
    3432#include <OgreCamera.h>
    3533#include <OgreRenderWindow.h>
     
    3836
    3937#include "CameraHandler.h"
    40 //#include "util/Convert.h"
     38#include "util/Convert.h"
    4139#include "util/Math.h"
    4240#include "core/CoreIncludes.h"
     
    5452{
    5553    ConsoleCommand(SpaceShip, setMaxSpeedTest, AccessLevel::Debug, false);
     54    ConsoleCommand(SpaceShip, whereAmI, AccessLevel::User, true);
    5655    ConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed", AccessLevel::Debug), false);
    5756    ConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber", AccessLevel::Debug), false);
     
    232231      // change camera attributes here, if you want to ;)
    233232    }
    234    
     233
    235234    void SpaceShip::getFocus(){
    236235      COUT(4) << "requesting focus" << std::endl;
    237236      if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID)
    238237        CameraHandler::getInstance()->requestFocus(cam_);
    239      
    240     }
    241    
     238
     239    }
     240
    242241    void SpaceShip::createCamera(){
    243242//       COUT(4) << "begin camera creation" << std::endl;
     
    245244      COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl;
    246245      this->camNode_->setPosition(Vector3(-50,0,10));
    247       Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
    248       Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
    249       camNode_->setOrientation(q1*q2);
     246//      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
     247//      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
     248//      camNode_->setOrientation(q1*q2);
    250249      COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl;
    251250      cam_ = new Camera(this->camNode_);
     
    253252      cam_->setTargetNode(this->getNode());
    254253//        cam->setPosition(Vector3(0,-350,0));
     254      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
     255      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(1,0,0));
     256      camNode_->setOrientation(q2*q1);
    255257      if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){
    256258        this->setBacksync(true);
     
    383385    }
    384386
     387    std::string SpaceShip::whereAmI() {
     388        return getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().x)
     389        + "  " + getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().y)
     390        + "  " + getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().z);
     391    }
     392
     393    Vector3 SpaceShip::getSPosition() {
     394        return SpaceShip::getLocalShip()->getPosition();
     395    }
     396
     397    Quaternion SpaceShip::getSOrientation() {
     398        return SpaceShip::getLocalShip()->getOrientation();
     399    }
     400
     401    float SpaceShip::getMaxSpeed() { return maxSpeed_; }
     402
    385403    void SpaceShip::tick(float dt)
    386404    {
  • code/trunk/src/orxonox/objects/SpaceShip.h

    r1360 r1362  
    2929#ifndef _SpaceShip_H__
    3030#define _SpaceShip_H__
    31 
     31#include <string>
    3232#include "OrxonoxPrereqs.h"
    33 
    3433#include <OgrePrerequisites.h>
    3534
     35#include "util/Math.h"
    3636#include "core/InputInterfaces.h"
    3737#include "Camera.h"
     
    6666
    6767            void getFocus();
    68 
     68            static SpaceShip* instance_s;
     69            static Vector3 getSPosition();
     70            static Quaternion getSOrientation();
     71            static std::string whereAmI();
    6972            static void setMaxSpeedTest(float value)
    7073                { SpaceShip::instance_s->setMaxSpeed(value); }
     
    7679            void mouseScrolled      (int abs, int rel) { }
    7780
     81            float getMaxSpeed();
    7882
    7983        private:
    8084            void createCamera();
    81             static SpaceShip* instance_s;
    8285
    8386            Vector3 testvector_;
     
    8891
    8992            Ogre::SceneNode* camNode_;
    90             Camera* cam_; 
     93            Camera* cam_;
    9194            std::string camName_;
    9295
Note: See TracChangeset for help on using the changeset viewer.