Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10683 in orxonox.OLD


Ignore:
Timestamp:
Jun 10, 2007, 12:17:06 AM (17 years ago)
Author:
rennerc
Message:

adm turret works now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/adm/src/world_entities/npcs/adm_turret.cc

    r10681 r10683  
    7878        }
    7979//         this->removeNodeFlags( PNODE_ALL );
    80 //         this->addNodeFlags( PNODE_ROTATE_AND_MOVE );
     80        this->addNodeFlags( PNODE_ROTATE_AND_MOVE );
     81        this->addNodeFlags( PNODE_REPARENT_KEEP_POSITION );
     82       
     83        //HACK this is needed to get the correct coordinates instead (0, 0, 0)
     84        this->updateNode( 0 );
    8185       
    8286        if ( this->isCeil )
     
    139143
    140144  //rotate sensor 2PI/sec
    141   this->sensor->setAbsDir( this->sensor->getAbsDir() * Quaternion( PI*2*dt, Vector( 0, 1, 0 ) ) );
     145  this->sensor->setAbsDir( this->sensor->getAbsDir() * Quaternion( PI*2*dt, Vector( 0, -1, 0 ) ) );
    142146
    143147
     
    252256{
    253257  if ( this->cannons->getParent() != NullParent::getNullParent() )
     258  {
    254259    this->cannons->setParent( NullParent::getNullParent() );
     260    this->cannons->shiftCoor( this->getAbsCoor() );
     261   
     262    this->sensor->setParent( NullParent::getNullParent() );
     263    this->sensor->shiftCoor( this->getAbsCoor() );
     264  }
    255265 
    256266  targetDir.normalize();
     
    264274  float bestCannonAngle = 0.0f;
    265275 
    266 //   Quaternion baseRot(0, Vector);
    267 //   if ( isCeil )
    268 //   {
    269 //     printf( "ceil\n" );
    270 //     baseRot = Quaternion( PI/2, Vector( 0, 0, 1 ) );
    271 //   }
     276   Quaternion baseRot(0, Vector(1, 0, 0));
     277   if ( isCeil )
     278   {
     279     printf( "ceil\n" );
     280     baseRot = Quaternion( PI, Vector( 1, 0, 0 ) );
     281   }
    272282 
    273283  for ( int dBodyAngle = -1; dBodyAngle<2; dBodyAngle++ )
     
    290300      Quaternion cannonRot( cannonAngle, Vector( 0, 0, 1) );
    291301     
    292 //       bodyRot = baseRot * bodyRot;
    293 //       cannonRot = baseRot * cannonRot;
     302       bodyRot = baseRot * bodyRot;
     303       cannonRot = baseRot * cannonRot;
    294304     
    295305      float result = (bodyRot * cannonRot).apply( Vector( -1, 0, 0 ) ).dot( targetDir );
Note: See TracChangeset for help on using the changeset viewer.