Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2005, 4:52:01 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the spaceshipcontroll branche into the trunk
merged with command
svn merge -r6036:HEAD spaceshipcontrol/ ../trunk/
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6078 r6162  
    119119  mouseSensitivity = 0.001;
    120120  airViscosity = 1.0;
    121 
    122121  cycle = 0.0;
    123122
     
    125124  travelSpeed = 15.0;
    126125  this->velocity = Vector(0.0,0.0,0.0);
    127   this->velocityDir = Vector(1.0,0.0,0.0);
     126  this->mouseDir = this->getAbsDir();
    128127
    129128//   GLGuiButton* button = new GLGuiPushButton();
     
    175174//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
    176175
     176  this->getWeaponManager()->getFixedTarget()->setParent(this);
     177  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
     178
    177179}
    178180
     
    265267  velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
    266268  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   
    268276  // this is the air friction (necessary for a smooth control)
    269277  if(velocity.len() != 0) velocity -= velocity*0.01;
     
    293301{
    294302  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  */
    296306  //float rotVal = 0.0;
    297307  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
     
    302312     //this->shiftCoor(this->getAbsDirX());
    303313      accel += (this->getAbsDirX())*2;
     314     
     315      /* Heli-Steuerung
     316         accel += (this->getAbsDirX()*2;
     317         if(
     318      */
    304319   }
    305320
     
    331346  if( this->bRollL /* > -this->getRelCoor().z*2*/)
    332347  {
    333     this->shiftDir(Quaternion(-time, Vector(1,0,0)));
     348    mouseDir *= Quaternion(-time, Vector(1,0,0));
    334349//    accel -= rightDirection;
    335350    //velocityDir.normalize();
     
    339354  if( this->bRollR /* > this->getRelCoor().z*2*/)
    340355  {
    341     this->shiftDir(Quaternion(time, Vector(1,0,0)));
     356    mouseDir *= Quaternion(time, Vector(1,0,0));
    342357
    343358    //    accel += rightDirection;
     
    407422    this->xMouse = event.xRel;
    408423    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);
    410427  }
    411428}
Note: See TracChangeset for help on using the changeset viewer.