Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 12, 2006, 9:04:23 AM (19 years ago)
Author:
bknecht
Message:

Control: Helicopter and SpaceShip Control

Location:
branches/spaceshipcontrol/src/world_entities/space_ships
Files:
2 edited

Legend:

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

    r6497 r6505  
    410410  }
    411411
    412   velocity += accel;
    413   if((this->getAbsDirX()).y <= 0.2 && (this->getAbsDirX()).y >= -0.2) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));
    414   if((this->getAbsDirZ()).y <= 0.2 && (this->getAbsDirZ()).y >= -0.2) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));
     412  velocity += accel*3;
     413  if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));
     414  if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));
    415415}
    416416
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc

    r6497 r6505  
    136136
    137137  travelSpeed = 15.0;
    138   this->velocity = Vector(0.0,0.0,0.0);
     138  acceleration = 5.0;
     139  this->velocity = this->getAbsDirX()*travelSpeed;
    139140  this->mouseDir = this->getAbsDir();
    140141
     
    275276  this->calculateVelocity(time);
    276277
    277   Vector move = (velocity)*time;
     278  Vector move = velocity.getNormalized()*travelSpeed;
    278279
    279280  //orient the velocity in the direction of the spaceship.
     
    296297
    297298  //readjust
    298 
    299   /*
    300     In the game "Yager" the spaceship gets readjusted when the player moves the mouse.
    301     I (bknecht) go and check it out how they do it, we could probably use this also in Orxonox.
    302   */
    303   //if (xMouse != 0 && yMouse != 0)
    304 
    305299  //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
    306300  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
     
    321315void SpaceShip::calculateVelocity (float time)
    322316{
    323   Vector accel(0.0, 0.0, 0.0);
     317  //Vector accel(0.0, 0.0, 0.0);
    324318  /*
    325319  Vector rot(0.0, 0.0, 0.0); // wird benötigt für Helicopter
     
    334328   {
    335329     //this->shiftCoor(this->getAbsDirX());
    336       accel += (this->getAbsDirX())*2;
     330      //accel += (this->getAbsDirX())*2;
     331      if(travelSpeed < 30) travelSpeed += acceleration*time;
    337332
    338333      /* Heli-Steuerung
     
    345340   {
    346341     //this->shiftCoor((this->getAbsDirX())*-1);
    347      accel -= (this->getAbsDirX())*2;
     342     //accel -= (this->getAbsDirX())*2;
     343     if(travelSpeed >= 0) travelSpeed -= acceleration*time;
    348344   }
    349345
     
    403399  }
    404400
    405   velocity += accel;
     401  //velocity += accel;
    406402  //rot.normalize();
    407403  //this->setRelDirSoft(Quaternion(rotVal, rot), 5);
Note: See TracChangeset for help on using the changeset viewer.