Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6052 in orxonox.OLD for branches/spaceshipcontrol/src


Ignore:
Timestamp:
Dec 11, 2005, 6:00:58 PM (19 years ago)
Author:
bknecht
Message:

acceleration and brake/backward acceleration does now work

File:
1 edited

Legend:

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

    r6051 r6052  
    246246
    247247  //orient the velocity in the direction of the spaceship.
    248   travelSpeed = velocity.len();
    249   velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
    250   velocity = (velocity.getNormalized())*travelSpeed;
     248  //travelSpeed = velocity.len();
     249  //velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
     250  //velocity = (velocity.getNormalized())*travelSpeed;
    251251
    252252  // this is the air friction (necessary for a smooth control)
    253253  if(velocity.len() != 0) velocity -= velocity*0.01;
     254 
     255  if(this->getAbsDirX().y < -0.2) this->shiftDir(Quaternion(time, Vector(0,0,1)));
     256  else if(this->getAbsDirX().y > 0.2) this->shiftDir(Quaternion(-time, Vector(0,0,1)));
    254257
    255258  //hoover effect
     
    285288   {
    286289     //this->shiftCoor(this->getAbsDirX());
    287       accel += (this->getAbsDirX())*2;
    288       rot += Vector (0,0,1);
    289       rotVal -= .4;
     290     accel += Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
     291     rot += Vector (0,0,1);
     292     rotVal -= .004;
    290293   }
    291294
     
    293296   {
    294297     //this->shiftCoor((this->getAbsDirX())*-1);
    295      accel -= (this->getAbsDirX())*2;
     298     accel -= Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
    296299     rot += Vector (0,0,1);
    297      rotVal += .4;
     300     rotVal += .004;
    298301   }
    299302
     
    304307    //velocityDir.normalize();
    305308    rot +=Vector(1,0,0);
    306     rotVal -= .2;
     309    rotVal -= .002;
    307310  }
    308311  if( this->bRight /* > this->getRelCoor().z*2*/)
     
    313316    //velocityDir.normalize();
    314317    rot += Vector(1,0,0);
    315     rotVal += .2;
     318    rotVal += .002;
    316319  }
    317320
     
    354357  velocity += accel;
    355358  rot.normalize();
    356   this->setRelDirSoft(Quaternion(rotVal, rot), 5);
     359  this->shiftDir(Quaternion(rotVal, rot));
    357360}
    358361
     
    406409    this->xMouse = event.xRel;
    407410    this->yMouse = event.yRel;
    408     this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
     411    //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
    409412  }
    410413}
Note: See TracChangeset for help on using the changeset viewer.