Changeset 6699 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.cc
- Timestamp:
- Jan 25, 2006, 3:09:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.cc
r6637 r6699 36 36 37 37 /** 38 * creates the controlable Spaceship38 * creates the controlable Helicopter 39 39 */ 40 40 Helicopter::Helicopter() … … 44 44 45 45 /** 46 * destructs the spaceship, deletes alocated memory46 * destructs the helicopter, deletes alocated memory 47 47 */ 48 48 Helicopter::~Helicopter () … … 51 51 52 52 /** 53 * loads a Spaceshipsinformation from a specified file.54 * @param fileName the name of the File to load the spaceshipfrom (absolute path)53 * loads a Helicopter information from a specified file. 54 * @param fileName the name of the File to load the helicopter from (absolute path) 55 55 */ 56 56 Helicopter::Helicopter(const char* fileName) … … 108 108 this->setClassID(CL_HELICOPTER, "Helicopter"); 109 109 110 PRINTF(4)(" SPACESHIPINIT\n");110 PRINTF(4)("HELICOPTER INIT\n"); 111 111 112 112 this->loadModel("models/ships/helicopter_#.obj", 1.0); … … 118 118 xMouse = yMouse = 0; 119 119 mouseSensitivity = 0.05; 120 controlVelocityX = 100; 121 controlVelocityY = 100; 120 122 //rotorspeed = 1; 121 123 //tailrotorspeed = 0; 122 124 123 125 //cycle = 0.0; 126 127 128 // rotors 129 this->topRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 130 this->tailRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 131 132 this->topRotor.setParent(this); 133 this->tailRotor.setParent(this); 134 135 this->topRotor.setRelCoor(Vector(-0.877,0.627,0)); 136 this->tailRotor.setRelCoor(Vector(-4.43,0.297,0.068)); 137 this->tailRotor.setAbsDir(Quaternion(M_PI_2,Vector(1,0,0))); 138 139 this->loadModel("models/ships/rotor.obj",1.0,3); 140 this->loadModel("models/ships/rotor.obj",0.15,4); 124 141 125 142 … … 127 144 this->velocity = Vector(0.0,0.0,0.0); 128 145 this->velocityDir = Vector(1.0,0.0,0.0); 129 130 146 // GLGuiButton* button = new GLGuiPushButton(); 131 147 // button->show(); … … 221 237 222 238 /** 223 * the action occuring if the spaceshipleft the game239 * the action occuring if the helicopter left the game 224 240 */ 225 241 void Helicopter::leftWorld () … … 249 265 void Helicopter::tick (float time) 250 266 { 251 /* 252 tailrotorspeed += xMouse/20; 253 if (tailrotorspeed >= 0.07) tailrotorspeed = 0.07; 254 else if (tailrotorspeed <= -0.07) tailrotorspeed = -0.07; 255 256 if (tailrotorspeed > 0.0008) tailrotorspeed -= 0.001; 257 else if (tailrotorspeed < -0.0008) tailrotorspeed += 0.001; 258 if (tailrotorspeed <= 0.001 && tailrotorspeed >= -0.001) tailrotorspeed = 0; 259 */ 267 if( xMouse != 0 || yMouse != 0) 268 { 269 if (xMouse > controlVelocityX) xMouse = controlVelocityX; 270 else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX; 271 if (yMouse > controlVelocityY) yMouse = controlVelocityY; 272 else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY; 273 } 274 // rotorrotation 275 this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0))); 276 this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0))); 260 277 261 278 // spaceship controlled movement … … 419 436 { 420 437 WorldEntity::draw(); 438 439 glMatrixMode(GL_MODELVIEW); 440 glPushMatrix(); 441 442 /* translate */ 443 glTranslatef (this->topRotor.getAbsCoor ().x, 444 this->topRotor.getAbsCoor ().y, 445 this->topRotor.getAbsCoor ().z); 446 Vector tmpRot = this->topRotor.getAbsDir().getSpacialAxis(); 447 glRotatef (this->topRotor.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 448 this->getModel(3)->draw(); 449 450 glPopMatrix (); 451 glPushMatrix(); 452 453 /* translate */ 454 glTranslatef (this->tailRotor.getAbsCoor ().x, 455 this->tailRotor.getAbsCoor ().y, 456 this->tailRotor.getAbsCoor ().z); 457 tmpRot = this->tailRotor.getAbsDir().getSpacialAxis(); 458 glRotatef (this->tailRotor.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 459 this->getModel(4)->draw(); 460 461 glPopMatrix (); 421 462 422 463 this->getWeaponManager()->draw();
Note: See TracChangeset
for help on using the changeset viewer.