Changeset 6509 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities
- Timestamp:
- Jan 16, 2006, 1:09:26 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
r6506 r6509 129 129 xMouse = yMouse = 0; 130 130 mouseSensitivity = 0.001; 131 airViscosity = 1.0;132 cycle = 0.0;131 airViscosity = 0.95; 132 // cycle = 0.0; 133 133 134 134 this->setMaxEnergy(100); 135 135 this->setEnergy(80); 136 136 137 travelSpeed = 15.0;138 acceleration = 5.0;137 travelSpeed = 40.0; 138 acceleration = 3; 139 139 this->velocity = this->getAbsDirX()*travelSpeed; 140 140 this->mouseDir = this->getAbsDir(); 141 this->pitchDir = this->getAbsDir(); 141 142 142 143 // GLGuiButton* button = new GLGuiPushButton(); … … 276 277 this->calculateVelocity(time); 277 278 278 Vector move = velocity .getNormalized()*travelSpeed;279 279 Vector move = velocity*time; 280 280 281 //orient the velocity in the direction of the spaceship. 281 282 travelSpeed = velocity.len(); … … 290 291 291 292 // this is the air friction (necessary for a smooth control) 292 if(velocity.len() != 0) velocity -= velocity*0.01; 293 if(travelSpeed != 0) velocity -= velocity.getNormalized()*travelSpeed*travelSpeed*0.0005; 294 295 //other physics (gravity) 296 if((this->getAbsDirY()).y*travelSpeed < 60 && (this->getAbsDirY()).y>0) 297 move += Vector(0,-1,0)*120*time + Vector(0,2,0)*(this->getAbsDirY()).y*travelSpeed*time; 298 if((this->getAbsDirY()).y*travelSpeed < 60 && (this->getAbsDirY()).y<0) 299 move += Vector(0,-1,0)*120*time - Vector(0,2,0)*(this->getAbsDirY()).y*travelSpeed*time; 293 300 294 301 //hoover effect … … 302 309 //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2); 303 310 304 this->shiftCoor 311 this->shiftCoor(move); 305 312 306 313 this->getWeaponManager()->tick(time); … … 315 322 void SpaceShip::calculateVelocity (float time) 316 323 { 317 //Vector accel(0.0, 0.0, 0.0);324 Vector accel(0.0, 0.0, 0.0); 318 325 /* 319 326 Vector rot(0.0, 0.0, 0.0); // wird benötigt für Helicopter … … 323 330 /* calculate the direction in which the craft is heading */ 324 331 325 Plane plane(Vector(0,1,0), Vector(0,0,0));332 //Plane plane(Vector(0,1,0), Vector(0,0,0)); 326 333 327 334 if( this->bUp ) … … 329 336 //this->shiftCoor(this->getAbsDirX()); 330 337 //accel += (this->getAbsDirX())*2; 331 if(travelSpeed < 30) travelSpeed += acceleration*time; 332 333 /* Heli-Steuerung 334 accel += (this->getAbsDirX()*2; 335 if( 336 */ 338 339 accel += (this->getAbsDirX())*3*acceleration; 340 337 341 } 338 342 … … 341 345 //this->shiftCoor((this->getAbsDirX())*-1); 342 346 //accel -= (this->getAbsDirX())*2; 343 if(travelSpeed >= 0) travelSpeed -= acceleration*time;347 accel -= (this->getAbsDirX())*3*acceleration; 344 348 } 345 349 … … 399 403 } 400 404 401 //velocity += accel;405 velocity += accel; 402 406 //rot.normalize(); 403 407 //this->setRelDirSoft(Quaternion(rotVal, rot), 5); … … 442 446 this->xMouse = event.xRel; 443 447 this->yMouse = event.yRel; 444 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 448 449 int controlVelocity = 150; 450 451 if (xMouse > controlVelocity) xMouse = controlVelocity; 452 else if (xMouse < -controlVelocity) xMouse = -controlVelocity; 453 if (yMouse > controlVelocity) yMouse = controlVelocity; 454 else if (yMouse < -controlVelocity) yMouse = -controlVelocity; 455 456 //pitchDir *= (Quaternion(xMouse*mouseSensitivity*0.01, Vector(1,0,0))); 457 458 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))*pitchDir); 445 459 // if( xMouse*xMouse + yMouse*yMouse < 0.9) 446 460 //this->setAbsDir(mouseDir); -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h
r6443 r6509 66 66 float yMouse; //!< mouse moved in y-Direction 67 67 float mouseSensitivity; //!< the mouse sensitivity 68 float cycle; //!< hovercycle68 // float cycle; //!< hovercycle 69 69 70 70 Vector velocity; //!< the velocity of the player. 71 71 Quaternion mouseDir; //!< the direction where the player wants to fly 72 72 Quaternion rotQuat; 73 Quaternion pitchDir; 73 74 float travelSpeed; //!< the current speed of the player (to make soft movement) 74 75 float acceleration; //!< the acceleration of the player.
Note: See TracChangeset
for help on using the changeset viewer.