Changeset 6605 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Jan 18, 2006, 5:50:18 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/hover.cc
r6580 r6605 118 118 xMouse = yMouse = 0; 119 119 mouseSensitivity = 0.05; 120 //rotorspeed = 1; 121 //tailrotorspeed = 0; 122 123 //cycle = 0.0; 124 125 126 //travelSpeed = 15.0; 120 121 127 122 this->velocity = Vector(0.0,0.0,0.0); 128 123 this->velocityDir = Vector(1.0,0.0,0.0); … … 138 133 registerEvent(KeyMapper::PEV_LEFT); 139 134 registerEvent(KeyMapper::PEV_RIGHT); 140 //registerEvent(SDLK_q);141 135 registerEvent(SDLK_e); 142 136 registerEvent(SDLK_c); … … 144 138 registerEvent(KeyMapper::PEV_NEXT_WEAPON); 145 139 registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON); 146 //registerEvent(SDLK_PAGEUP);147 //registerEvent(SDLK_PAGEDOWN);148 140 registerEvent(EV_MOUSE_MOTION); 149 141 … … 249 241 void Hover::tick (float time) 250 242 { 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 */ 243 244 245 Quaternion xDir = Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0)); 246 Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)); 247 248 if ((this->getAbsDirY()).y < 0.8) 249 { 250 if((this->getAbsDirX()).y > 0) 251 { 252 if(yMouse > 0) this->shiftDir(xDir*yDir); 253 else this->shiftDir(xDir); 254 } 255 else 256 { 257 if(yMouse < 0) this->shiftDir(xDir*yDir); 258 else this->shiftDir(xDir); 259 } 260 } 261 else this->shiftDir(xDir*yDir); 262 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 260 266 261 267 // spaceship controlled movement … … 266 272 // this is the air friction (necessary for a smooth control) 267 273 if(velocity.len() != 0) velocity -= velocity*0.1; 268 269 //travelSpeed = velocity.len();270 271 //physics: Gravity272 /*this->shiftCoor(Vector(0,-1,0));273 274 this->shiftCoor(getAbsDirY()*rotorspeed);275 */276 277 /*278 //hoover effect279 cycle += time;280 this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);281 */282 274 283 275 //readjust … … 313 305 314 306 accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z); 315 if((this->getAbsDirX()).y >= -0.1) rotValZ -= time; 316 } 317 else 318 { 319 if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time, Vector(0,0,1))); 307 //if((this->getAbsDirX()).y >= -0.1) rotValZ -= time; 320 308 } 321 309 … … 326 314 327 315 accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z); 328 rotValZ += time; 329 } 330 else 331 { 332 if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time, Vector(0,0,1))); 316 //rotValZ += time; 333 317 } 334 318 … … 340 324 341 325 accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z); 342 rotValX -= time; 343 } 344 else 345 { 346 if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time, Vector(1,0,0))); 347 } 326 //rotValX -= time; 327 } 348 328 349 329 if( this->bRight /* > this->getRelCoor().z*2*/) … … 354 334 355 335 accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z); 356 rotValX += time; 357 } 358 else 359 { 360 if(this->getAbsDirZ().y < -0.02) this->shiftDir(Quaternion(-time, Vector(1,0,0))); 361 } 336 //rotValX += time; 337 } 362 338 363 339 if( this->bRollL /* > -this->getRelCoor().z*2*/) … … 410 386 } 411 387 412 velocity += accel* 3;413 if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));414 if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));388 velocity += accel*4; 389 //if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1))); 390 //if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0))); 415 391 } 416 392 … … 464 440 this->xMouse = event.xRel*mouseSensitivity; 465 441 this->yMouse = event.yRel*mouseSensitivity; 466 467 this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))/*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))*/);468 442 } 469 443 } -
branches/spaceshipcontrol/src/world_entities/space_ships/hover.h
r6572 r6605 58 58 float yMouse; //!< mouse moved in y-Direction 59 59 float mouseSensitivity; //!< the mouse sensitivity 60 //float cycle; //!< hovercycle61 60 62 61 Vector velocity; //!< the velocity of the player. … … 64 63 float travelSpeed; //!< the current speed of the player (to make soft movement) 65 64 float acceleration; //!< the acceleration of the player. 66 //float rotorspeed; //!< the speed of the rotor. 67 //float tailrotorspeed; //!< the relativ speed ot the tail rotor 68 65 69 66 float airViscosity; 70 67
Note: See TracChangeset
for help on using the changeset viewer.