Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 8, 2004, 7:41:44 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/core: added modulated phase variance-shot

File:
1 edited

Legend:

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

    r1925 r1926  
    3131  step = 1.0;
    3232  inhibitor =0;
     33  rotateAngle = 0.0;
    3334}
    3435
     
    7172            }
    7273          break;
     74       
     75        case ROTATER:
     76          // tmpShoot->xCor+=tmpShoot->xVel;
     77          tmpShoot->yCor+=tmpShoot->yVel;
     78          //tmpShoot->zCor+=tmpShoot->zVel;
     79          //tmpShoot->xVel+=tmpShoot->xVel;
     80          break;
     81       
    7382        }
    74          
     83     
    7584      glScalef(0.1, 0.1, 0.1);
    7685      glutWireCube(1.0);
     
    134143void ShootRocket::addBackParable(float x, float y, float z)
    135144{
    136   inhibitor++;
    137   if (inhibitor >= 10)
     145 
     146  //cout << "ShootRocket::addShoot" << endl;
     147  shoot* sh = new shoot;
     148  sh->type = BACKPARABLE;
     149  sh->xCor = x; sh->yCor = y; sh->zCor = z;
     150  sh->xVel = (-1+(float)random() / 1000000000/step)/5;
     151  sh->yVel = -.3;
     152  sh->zVel = (1-(float)random() / 1000000000/step)/5;
     153  sh->xAcc = 0; sh->yAcc = .01/step; sh->zAcc = 0;
     154  sh->next = lastShoot;
     155  lastShoot = sh;
     156  inhibitor =0;
     157}
     158void ShootRocket::addSideAcc(float x, float y, float z, enum RocketDirection direction)
     159{
     160  //cout << "ShootRocket::addShoot" << endl;
     161  shoot* sh = new shoot;
     162  sh->type = SIDEACC;
     163  sh->xCor = x; sh->yCor = y; sh->zCor = z;
     164  switch (direction)
    138165    {
    139       //cout << "ShootRocket::addShoot" << endl;
    140       shoot* sh = new shoot;
    141       sh->type = BACKPARABLE;
    142       sh->xCor = x; sh->yCor = y; sh->zCor = z;
    143       sh->xVel = (-1+(float)random() / 1000000000/step)/5;
    144       sh->yVel = -.3;
    145       sh->zVel = (1-(float)random() / 1000000000/step)/5;
    146       sh->xAcc = 0; sh->yAcc = .01/step; sh->zAcc = 0;
    147       sh->next = lastShoot;
    148       lastShoot = sh;
    149       inhibitor =0;
     166    case LEFT:
     167      sh->xVel = -.5; sh->yVel = .05; sh->zVel = 0;
     168      break;
     169    case RIGHT:
     170      sh->xVel = .5; sh->yVel = .05; sh->zVel = 0;
     171      break;
    150172    }
    151 }
    152 void ShootRocket::addSideAcc(float x, float y, float z, enum RocketDirection direction)
    153 {
    154   inhibitor++;
    155   if (inhibitor >= 10)
    156     {
    157       //cout << "ShootRocket::addShoot" << endl;
    158       shoot* sh = new shoot;
    159       sh->type = SIDEACC;
    160       sh->xCor = x; sh->yCor = y; sh->zCor = z;
    161       switch (direction)
    162         {
    163         case LEFT:
    164           sh->xVel = -.5; sh->yVel = .05; sh->zVel = 0;
    165           break;
    166         case RIGHT:
    167           sh->xVel = .5; sh->yVel = .05; sh->zVel = 0;
    168           break;
    169         }
    170       sh->xAcc = .9; sh->yAcc = .02; sh->zAcc = 0;
    171       sh->next = lastShoot;
    172       lastShoot = sh;
    173       inhibitor =0;
    174     }
    175 }
    176 
     173  sh->xAcc = .9; sh->yAcc = .02; sh->zAcc = 0;
     174  sh->next = lastShoot;
     175  lastShoot = sh;
     176  inhibitor =0;
     177
     178}
     179void ShootRocket::addRotater(float x, float y, float z)
     180{
     181 
     182  static float radius = 2;
     183  rotateAngle+=.5;
     184  //cout << "ShootRocket::addShoot" << endl;
     185  shoot* sh = new shoot;
     186  sh->type = ROTATER;
     187  sh->xCor = x+radius*sin(rotateAngle); sh->yCor = y; sh->zCor = z+radius*cos(rotateAngle);
     188  sh->xVel = .05*sin(rotateAngle);
     189  sh->yVel = .4;
     190  sh->xVel = .05*cos(rotateAngle);
     191  sh->xAcc = 0; sh->yAcc = .01/step; sh->zAcc = 0;
     192  sh->next = lastShoot;
     193  lastShoot = sh;
     194  inhibitor =0;
     195}
    177196
    178197void ShootRocket::setShootStep(float step)
Note: See TracChangeset for help on using the changeset viewer.