Changeset 6936 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities/space_ships
- Timestamp:
- Feb 1, 2006, 2:12:08 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.cc
r6871 r6936 10 10 11 11 ### File Specific: 12 main-programmer: Benjamin Grauer12 main-programmer: Benjamin Knecht 13 13 co-programmer: ... 14 14 … … 93 93 this->addWeapon(cannon, 0, 6); 94 94 95 //this->addWeapon(turret, 3, 0);96 97 95 this->getWeaponManager()->changeWeaponConfig(1); 98 96 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); … … 105 103 void Helicopter::init() 106 104 { 107 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));108 105 this->setClassID(CL_HELICOPTER, "Helicopter"); 109 106 … … 120 117 controlVelocityX = 100; 121 118 controlVelocityY = 100; 122 //rotorspeed = 1; 123 //tailrotorspeed = 0; 124 125 //cycle = 0.0; 126 127 // cameraissue 119 120 121 // initialization of cameraNode 128 122 this->cameraNode.setParent(this); 129 123 this->cameraNode.setParentMode(PNODE_ALL); 130 131 124 this->cameraNode.setRelCoor(Vector(0,1,0)); 125 132 126 // rotors 133 127 this->topRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); … … 145 139 146 140 147 //travelSpeed = 15.0;148 141 this->velocity = Vector(0.0,0.0,0.0); 149 142 this->velocityDir = Vector(1.0,0.0,0.0); 150 // GLGuiButton* button = new GLGuiPushButton(); 151 // button->show(); 152 // button->setLabel("orxonox"); 153 // button->setBindNode(this); 143 144 // very, very old stuff 145 // GLGuiButton* button = new GLGuiPushButton(); 146 // button->show(); 147 // button->setLabel("orxonox"); 148 // button->setBindNode(this); 154 149 155 150 //add events to the eventlist … … 158 153 registerEvent(KeyMapper::PEV_LEFT); 159 154 registerEvent(KeyMapper::PEV_RIGHT); 160 //registerEvent(SDLK_q);161 155 registerEvent(SDLK_e); 162 156 registerEvent(SDLK_c); … … 164 158 registerEvent(KeyMapper::PEV_NEXT_WEAPON); 165 159 registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON); 166 //registerEvent(SDLK_PAGEUP);167 //registerEvent(SDLK_PAGEDOWN);168 160 registerEvent(EV_MOUSE_MOTION); 169 161 … … 187 179 this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5)); 188 180 this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 189 // 190 this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0)); 191 this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 192 // 193 // this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0)); 194 // this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0))); 195 // 196 // this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0)); 197 // this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 181 182 this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0)); 183 this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 198 184 199 185 this->getWeaponManager()->getFixedTarget()->setParent(&(this->cameraNode)); … … 282 268 if(velocity.len() != 0) velocity -= velocity*0.1; 283 269 284 //travelSpeed = velocity.len();285 286 //physics: Gravity287 /*this->shiftCoor(Vector(0,-1,0));288 289 this->shiftCoor(getAbsDirY()*rotorspeed);290 */291 292 /*293 //hoover effect294 cycle += time;295 this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);296 */297 270 298 271 //readjust 299 // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0))); 300 //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0))); 301 302 //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2); 272 // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0))); 273 // else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0))); 274 303 275 304 276 this->shiftCoor (move); 305 //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));306 277 } 307 278 … … 344 315 } 345 316 346 if( this->bLeft /* > -this->getRelCoor().z*2*/)317 if( this->bLeft ) 347 318 { 348 319 //this->shiftDir(Quaternion(time, Vector(0,1,0))); … … 358 329 } 359 330 360 if( this->bRight /* > this->getRelCoor().z*2*/)331 if( this->bRight ) 361 332 { 362 333 //this->shiftDir(Quaternion(-time, Vector(0,1,0))); … … 372 343 } 373 344 374 if( this->bRollL /* > -this->getRelCoor().z*2*/)345 if( this->bRollL ) 375 346 { 376 347 this->shiftDir(Quaternion(-time, Vector(1,0,0))); 377 //accel -= rightDirection; 378 //velocityDir.normalize(); 379 //rot +=Vector(1,0,0); 380 //rotVal -= .4; 381 } 382 if( this->bRollR /* > this->getRelCoor().z*2*/) 348 } 349 if( this->bRollR ) 383 350 { 384 351 this->shiftDir(Quaternion(time, Vector(1,0,0))); 385 386 //accel += rightDirection;387 //velocityDir.normalize();388 //rot += Vector(1,0,0);389 //rotVal += .4;390 352 } 391 353 if (this->bAscend ) 392 354 { 393 //this->shiftDir(Quaternion(time, Vector(0,0,1)));394 395 355 accel += this->getAbsDirY(); 396 //rotorspeed += 0.05;397 //if (rotorspeed >= 2) rotorspeed = 2;398 //velocityDir.normalize();399 //rot += Vector(0,0,1);400 //rotVal += .4;401 }402 else403 {404 //if(rotorspeed >= 1.05) rotorspeed -= 0.05;405 356 } 406 357 407 358 if (this->bDescend ) 408 359 { 409 //this->shiftDir(Quaternion(-time, Vector(0,0,1)));410 411 360 accel -= this->getAbsDirY(); 412 //rotorspeed -= 0.05;413 //if (rotorspeed <= 0) rotorspeed = 0;414 //velocityDir.normalize();415 //rot += Vector(0,0,1);416 //rotVal -= .4;417 }418 else419 {420 //if(rotorspeed <= 0.05) rotorspeed += 0.05;421 361 } 422 362 … … 468 408 this->bRight = event.bPressed; 469 409 else if( event.type == SDLK_e) 470 this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);410 this->bAscend = event.bPressed; 471 411 else if( event.type == SDLK_c) 472 this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);412 this->bDescend = event.bPressed; 473 413 else if( event.type == KeyMapper::PEV_UP) 474 this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);414 this->bUp = event.bPressed; 475 415 else if( event.type == KeyMapper::PEV_DOWN) 476 this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);416 this->bDown = event.bPressed; 477 417 else if( event.type == EV_MOUSE_MOTION) 478 418 { -
branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.h
r6871 r6936 55 55 int yInvert; 56 56 float mouseSensitivity; //!< the mouse sensitivity 57 int controlVelocityX; 58 int controlVelocityY; 59 //float cycle; //!< hovercycle 57 int controlVelocityX; //!< defines max velocity of Xaxis of mousecontrol 58 int controlVelocityY; //!< defines max velocity of Yaxis of mousecontrol 60 59 61 PNode topRotor; 62 PNode tailRotor; 60 PNode topRotor; //!< the position of the toprotor 61 PNode tailRotor; //!< the position of the tailrotor 63 62 64 PNode cameraNode; 63 PNode cameraNode; //!< the position the camera is locked at (used to look up and down without turning the helicopter) 65 64 66 65 Vector velocity; //!< the velocity of the player. … … 68 67 float travelSpeed; //!< the current speed of the player (to make soft movement) 69 68 float acceleration; //!< the acceleration of the player. 70 //float rotorspeed; //!< the speed of the rotor.71 //float tailrotorspeed; //!< the relativ speed ot the tail rotor72 69 73 70 float airViscosity;
Note: See TracChangeset
for help on using the changeset viewer.