Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2005, 10:30:42 PM (18 years ago)
Author:
bknecht
Message:

spaceship updated

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

Legend:

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

    r5906 r5907  
    115115  travelSpeed = 15.0;
    116116  this->velocity = Vector(0.0,0.0,0.0);
     117  this->velocityDir = Vector(1.0,0.0,0.0);
    117118
    118119//   GLGuiButton* button = new GLGuiPushButton();
     
    280281  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    281282  /* calculate the direction in which the craft is heading  */
    282    Vector forwardDirection (1.0, 0.0, 0.0);
     283   Vector forwardDirection (1.0, 0.0, 0.0); //x
    283284   //direction = this->absDirection.apply (direction);
    284    Vector rightDirection (0.0, 0.0, 1.0);
     285   Vector rightDirection (0.0, 0.0, 0.1); //y
    285286   //orthDirection = orthDirection.cross (direction);
    286    Vector upDirection (0.0, 1.0, 0.0);
     287   Vector upDirection (0.0, 1.0, 0.0); //z
     288   
     289
    287290
    288291
    289292  if( this->bUp )
    290293   {
    291     //if(velocity.len() == 0)
    292      accel += forwardDirection;
    293     //else
    294       //travelSpeed++;
     294      if(travelSpeed <= 5000)  travelSpeed += 10;
    295295   }
    296296
    297297  if( this->bDown )
    298    {
    299     //if(velocity.len() == 0)
    300      accel -= forwardDirection;
    301    // else
    302      //travelSpeed--;
     298   { 
     299     if(travelSpeed >= 10) travelSpeed -= 10;
    303300   }
    304301
    305302  if( this->bLeft /* > -this->getRelCoor().z*2*/)
    306303  {
    307     accel -= rightDirection;
     304    velocityDir -= rightDirection;
     305    velocityDir.normalize();
    308306    //rot +=Vector(1,0,0);
    309307    //rotVal -= .4;
     
    311309  if( this->bRight /* > this->getRelCoor().z*2*/)
    312310  {
    313     accel += rightDirection;
     311    velocityDir += rightDirection;
     312    velocityDir.normalize();
    314313    //rot += Vector(1,0,0);
    315314    //rotVal += .4;
     
    328327  }
    329328
    330   velocity += accel*time;
     329  velocity = velocityDir*(time*travelSpeed);
    331330  //rot.normalize();
    332331  //this->setRelDirSoft(Quaternion(rotVal, rot), 5);
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h

    r5893 r5907  
    5757
    5858    Vector                velocity;           //!< the velocity of the player.
     59    Vector                velocityDir;        //!< the direction of the velocity of the spaceship
    5960    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
    6061    float                 acceleration;       //!< the acceleration of the player.
Note: See TracChangeset for help on using the changeset viewer.