Changeset 1362 for code/trunk/src/orxonox/objects
- Timestamp:
- May 22, 2008, 2:56:48 PM (17 years ago)
- Location:
- code/trunk/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.