Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.