Changeset 6584 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Jan 18, 2006, 4:32:47 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities/space_ships
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.h
r6497 r6584 57 57 float xMouse; //!< mouse moved in x-Direction 58 58 float yMouse; //!< mouse moved in y-Direction 59 int yInvert; 59 60 float mouseSensitivity; //!< the mouse sensitivity 60 61 //float cycle; //!< hovercycle -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
r6559 r6584 128 128 bFire = false; 129 129 xMouse = yMouse = 0; 130 yInvert = 1; 130 131 mouseSensitivity = 0.001; 131 airViscosity = 0. 95;132 controlVelocityX = 2 0;132 airViscosity = 0.01; 133 controlVelocityX = 25; 133 134 controlVelocityY = 150; 134 shipInertia = 3.0;135 shipInertia = 0.5 ; 135 136 // cycle = 0.0; 136 137 … … 276 277 void SpaceShip::tick (float time) 277 278 { 279 if( xMouse != 0 || yMouse != 0) 280 { 281 if (xMouse > controlVelocityX) xMouse = controlVelocityX; 282 else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX; 283 if (yMouse > controlVelocityY) yMouse = controlVelocityY; 284 else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY; 285 286 pitchDir = (Quaternion(xMouse*mouseSensitivity*0.5, Vector(1,0,0))); 287 288 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir); 289 xMouse = yMouse = 0; 290 } 278 291 279 292 // spaceship controlled movement … … 338 351 //this->shiftCoor(this->getAbsDirX()); 339 352 //accel += (this->getAbsDirX())*2; 340 341 353 accel += (this->getAbsDirX())*acceleration; 342 354 … … 426 438 void SpaceShip::process(const Event &event) 427 439 { 428 429 430 440 if( event.type == KeyMapper::PEV_LEFT) 431 441 this->bRollL = event.bPressed; … … 446 456 else if( event.type == EV_MOUSE_MOTION) 447 457 { 448 this->xMouse = event.xRel; 449 this->yMouse = event.yRel; 450 451 452 453 if (xMouse > controlVelocityX) xMouse = controlVelocityX; 454 else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX; 455 if (yMouse > controlVelocityY) yMouse = controlVelocityY; 456 else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY; 457 458 pitchDir = (Quaternion(xMouse*mouseSensitivity*0.5, Vector(1,0,0))); 459 460 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))*pitchDir); 461 // if( xMouse*xMouse + yMouse*yMouse < 0.9) 462 //this->setAbsDir(mouseDir); 458 this->xMouse += event.xRel; 459 this->yMouse += event.yRel; 463 460 } 464 461 } -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h
r6544 r6584 66 66 float yMouse; //!< mouse moved in y-Direction 67 67 float mouseSensitivity; //!< the mouse sensitivity 68 int yInvert; 68 69 int controlVelocityX; 69 70 int controlVelocityY;
Note: See TracChangeset
for help on using the changeset viewer.