Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5912 in orxonox.OLD


Ignore:
Timestamp:
Dec 4, 2005, 2:39:35 PM (18 years ago)
Author:
bensch
Message:

controll: shiftdir instead of ABS-Dir

File:
1 edited

Legend:

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

    r5911 r5912  
    258258
    259259  //orient the spaceship model in the direction of movement.
    260   if( velocity.len() != 0 )
    261    {
    262      this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)));
    263    }
    264260
    265261  this->shiftCoor (move);
     
    279275  //Vector rot(0.0, 0.0, 0.0);
    280276  //float rotVal = 0.0;
    281 
     277  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    282278  /* calculate the direction in which the craft is heading  */
    283   Vector forwardDirection = (this->getAbsDirX()).getNormalized(); //x
    284    //direction = this->absDirection.apply (direction);
    285   Vector rightDirection = (this->getAbsDirZ()).getNormalized(); //z
    286    //orthDirection = orthDirection.cross (direction);
    287    Vector upDirection = (this->getAbsDirY()).getNormalized(); //y
    288 
    289 
    290 
    291279
    292280  if( this->bUp )
    293281   {
    294      accel += forwardDirection;
     282     this->shiftCoor(this->getAbsDirX());
    295283      //if(travelSpeed <= 5000)  travelSpeed += 10;
    296284   }
     
    298286  if( this->bDown )
    299287   {
    300      accel -=  forwardDirection;
     288     this->shiftCoor(Vector()-this->getAbsDirX());
    301289     //if(travelSpeed >= 10) travelSpeed -= 10;
    302290   }
     
    304292  if( this->bLeft /* > -this->getRelCoor().z*2*/)
    305293  {
    306     accel -= rightDirection;
     294    this->shiftDir(Quaternion(time, Vector(0,1,0)));
     295//    accel -= rightDirection;
    307296    //velocityDir.normalize();
    308297    //rot +=Vector(1,0,0);
     
    311300  if( this->bRight /* > this->getRelCoor().z*2*/)
    312301  {
    313     accel += rightDirection;
     302    this->shiftDir(Quaternion(-time, Vector(0,1,0)));
     303
     304    //    accel += rightDirection;
    314305    //velocityDir.normalize();
    315306    //rot += Vector(1,0,0);
     
    318309  if (this->bAscend )
    319310  {
    320     accel += upDirection;
     311    this->shiftDir(Quaternion(time, Vector(0,0,1)));
     312
     313//    accel += upDirection;
    321314    //velocityDir.normalize();
    322315    //rot += Vector(0,0,1);
     
    325318  if (this->bDescend )
    326319  {
    327     accel -= upDirection;
     320    this->shiftDir(Quaternion(-time, Vector(0,0,1)));
     321
     322    //    accel -= upDirection;
    328323    //velocityDir.normalize();
    329324    //rot += Vector(0,0,1);
Note: See TracChangeset for help on using the changeset viewer.