Changeset 1362 for code/trunk
- Timestamp:
- May 22, 2008, 2:56:48 PM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 9 edited
- 12 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/bin/keybindings.ini
r1349 r1362 154 154 MouseButton6= 155 155 MouseButton7= 156 MouseWheel1Up= #AxisAmp 0.1 slomo157 MouseWheel1Down= #AxisAmp 0.1 slomo156 MouseWheel1Up=AxisAmp 0.1 slomo 157 MouseWheel1Down=AxisAmp 0.1 slomo 158 158 MouseWheel2Up= 159 159 MouseWheel2Down= … … 175 175 JoyAxis4Neg= 176 176 JoyAxis5Pos= 177 JoyAxis5Neg= #AxisAmp 10 slomo | ButtonThreshold 0.9 | onPress exit178 JoyAxis6Pos= #AxisAmp 10 slomo177 JoyAxis5Neg= #AxisAmp 10 slomo | ButtonThreshold 0.9 | onPress exit 178 JoyAxis6Pos= #AxisAmp 10 slomo 179 179 JoyAxis6Neg= 180 180 JoyAxis7Pos= -
code/trunk/bin/levels/sample.oxw
r1293 r1362 11 11 <!--Ambient colourvalue="1,1,1" /--> 12 12 <Skybox src="Orxonox/StarSkyBox" /> 13 <SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="-90,-90,0" mesh="assff.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" /> 14 13 <SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="0,0,0" mesh="assff.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" /> 14 <Model position="1500,0,100" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/> 15 <Model position="0,4200,0" scale="10" mesh="tomato.mesh" yawpitchroll="-50,60,0" rotationAxis="1,0,0" rotationRate="-30"/> 16 <Model position="0,0,6800" scale="10" mesh="tomato.mesh" yawpitchroll="-50,-30,0" rotationAxis="1,0,0" rotationRate="-30"/> 15 17 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/> 16 18 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/> -
code/trunk/src/orxonox/CMakeLists.txt
r1293 r1362 6 6 console/InGameConsole.cc 7 7 hud/HUD.cc 8 hud/BarOverlayElement.cc 9 hud/RadarOverlayElement.cc 10 hud/RadarObject.cc 8 11 particle/ParticleInterface.cc 9 12 tolua/tolua_bind.cc -
code/trunk/src/orxonox/Orxonox.cc
r1349 r1362 348 348 // Load the HUD 349 349 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); 355 351 356 352 COUT(3) << "Orxonox: Loading Console..." << std::endl; … … 488 484 489 485 // 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()); 492 488 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()))); 494 490 495 491 // Iterate through all Tickables and call their tick(dt) function -
code/trunk/src/orxonox/console/InGameConsole.cc
r1293 r1362 81 81 } 82 82 83 void InGameConsole::execute(){ 83 void InGameConsole::execute(){ 84 84 newline(); 85 85 if (!CommandExecutor::execute(this->ib_->get())){ -
code/trunk/src/orxonox/hud/HUD.cc
r1070 r1362 1 1 /* 2 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 License19 * 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 28 28 29 29 #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" 30 38 #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" 36 42 37 43 namespace orxonox 38 44 { 39 using namespace Ogre;45 using namespace Ogre; 40 46 41 HUD::HUD(void) 42 { 43 init(); 47 HUD::HUD(int zoom){ 48 om = &Ogre::OverlayManager::getSingleton(); 44 49 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); 46 55 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"); 51 66 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(); 53 76 54 setShieldLeftTopValue(true); 55 setShieldRightTopValue(false); 56 setShieldLeftBottomValue(false); 57 setShieldRightBottomValue(true); 77 // set up screen-wide container 78 container->show(); 58 79 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 } 63 97 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(""); 65 103 66 setPrimar(3);104 energyBar->resize(); 67 105 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(); 70 110 71 } 111 radar->resize(); 112 radar->update(); 113 } 72 114 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){ 176 116 } 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 } 186 118 187 119 188 120 189 void HUD::init(void)190 {191 timeText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/Time/Text");192 121 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");197 122 198 energyLength_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyBackground");199 123 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 1 1 /* 2 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 License19 * 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 28 28 29 29 #ifndef _HUD_H__ 30 30 #define _HUD_H__ 31 31 32 #include <string.h> 33 #include <OgreOverlayElement.h> 34 #include <OgreTextAreaOverlayElement.h> 35 #include <OgrePrerequisites.h> 36 32 37 #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" 37 41 38 42 39 43 namespace orxonox 40 44 { 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; 60 55 61 int timeMin_; 62 int timeSec_; 56 public: 57 HUD(int zoom); 58 ~HUD(); 59 virtual void tick(float); 63 60 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 }; 113 62 } 114 63 115 #endif /* _HUD_H__ */64 #endif -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1360 r1362 30 30 #include "SpaceShip.h" 31 31 32 #include <string>33 34 32 #include <OgreCamera.h> 35 33 #include <OgreRenderWindow.h> … … 38 36 39 37 #include "CameraHandler.h" 40 //#include "util/Convert.h"38 #include "util/Convert.h" 41 39 #include "util/Math.h" 42 40 #include "core/CoreIncludes.h" … … 54 52 { 55 53 ConsoleCommand(SpaceShip, setMaxSpeedTest, AccessLevel::Debug, false); 54 ConsoleCommand(SpaceShip, whereAmI, AccessLevel::User, true); 56 55 ConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed", AccessLevel::Debug), false); 57 56 ConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber", AccessLevel::Debug), false); … … 232 231 // change camera attributes here, if you want to ;) 233 232 } 234 233 235 234 void SpaceShip::getFocus(){ 236 235 COUT(4) << "requesting focus" << std::endl; 237 236 if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID) 238 237 CameraHandler::getInstance()->requestFocus(cam_); 239 240 } 241 238 239 } 240 242 241 void SpaceShip::createCamera(){ 243 242 // COUT(4) << "begin camera creation" << std::endl; … … 245 244 COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl; 246 245 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); 250 249 COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl; 251 250 cam_ = new Camera(this->camNode_); … … 253 252 cam_->setTargetNode(this->getNode()); 254 253 // 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); 255 257 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ 256 258 this->setBacksync(true); … … 383 385 } 384 386 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 385 403 void SpaceShip::tick(float dt) 386 404 { -
code/trunk/src/orxonox/objects/SpaceShip.h
r1360 r1362 29 29 #ifndef _SpaceShip_H__ 30 30 #define _SpaceShip_H__ 31 31 #include <string> 32 32 #include "OrxonoxPrereqs.h" 33 34 33 #include <OgrePrerequisites.h> 35 34 35 #include "util/Math.h" 36 36 #include "core/InputInterfaces.h" 37 37 #include "Camera.h" … … 66 66 67 67 void getFocus(); 68 68 static SpaceShip* instance_s; 69 static Vector3 getSPosition(); 70 static Quaternion getSOrientation(); 71 static std::string whereAmI(); 69 72 static void setMaxSpeedTest(float value) 70 73 { SpaceShip::instance_s->setMaxSpeed(value); } … … 76 79 void mouseScrolled (int abs, int rel) { } 77 80 81 float getMaxSpeed(); 78 82 79 83 private: 80 84 void createCamera(); 81 static SpaceShip* instance_s;82 85 83 86 Vector3 testvector_; … … 88 91 89 92 Ogre::SceneNode* camNode_; 90 Camera* cam_; 93 Camera* cam_; 91 94 std::string camName_; 92 95
Note: See TracChangeset
for help on using the changeset viewer.