Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4438 in orxonox.OLD for orxonox/trunk/src/lib/coord/pilot_node.cc


Ignore:
Timestamp:
Jun 1, 2005, 8:15:59 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: pilot node correction in control speed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/pilot_node.cc

    r4424 r4438  
    3434   this->setClassID(CL_PILOT_PARENT, "PilotNode");
    3535
    36    travelSpeed = 60.0;
     36   travelSpeed = 30.0;
    3737   velocity = new Vector();
    3838   bUp = bDown = bLeft = bRight = false;
     
    6666  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    6767  /* calculate the direction in which the craft is heading  */
    68   Vector direction (1.0, 0.0, 0.0);
     68  //Vector direction (1.0, 0.0, 0.0);
    6969  //direction = this->absDirection.apply (direction);
    70   Vector orthDirection (0.0, 0.0, 1.0);
     70  //Vector orthDirection (0.0, 0.0, 1.0);
    7171  //orthDirection = orthDirection.cross (direction);
    7272
    73   if( this->bUp)
    74     accel = accel+(direction*acceleration);
    75   if( this->bDown)
    76     accel = accel -(direction*acceleration);
    77   if( this->bLeft)
    78     accel = accel - (orthDirection*acceleration);
    79   if( this->bRight)
    80     accel = accel + (orthDirection*acceleration);
     73   Quaternion q = this->getAbsDir();
     74   Vector direction(1,0,0);
     75   direction = q.apply(direction);
    8176
    82   Vector move = accel * time;
    83   this->shiftCoor (move);
     77   
    8478
    85   Quaternion q1(M_PI/4 * this->pitch/400.0, Vector(1,0,0));
    86   this->shiftDir(q1);
     79   Vector orthDirection(0,0,1);
     80   orthDirection = q.apply(orthDirection);
     81   
     82   if( this->bUp)
     83     accel = accel+(direction*acceleration);
     84   if( this->bDown)
     85     accel = accel -(direction*acceleration);
     86   if( this->bLeft)
     87     accel = accel - (orthDirection*acceleration);
     88   if( this->bRight)
     89     accel = accel + (orthDirection*acceleration);
     90   
     91   Vector move = accel * time;
     92   this->shiftCoor (move);
     93   
     94   Quaternion q1(-M_PI/4 * this->roll/40000.0, Vector(0,0,1));
     95   Quaternion q2(-M_PI/4 * this->pitch/30000.0, Vector(0,1,0));
     96   //this->shiftDir(q1*q2);
     97   this->shiftDir(q1*q2);
    8798}
    8899
     
    108119  else if( event.type == EV_MOUSE_MOTION)
    109120    {
    110       PRINTF(0)("Mouse moved by %d,%d to (%d,%d)\n", event.xRel, event.yRel,
    111             event.x, event.y);
    112121      this->pitch = event.x - 400;
    113122      this->roll = event.y - 300;
Note: See TracChangeset for help on using the changeset viewer.