Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6717 in orxonox.OLD for branches/spaceshipcontrol


Ignore:
Timestamp:
Jan 25, 2006, 4:48:26 PM (19 years ago)
Author:
bknecht
Message:

Control: Helicopter cameranode

Location:
branches/spaceshipcontrol/src/world_entities/space_ships
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.cc

    r6699 r6717  
    124124
    125125  //cycle = 0.0;
     126 
     127  // cameraissue
     128  this->cameraNode.setParent(this);
     129  this->cameraNode.setParentMode(PNODE_ALL);
    126130 
    127131 
     
    193197//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
    194198
    195   this->getWeaponManager()->getFixedTarget()->setParent(this);
    196   this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
     199  this->getWeaponManager()->getFixedTarget()->setParent(&(this->cameraNode));
     200  this->getWeaponManager()->getFixedTarget()->setRelCoor(0,0,0);
    197201
    198202  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
     
    209213}
    210214
    211 
     215void  Helicopter::attachCamera()
     216{
     217  State::getCamera()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     218  State::getCameraTarget()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     219
     220}
    212221
    213222
     
    272281    else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY;
    273282  }
     283 
    274284  // rotorrotation
    275285  this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
     
    506516    this->yMouse = event.yRel*mouseSensitivity;
    507517
    508     this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))/*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))*/);
    509   }
     518    this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0)));
     519   
     520    Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1));
     521
     522   
     523    if ((this->cameraNode.getAbsDirY()).y < 0.8)
     524    {
     525     if((this->cameraNode.getAbsDirX()).y > 0)
     526     {
     527        if(yMouse > 0) this->cameraNode.shiftDir(yDir);;
     528     }
     529     else
     530     {
     531         if(yMouse < 0) this->cameraNode.shiftDir(yDir);;
     532     }
     533    }
     534    else this->cameraNode.shiftDir(yDir);;
     535    }
    510536}
    511537
  • branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.h

    r6699 r6717  
    2626    virtual void enter();
    2727    virtual void leave();
     28    virtual void attachCamera();
    2829
    2930    virtual void postSpawn();
     
    6364    //float                 cycle;              //!< hovercycle
    6465   
    65     PNode                   topRotor;
    66     PNode                   tailRotor;
     66    PNode                 topRotor;
     67    PNode                 tailRotor;
     68   
     69    PNode                 cameraNode;
    6770
    6871    Vector                velocity;           //!< the velocity of the player.
  • branches/spaceshipcontrol/src/world_entities/space_ships/hover.cc

    r6699 r6717  
    110110  PRINTF(4)("HOVER INIT\n");
    111111
    112   this->loadModel("models/ships/nimrod_#.obj", 1.0);
     112  this->loadModel("models/ships/nimrod#.obj", 1.0);
    113113
    114114  EventHandler::getInstance()->grabEvents(true);
Note: See TracChangeset for help on using the changeset viewer.