Changeset 6034 in orxonox.OLD for trunk/src/world_entities/space_ships
- Timestamp:
- Dec 10, 2005, 11:41:18 PM (19 years ago)
- Location:
- trunk/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/space_ship.cc
r6033 r6034 11 11 ### File Specific: 12 12 main-programmer: Benjamin Knecht 13 co-programmer: ...13 co-programmer: Silvan Nellen 14 14 15 15 */ … … 20 20 #include "space_ship.h" 21 21 22 #include "objModel.h" 22 23 #include "resource_manager.h" 23 24 … … 111 112 PRINTF(4)("SPACESHIP INIT\n"); 112 113 113 EventHandler::getInstance()->grabEvents( false);114 EventHandler::getInstance()->grabEvents(true); 114 115 115 116 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; … … 117 118 xMouse = yMouse = 0; 118 119 mouseSensitivity = 0.001; 120 airViscosity = 1.0; 119 121 120 122 cycle = 0.0; … … 253 255 void SpaceShip::tick (float time) 254 256 { 255 cycle += time; 257 256 258 // spaceship controlled movement 257 259 this->calculateVelocity(time); … … 259 261 Vector move = (velocity)*time; 260 262 261 //orient the spaceship model in the direction of movement. 263 //orient the velocity in the direction of the spaceship. 264 travelSpeed = velocity.len(); 265 velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity; 266 velocity = (velocity.getNormalized())*travelSpeed; 262 267 263 268 // this is the air friction (necessary for a smooth control) 264 269 if(velocity.len() != 0) velocity -= velocity*0.01; 265 270 271 //hoover effect 272 cycle += time; 266 273 this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02); 274 275 //readjust 276 // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0))); 277 //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0))); 267 278 268 279 //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2); … … 299 310 } 300 311 301 if( this->bLeft 312 if( this->bLeft/* > -this->getRelCoor().z*2*/) 302 313 { 303 314 this->shiftDir(Quaternion(time, Vector(0,1,0))); … … 316 327 //rotVal += .4; 317 328 } 329 318 330 319 331 if( this->bRollL /* > -this->getRelCoor().z*2*/) -
trunk/src/world_entities/space_ships/space_ship.h
r5996 r6034 1 2 1 /*! 3 2 * @file space_ship.h … … 69 68 float acceleration; //!< the acceleration of the player. 70 69 70 float airViscosity; 71 71 72 }; 72 73
Note: See TracChangeset
for help on using the changeset viewer.