Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2007, 6:15:21 PM (17 years ago)
Author:
nicolasc
Message:

working spikeballs

File:
1 edited

Legend:

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

    r10261 r10271  
    179179{
    180180  Spike* pj = NULL;
    181 /*  printf( "KA-" );*/
     181
     182  updateFireDir();
     183
    182184  for ( int i = 0; i < this->getFragments(); i++)
    183185  {
    184186    pj  = new Spike();
    185187    assert( pj );
    186 /*    printf(" %i", i);*/
    187188    pj->setParent(PNode::getNullParent());
    188189
    189     pj->setVelocity(this->launcher[i].getNormalized() * 250.0);
     190    dynamic_cast<Spike*>(pj)->setVelocity(this->launcher[i].getNormalized() * 250.0);
    190191
    191192    pj->setParent(PNode::getNullParent());
    192193    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
    193     Quaternion q;
    194     pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
     194//     Quaternion q;
     195//     pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
     196    pj->setRelDir(Quaternion(0, this->launcher[i]));
    195197
    196198    pj->toList(this->getOMListNumber());
    197199
    198 /*
    199     pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));
    200     pj->setAbsDir(this->getAbsDir());*/
    201200    pj->activate();
    202201  }
    203 /*  printf( "BOOM\n" );*/
    204202}
    205203
     
    219217  ca = cos (this->getAngle());
    220218  sa = sin (this->getAngle());
    221 // final version below... easier to to cheat with the one above.
    222219
    223220  m[0][0] = nx * nx * (1 - ca) + ca;
     
    233230  float x, y, z;
    234231  for (int i = 0; i < this->getFragments(); i++){
    235 //     printf("%i ", i);
    236232    x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z;
    237233    y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z;
     
    240236    this->launcher[i] = Vector (x, y, z);
    241237  }
    242 //   printf("\n");
    243238
    244239  for( int i = 0; i < 3 ; i++)
     
    254249void SpikeBall::tick (float dt)
    255250{
    256   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    257   Vector v = this->getVelocity() * dt;
     251  Vector v = this->velocity * dt;
    258252  this->shiftCoor(v);
    259253
    260 //   if(this->lifeCycle > .9){
    261 // /*    printf("time to blow:  ");*/
    262 // //     this->weaponMan->fire();
    263 // /*    this->blow();*/
    264 //   }
    265254
    266255  if (this->tickLifeCycle(dt)){
     
    270259
    271260  this->updateAngle( dt );
    272 //   angle += rotationSpeed * dt;
    273261}
    274262
     
    289277{
    290278  glPushAttrib(GL_ENABLE_BIT);
    291   //glDisable(GL_LIGHTING);
    292 
    293279  glMatrixMode(GL_MODELVIEW);
    294280  glPushMatrix();
     
    296282  float matrix[4][4];
    297283  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     284
     285  this->halo->draw();
    298286
    299287  glRotatef(angle, this->getRotationAxis().x, this->getRotationAxis().y, this->getRotationAxis().z);
     
    302290  this->getModel()->draw();
    303291
    304   this->halo->draw();
    305 
    306292  glPopMatrix();
    307 
    308293  glPopAttrib();
    309294}
Note: See TracChangeset for help on using the changeset viewer.