- Timestamp:
- Feb 14, 2006, 3:41:50 PM (19 years ago)
- Location:
- branches/control/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/control/src/world_entities/space_ships/space_ship.cc
r7122 r7138 144 144 xMouse = yMouse = 0; 145 145 yInvert = 1; 146 mouseSensitivity = 0.0 01;147 airViscosity = 0. 9;146 mouseSensitivity = 0.01; 147 airViscosity = 0.8; 148 148 controlVelocityX = 25; 149 149 controlVelocityY = 150; 150 shipInertia = 1.5; 150 shipInertia = M_PI_4; 151 maxRudderAmplitude = 0.6 ; 151 152 // cycle = 0.0; 152 153 … … 176 177 registerEvent(KeyMapper::PEV_LEFT); 177 178 registerEvent(KeyMapper::PEV_RIGHT); 178 //registerEvent(SDLK_q); 179 179 180 //registerEvent(SDLK_e); 181 //registerEvent(SDLK_e); 182 //registerEvent(SDLK_e); 183 //registerEvent(SDLK_e); 184 180 185 registerEvent(KeyMapper::PEV_FIRE1); 181 186 registerEvent(KeyMapper::PEV_NEXT_WEAPON); … … 334 339 { 335 340 Playable::tick(time); 336 337 if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == this->getHostID() ) 341 342 if( ( xMouse != 0 343 || yMouse != 0 ) 344 && this->getOwner() == this->getHostID() ) 338 345 { 339 346 if (xMouse > controlVelocityX) xMouse = controlVelocityX; … … 344 351 pitchDir = (Quaternion(xMouse*mouseSensitivity*0.5, Vector(1,0,0))); 345 352 353 if( fabsf(mouseDir.distance(this->getAbsDir())) < maxRudderAmplitude )//prevent 'jumping' 346 354 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir); 355 347 356 xMouse = yMouse = 0; 348 357 } 349 358 359 350 360 351 361 // if( this != State::getPlayer()->getControllable()) … … 367 377 368 378 //orient the spaceship in direction of the mouse 369 rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);379 rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir,fabsf(time)*shipInertia); 370 380 if (this->getAbsDir().distance(rotQuat) > 0.00000000000001) 371 381 this->setAbsDir( rotQuat); … … 451 461 if( this->bRollL /* > -this->getRelCoor().z*2*/) 452 462 { 463 if( fabsf(mouseDir.distance(this->getAbsDir())) < maxRudderAmplitude )//prevent 'jumping' 453 464 mouseDir *= Quaternion(-time*2, Vector(1,0,0)); 454 465 // accel -= rightDirection; … … 459 470 if( this->bRollR /* > this->getRelCoor().z*2*/) 460 471 { 472 if( fabsf(mouseDir.distance(this->getAbsDir())) < maxRudderAmplitude )//prevent 'jumping' 461 473 mouseDir *= Quaternion(time*2, Vector(1,0,0)); 462 474 -
branches/control/src/world_entities/space_ships/space_ship.h
r7116 r7138 78 78 Quaternion oldMouseDir; //!< the direction where the player wanted to fly 79 79 float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) 80 float maxRudderAmplitude; //!< the higher this value the biger the max rudderamplitude [0...2PI] 80 81 Quaternion rotQuat; 81 82 Quaternion pitchDir;
Note: See TracChangeset
for help on using the changeset viewer.