Changeset 6162 in orxonox.OLD for trunk/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Dec 19, 2005, 4:52:01 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/space_ship.cc
r6078 r6162 119 119 mouseSensitivity = 0.001; 120 120 airViscosity = 1.0; 121 122 121 cycle = 0.0; 123 122 … … 125 124 travelSpeed = 15.0; 126 125 this->velocity = Vector(0.0,0.0,0.0); 127 this-> velocityDir = Vector(1.0,0.0,0.0);126 this->mouseDir = this->getAbsDir(); 128 127 129 128 // GLGuiButton* button = new GLGuiPushButton(); … … 175 174 // this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 176 175 176 this->getWeaponManager()->getFixedTarget()->setParent(this); 177 this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0); 178 177 179 } 178 180 … … 265 267 velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity; 266 268 velocity = (velocity.getNormalized())*travelSpeed; 267 269 270 //orient the spaceship in direction of the mouse 271 rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)*3); 272 if (this->getAbsDir().distance(rotQuat) > 0.001) 273 this->setAbsDir( rotQuat); 274 //this->setAbsDirSoft(mouseDir,5); 275 268 276 // this is the air friction (necessary for a smooth control) 269 277 if(velocity.len() != 0) velocity -= velocity*0.01; … … 293 301 { 294 302 Vector accel(0.0, 0.0, 0.0); 295 //Vector rot(0.0, 0.0, 0.0); 303 /* 304 Vector rot(0.0, 0.0, 0.0); // wird benötigt für Helicopter 305 */ 296 306 //float rotVal = 0.0; 297 307 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ … … 302 312 //this->shiftCoor(this->getAbsDirX()); 303 313 accel += (this->getAbsDirX())*2; 314 315 /* Heli-Steuerung 316 accel += (this->getAbsDirX()*2; 317 if( 318 */ 304 319 } 305 320 … … 331 346 if( this->bRollL /* > -this->getRelCoor().z*2*/) 332 347 { 333 this->shiftDir(Quaternion(-time, Vector(1,0,0)));348 mouseDir *= Quaternion(-time, Vector(1,0,0)); 334 349 // accel -= rightDirection; 335 350 //velocityDir.normalize(); … … 339 354 if( this->bRollR /* > this->getRelCoor().z*2*/) 340 355 { 341 this->shiftDir(Quaternion(time, Vector(1,0,0)));356 mouseDir *= Quaternion(time, Vector(1,0,0)); 342 357 343 358 // accel += rightDirection; … … 407 422 this->xMouse = event.xRel; 408 423 this->yMouse = event.yRel; 409 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 if( xMouse*xMouse + yMouse*yMouse < 0.9) 426 this->setAbsDir(mouseDir); 410 427 } 411 428 }
Note: See TracChangeset
for help on using the changeset viewer.