Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2005, 3:06:29 PM (19 years ago)
Author:
bknecht
Message:

Control: more realistic helicopter-control

File:
1 edited

Legend:

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

    r6222 r6232  
    137137  registerEvent(SDLK_q);
    138138  registerEvent(SDLK_e);
     139  registerEvent(SDLK_c);
    139140  registerEvent(KeyMapper::PEV_FIRE1);
    140141  registerEvent(KeyMapper::PEV_NEXT_WEAPON);
     
    266267  if(velocity.len() != 0) velocity -= velocity*0.1;
    267268
     269  //physics: Gravity
     270  this->shiftCoor(Vector(0,-0.05,0));
    268271
    269272  //hoover effect
     
    300303     //this->shiftCoor(this->getAbsDirX());
    301304
    302      accel += Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
    303      if((this->getAbsDirX()).y > -.2)
    304      {
    305        rot += Vector (0,0,1);
    306        rotVal -= time/5;
    307      }
     305     accel += this->getAbsDirX()*2;
     306     rot += Vector (0,0,1);
     307     rotVal -= time/8;
    308308   }
    309309   else
    310310   {
    311        if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/5, Vector(0,0,1)));
     311       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/8, Vector(0,0,1)));
    312312   }
    313313
     
    315315   {
    316316     //this->shiftCoor((this->getAbsDirX())*-1);
    317      accel -= Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
    318      if((this->getAbsDirX()).y < .2)
    319      {
    320        rot += Vector (0,0,1);
    321        rotVal += time/5;
    322      }
     317     accel -= this->getAbsDirX()*2;
     318     rot += Vector (0,0,1);
     319     rotVal += time/8;
    323320   }
    324321   else
    325322   {
    326          if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(-time/5, Vector(0,0,1)));
     323         if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time/8, Vector(0,0,1)));
    327324   }
    328325
     
    330327  {
    331328    //this->shiftDir(Quaternion(time, Vector(0,1,0)));
    332     accel -= Vector(this->getAbsDirZ().x,0,this->getAbsDirZ().z).getNormalized()*2;
    333     //velocityDir.normalize();
    334     if((this->getAbsDirZ()).y < .2)
    335     {
    336       rot +=Vector(1,0,0);
    337       rotVal -= time/5;
    338     }
     329    accel -= this->getAbsDirZ()*2;
     330    //velocityDir.normalize();
     331    rot += Vector(1,0,0);
     332    rotVal -= time/8;
    339333  }
    340334  else
     
    346340  {
    347341    //this->shiftDir(Quaternion(-time, Vector(0,1,0)));
    348 
    349     accel += Vector(this->getAbsDirZ().x,0,this->getAbsDirZ().z).getNormalized()*2;
    350     //velocityDir.normalize();
    351     if((this->getAbsDirZ()).y > -.2)
    352     {
    353       rot += Vector(1,0,0);
    354       rotVal += time/5;
    355     }
     342    accel += this->getAbsDirZ()*2;
     343    //velocityDir.normalize();
     344    rot += Vector(1,0,0);
     345    rotVal += time/5;
    356346  }
    357347  else
     
    381371    //this->shiftDir(Quaternion(time, Vector(0,0,1)));
    382372
    383     accel += (this->getAbsDirY())*2;
     373    accel += (this->getAbsDirY())*3;
    384374    //velocityDir.normalize();
    385375    //rot += Vector(0,0,1);
     
    390380    //this->shiftDir(Quaternion(-time, Vector(0,0,1)));
    391381
    392     accel -= (this->getAbsDirY())*2;
     382    accel -= (this->getAbsDirY())*3;
    393383    //velocityDir.normalize();
    394384    //rot += Vector(0,0,1);
Note: See TracChangeset for help on using the changeset viewer.