Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2007, 7:44:00 PM (18 years ago)
Author:
marcscha
Message:

xml parsing of cam data

File:
1 edited

Legend:

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

    r10271 r10281  
    179179{
    180180  Spike* pj = NULL;
    181 
    182   updateFireDir();
    183 
     181/*  printf( "KA-" );*/
    184182  for ( int i = 0; i < this->getFragments(); i++)
    185183  {
    186184    pj  = new Spike();
    187185    assert( pj );
     186/*    printf(" %i", i);*/
    188187    pj->setParent(PNode::getNullParent());
    189188
    190     dynamic_cast<Spike*>(pj)->setVelocity(this->launcher[i].getNormalized() * 250.0);
     189    pj->setVelocity(this->launcher[i].getNormalized() * 250.0);
    191190
    192191    pj->setParent(PNode::getNullParent());
    193192    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
    194 //     Quaternion q;
    195 //     pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
    196     pj->setRelDir(Quaternion(0, this->launcher[i]));
     193    Quaternion q;
     194    pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
    197195
    198196    pj->toList(this->getOMListNumber());
    199197
     198/*
     199    pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));
     200    pj->setAbsDir(this->getAbsDir());*/
    200201    pj->activate();
    201202  }
     203/*  printf( "BOOM\n" );*/
    202204}
    203205
     
    217219  ca = cos (this->getAngle());
    218220  sa = sin (this->getAngle());
     221// final version below... easier to to cheat with the one above.
    219222
    220223  m[0][0] = nx * nx * (1 - ca) + ca;
     
    230233  float x, y, z;
    231234  for (int i = 0; i < this->getFragments(); i++){
     235//     printf("%i ", i);
    232236    x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z;
    233237    y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z;
     
    236240    this->launcher[i] = Vector (x, y, z);
    237241  }
     242//   printf("\n");
    238243
    239244  for( int i = 0; i < 3 ; i++)
     
    249254void SpikeBall::tick (float dt)
    250255{
    251   Vector v = this->velocity * dt;
     256  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     257  Vector v = this->getVelocity() * dt;
    252258  this->shiftCoor(v);
    253259
     260//   if(this->lifeCycle > .9){
     261// /*    printf("time to blow:  ");*/
     262// //     this->weaponMan->fire();
     263// /*    this->blow();*/
     264//   }
    254265
    255266  if (this->tickLifeCycle(dt)){
     
    259270
    260271  this->updateAngle( dt );
     272//   angle += rotationSpeed * dt;
    261273}
    262274
     
    277289{
    278290  glPushAttrib(GL_ENABLE_BIT);
     291  //glDisable(GL_LIGHTING);
     292
    279293  glMatrixMode(GL_MODELVIEW);
    280294  glPushMatrix();
     
    282296  float matrix[4][4];
    283297  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    284 
    285   this->halo->draw();
    286298
    287299  glRotatef(angle, this->getRotationAxis().x, this->getRotationAxis().y, this->getRotationAxis().z);
     
    290302  this->getModel()->draw();
    291303
     304  this->halo->draw();
     305
    292306  glPopMatrix();
     307
    293308  glPopAttrib();
    294309}
Note: See TracChangeset for help on using the changeset viewer.