Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2005, 10:16:37 PM (19 years ago)
Author:
snellen
Message:

space_ship.cc updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc

    r5981 r6027  
    118118  xMouse = yMouse = 0;
    119119  mouseSensitivity = 0.001;
    120  
     120
    121121  cycle = 0.0;
    122  
     122
    123123
    124124  travelSpeed = 15.0;
     
    264264void SpaceShip::tick (float time)
    265265{
    266      cycle += time;
     266
    267267  // spaceship controlled movement
    268268  this->calculateVelocity(time);
     
    271271
    272272  //orient the spaceship model in the direction of movement.
    273  
     273  travelSpeed = velocity.len();
     274  velocity += this->getAbsDirX();
     275  velocity = (velocity.getNormalized())*travelSpeed;
     276
    274277  // this is the air friction (necessary for a smooth control)
    275278  if(velocity.len() != 0) velocity -= velocity*0.01;
    276  
     279
     280  //hoover effect
     281  cycle += time;
    277282  this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
    278  
    279   if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
    280   else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
    281  
     283
     284  //readjust
     285 // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
     286  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
     287
    282288  //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
    283289
     
    313319   }
    314320
    315   if( this->bLeft /* > -this->getRelCoor().z*2*/)
     321  if( this->bLeft/* > -this->getRelCoor().z*2*/)
    316322  {
    317323    this->shiftDir(Quaternion(time, Vector(0,1,0)));
     
    330336    //rotVal += .4;
    331337  }
    332  
     338
     339
    333340  if( this->bRollL /* > -this->getRelCoor().z*2*/)
    334341  {
     
    388395void SpaceShip::process(const Event &event)
    389396{
    390  
    391  
     397
     398
    392399  if( event.type == SDLK_a)
    393400      this->bRollL = event.bPressed;
Note: See TracChangeset for help on using the changeset viewer.