Changeset 6699 in orxonox.OLD
- Timestamp:
- Jan 25, 2006, 3:09:58 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities/space_ships
- Files:
-
- 4 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(); -
branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.h
r6637 r6699 59 59 int yInvert; 60 60 float mouseSensitivity; //!< the mouse sensitivity 61 int controlVelocityX; 62 int controlVelocityY; 61 63 //float cycle; //!< hovercycle 64 65 PNode topRotor; 66 PNode tailRotor; 62 67 63 68 Vector velocity; //!< the velocity of the player. -
branches/spaceshipcontrol/src/world_entities/space_ships/hover.cc
r6637 r6699 110 110 PRINTF(4)("HOVER INIT\n"); 111 111 112 this->loadModel("models/ships/ fighter.obj", 1.0);112 this->loadModel("models/ships/nimrod_#.obj", 1.0); 113 113 114 114 EventHandler::getInstance()->grabEvents(true); … … 118 118 xMouse = yMouse = 0; 119 119 mouseSensitivity = 0.05; 120 controlVelocityX = 100; 121 controlVelocityY = 100; 120 122 121 123 … … 241 243 void Hover::tick (float time) 242 244 { 243 244 245 if( xMouse != 0 || yMouse != 0) 246 { 247 if (xMouse > controlVelocityX) xMouse = controlVelocityX; 248 else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX; 249 if (yMouse > controlVelocityY) yMouse = controlVelocityY; 250 else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY; 251 } 252 245 253 Quaternion xDir = Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0)); 246 254 Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)); … … 261 269 else this->shiftDir(xDir*yDir); 262 270 263 if((this->getAbsDirZ()).y > 0.1) this->shiftDir(Quaternion(0.01,Vector(1,0,0))); 264 else if((this->getAbsDirZ()).y < -0.1) this->shiftDir(Quaternion(-0.01,Vector(1,0,0))); 265 271 if((this->getAbsDirZ()).y > 0.05) this->shiftDir(Quaternion(0.02,Vector(1,0,0))); 272 else if((this->getAbsDirZ()).y < -0.05) this->shiftDir(Quaternion(-0.02,Vector(1,0,0))); 266 273 267 274 // spaceship controlled movement -
branches/spaceshipcontrol/src/world_entities/space_ships/hover.h
r6637 r6699 58 58 float yMouse; //!< mouse moved in y-Direction 59 59 float mouseSensitivity; //!< the mouse sensitivity 60 int controlVelocityX; 61 int controlVelocityY; 60 62 61 63 Vector velocity; //!< the velocity of the player.
Note: See TracChangeset
for help on using the changeset viewer.