Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6803 in orxonox.OLD for trunk/src/world_entities/space_ships


Ignore:
Timestamp:
Jan 28, 2006, 11:14:40 AM (19 years ago)
Author:
bensch
Message:

trunk: WeaponManager fix

Location:
trunk/src/world_entities/space_ships
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/hover.cc

    r6801 r6803  
    3434
    3535CREATE_FACTORY(Hover, CL_HOVER);
    36 
    37 /**
    38  *  creates the controlable Hover
    39  */
    40 Hover::Hover()
    41 {
    42   this->init();
    43 }
    4436
    4537/**
     
    9183  this->addWeapon(wpLeft, 1, 0);
    9284  this->addWeapon(wpRight,1 ,1);
    93   this->addWeapon(cannon, 0, 6);
    94 
    95   //this->addWeapon(turret, 3, 0);
     85  this->addWeapon(cannon, 0, 2);
    9686
    9787  this->getWeaponManager()->changeWeaponConfig(1);
     
    134124
    135125  // rotors
    136   this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     126  this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT );
     127  this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    137128  this->wingNodeLeft.setParent(this);
    138129  this->wingNodeLeft.setRelCoor(-1.5, -.3, -1.0);
     
    142133
    143134  this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     135  this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    144136  this->wingNodeRight.setParent(this);
    145137  this->wingNodeRight.setRelCoor(-1.5, -0.3, 1.0);
     
    148140  this->rotorNodeRight.setRelCoor(0, 1.0, 2.3);
    149141
     142  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
     143
    150144  this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3);
    151145  this->loadModel("models/ships/hoverglider_rotor.obj", 1.0f, 4);
     
    155149  this->velocity = Vector(0.0,0.0,0.0);
    156150  this->velocityDir = Vector(1.0,0.0,0.0);
    157 //   GLGuiButton* button = new GLGuiPushButton();
    158 //   button->show();
    159 //   button->setLabel("orxonox");
    160 //   button->setBindNode(this);
    161151
    162152  //add events to the eventlist
     
    175165  registerEvent(EV_MOUSE_MOTION);
    176166
    177   this->getWeaponManager()->setSlotCount(7);
    178 
    179   this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     167
     168  // WEAPON_MANAGER configuration
     169  this->getWeaponManager()->setSlotCount(5);
     170
     171  this->getWeaponManager()->setSlotPosition(0, Vector(-0.28, 1.186, -2.750), &this->wingNodeLeft);
    180172  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    181173
    182   this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
     174  this->getWeaponManager()->setSlotPosition(1, Vector(-0.28, 1.186, 2.750), &this->wingNodeRight);
    183175  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    184176
    185   this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
    186   this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
    187 
    188   this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
    189   this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
    190 
    191   this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
    192   this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
    193 
    194   this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
    195   this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    196 //
    197    this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
    198    this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    199    //
    200 //   this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    201 //   this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
    202 //
    203 //   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    204 //   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
     177  this->getWeaponManager()->setSlotPosition(2, Vector(-1.63, .809, -.003));
     178  this->getWeaponManager()->setSlotCapability(2, WTYPE_HEAVY);
     179
     180  /// TODO: THESE ARE TOO MUCH
     181  this->getWeaponManager()->setSlotPosition(3, Vector(-1.63, .678, -.652));
     182  this->getWeaponManager()->setSlotDirection(3, Quaternion(-24/180 * M_PI, Vector(1,0,0)));
     183
     184  this->getWeaponManager()->setSlotPosition(4, Vector(-1.63, .678, .652));
     185  this->getWeaponManager()->setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0)));
    205186
    206187  this->getWeaponManager()->getFixedTarget()->setParent(&(this->cameraNode));
    207   this->getWeaponManager()->getFixedTarget()->setRelCoor(0,0,0);
    208 
    209   dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
    210 
    211188}
    212189
     
    222199void  Hover::attachCamera()
    223200{
    224   State::getCamera()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     201  State::getCamera()->setParentSoft(&this->cameraNode);
    225202  State::getCameraTarget()->setParentSoft(this->getWeaponManager()->getFixedTarget());
    226203
     
    285262  }
    286263
    287   // rotorrotation
    288 //   this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    289 //   this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    290 
    291264  // spaceship controlled movement
    292265  this->calculateVelocity(time);
     
    296269  // this is the air friction (necessary for a smooth control)
    297270  if(velocity.len() != 0) velocity -= velocity*0.1;
    298 
    299   //travelSpeed = velocity.len();
    300 
    301   //physics: Gravity
    302   /*this->shiftCoor(Vector(0,-1,0));
    303 
    304   this->shiftCoor(getAbsDirY()*rotorspeed);
    305   */
    306 
    307   /*
    308   //hoover effect
    309   cycle += time;
    310   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
    311   */
    312 
    313   //readjust
    314  // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
    315   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
    316 
    317   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
    318 
    319271  this->shiftCoor (move);
    320   //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
    321272
    322273  this->getWeaponManager()->tick(time);
  • trunk/src/world_entities/space_ships/hover.h

    r6800 r6803  
    1414  public:
    1515
    16     Hover();
    1716    Hover(const char* fileName);
    18     Hover(const TiXmlElement* root);
     17    Hover(const TiXmlElement* root = NULL);
    1918    virtual ~Hover();
    2019
    21     void init();
    2220    virtual void loadParams(const TiXmlElement* root);
    2321
     
    3432
    3533    virtual void process(const Event &event);
     34
     35  private:
     36    void init();
    3637
    3738  private:
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6764 r6803  
    132132
    133133  this->getWeaponManager()->changeWeaponConfig(1);
    134 
    135   EventHandler::getInstance()->grabEvents(true);
    136134
    137135  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
     
    143141  controlVelocityX = 25;
    144142  controlVelocityY = 150;
    145   shipInertia = 1.5             ;
     143  shipInertia = 1.5;
    146144//  cycle = 0.0;
    147145
Note: See TracChangeset for help on using the changeset viewer.