Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1924 in orxonox.OLD for orxonox/trunk/core/shoot_rocket.cc


Ignore:
Timestamp:
Jun 8, 2004, 6:30:23 PM (20 years ago)
Author:
bensch
Message:

orxonox/truk/core: added support for different types of rockets, and implemented Side-Accelerators :) I think they really rock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/core/shoot_rocket.cc

    r1921 r1924  
    4848      glPushMatrix();
    4949      glTranslatef(tmpShoot->xCor, tmpShoot->yCor, tmpShoot->zCor);
    50       tmpShoot->xCor+=tmpShoot->xVel;
    51       tmpShoot->yCor+=tmpShoot->yVel;
    52       tmpShoot->xVel+=tmpShoot->xAcc;
    53       tmpShoot->yVel+=tmpShoot->yAcc;
    54      
     50      switch (tmpShoot->type)
     51        {
     52        case BACKPARABLE:
     53          tmpShoot->xCor+=tmpShoot->xVel;
     54          tmpShoot->yCor+=tmpShoot->yVel;
     55          tmpShoot->xVel+=tmpShoot->xAcc;
     56          tmpShoot->yVel+=tmpShoot->yAcc;
     57          break;
     58       
     59        case SIDEACC:
     60          if (tmpShoot->xVel >= .01 || tmpShoot->xVel <= -.01)
     61            {
     62              tmpShoot->xCor+=tmpShoot->xVel;
     63              tmpShoot->xVel*=tmpShoot->xAcc;
     64            }
     65          else
     66            {
     67              tmpShoot->yCor+=tmpShoot->yVel;
     68              tmpShoot->yVel+=tmpShoot->yVel*tmpShoot->yAcc;
     69            }
     70          break;
     71        }
     72         
    5573      glScalef(0.1, 0.1, 0.1);
    5674      glutWireCube(1.0);
     
    112130}
    113131
    114 void ShootRocket::addShoot(float x, float y, float z)
     132void ShootRocket::addBackParable(float x, float y, float z)
    115133{
    116134  inhibitor++;
     
    119137      //cout << "ShootRocket::addShoot" << endl;
    120138      shoot* sh = new shoot;
     139      sh->type = BACKPARABLE;
    121140      sh->xCor = x; sh->yCor = y; sh->zCor = z;
    122141      sh->xVel = (-1+(float)random() / 1000000000/step)/5;
     
    129148    }
    130149}
     150void ShootRocket::addSideAcc(float x, float y, float z, enum RocketDirection direction)
     151{
     152  inhibitor++;
     153  if (inhibitor >= 10)
     154    {
     155      //cout << "ShootRocket::addShoot" << endl;
     156      shoot* sh = new shoot;
     157      sh->type = SIDEACC;
     158      sh->xCor = x; sh->yCor = y; sh->zCor = z;
     159      switch (direction)
     160        {
     161        case LEFT:
     162          sh->xVel = -.3; sh->yVel = .05; sh->zVel = 0;
     163           cout << "Left\n";
     164          break;
     165        case RIGHT:
     166          sh->xVel = .3; sh->yVel = .05; sh->zVel = 0;
     167          break;
     168        }
     169      sh->xAcc = .9; sh->yAcc = .02; sh->zAcc = 0;
     170      sh->next = lastShoot;
     171      lastShoot = sh;
     172      inhibitor =0;
     173    }
     174}
    131175
    132 void ShootRocket::addShootExt(float x, float y, float z,
    133                              float xVel, float yVel, float zVel)
    134 {
    135   //cout << "ShootRocket::addShootExtended" << endl;
    136   shoot* sh = new shoot;
    137   sh->xCor = x; sh->yCor = y; sh->zCor = z;
    138   sh->xVel = xVel/step; sh->yVel = yVel/step; sh->zVel = zVel/step;
    139   sh->xAcc = 0; sh->yAcc = .02; sh->zAcc = 0;
    140   sh->next = lastShoot;
    141   lastShoot = sh;
    142 }
    143176
    144177void ShootRocket::setShootStep(float step)
Note: See TracChangeset for help on using the changeset viewer.