Changeset 6114 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities/space_ships
- Timestamp:
- Dec 14, 2005, 5:51:23 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/space_ship.cc
r6051 r6114 117 117 bFire = false; 118 118 xMouse = yMouse = 0; 119 mouseSensitivity = 0.00 5;120 airViscosity = 0.1;119 mouseSensitivity = 0.001; 120 airViscosity = 1.0; 121 121 cycle = 0.0; 122 122 … … 124 124 travelSpeed = 15.0; 125 125 this->velocity = Vector(0.0,0.0,0.0); 126 this-> velocityDir = Vector(1.0,0.0,0.0);126 this->mouseDir = this->getAbsDir(); 127 127 128 128 // GLGuiButton* button = new GLGuiPushButton(); … … 174 174 // this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 175 175 176 this->getWeaponManager()->getFixedTarget()->setParent(this); 177 this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0); 178 176 179 } 177 180 … … 264 267 velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity; 265 268 velocity = (velocity.getNormalized())*travelSpeed; 266 269 270 //orient the spaceship in direction of the mouse 271 Quaternion rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)); 272 if (this->getAbsDir().distance(rotQuat) > 0.001) 273 this->setAbsDir( Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time))); 274 //this->setAbsDirSoft(mouseDir,5); 275 267 276 // this is the air friction (necessary for a smooth control) 268 277 if(velocity.len() != 0) velocity -= velocity*0.01; … … 337 346 if( this->bRollL /* > -this->getRelCoor().z*2*/) 338 347 { 339 this->shiftDir(Quaternion(-time, Vector(1,0,0)));348 mouseDir *= Quaternion(-time, Vector(1,0,0)); 340 349 // accel -= rightDirection; 341 350 //velocityDir.normalize(); … … 345 354 if( this->bRollR /* > this->getRelCoor().z*2*/) 346 355 { 347 this->shiftDir(Quaternion(time, Vector(1,0,0)));356 mouseDir *= Quaternion(time, Vector(1,0,0)); 348 357 349 358 // accel += rightDirection; … … 413 422 this->xMouse = event.xRel; 414 423 this->yMouse = event.yRel; 415 this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 424 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 425 416 426 } 417 427 } -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h
r6034 r6114 8 8 9 9 #include "playable.h" 10 10 11 11 12 template<class T> class tList; … … 64 65 65 66 Vector velocity; //!< the velocity of the player. 66 Vector velocityDir; //!< the direction of the velocity of the spaceship67 Quaternion mouseDir; //!< the direction where the player wants to fly 67 68 float travelSpeed; //!< the current speed of the player (to make soft movement) 68 69 float acceleration; //!< the acceleration of the player.
Note: See TracChangeset
for help on using the changeset viewer.