Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2006, 1:51:44 PM (17 years ago)
Author:
nicolasc
Message:

added some comments
made swarm missile spin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10035 r10037  
    3838
    3939/*  this->loadModel("models/projectiles/orx-rocket.obj", 0.5);*/
    40   this->loadModel("models/projectiles/swarm_projectile.obj");
     40  this->loadModel("models/projectiles/swarm_projectile.obj"); // no double rescale (see draw())
    4141  this->loadExplosionSound("sound/explosions/explosion_4.wav");
    4242
     
    5151  this->emitter->setParent(this);
    5252  this->emitter->setSpread(M_PI, M_PI);
     53
     54  this->rotationSpeed = 100;
     55  this->angle = 0;
    5356}
    5457
     
    214217    velocity *= maxVelocity / velocity.len(); // set speed to max
    215218
     219
    216220  this->shiftCoor(velocity * time);
    217221
    218222  if(this->tickLifeCycle(time))
    219223    this->deactivate();
     224
     225  this->updateAngle(time);
    220226}
    221227
     
    239245}
    240246
     247void SwarmProjectile::updateAngle(float time)
     248{
     249  this->angle += this->rotationSpeed * time;
     250}
    241251
    242252void SwarmProjectile::draw () const
     
    247257  float matrix[4][4];
    248258  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     259  glRotatef(this->angle, 1.0f, 0.0f, 0.0f); //spinning missile
    249260  this->getAbsDir().matrix (matrix);
    250261  glMultMatrixf((float*)matrix);
    251   //glScalef(2.0, 2.0, 2.0);
     262  //glScalef(2.0, 2.0, 2.0);  // no double rescale
    252263  this->getModel()->draw();
    253264
Note: See TracChangeset for help on using the changeset viewer.