Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10734 in orxonox.OLD


Ignore:
Timestamp:
Jun 20, 2007, 2:44:33 PM (17 years ago)
Author:
snellen
Message:

better flight behaviour for the ActionBox Enemy by rennerc

Location:
branches/presentation/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/npcs/actionbox_enemy.cc

    r10727 r10734  
    257257void ActionboxEnemy::moveTowardsBox( ActionBox * box, float dt )
    258258{
    259    
    260259  Vector targetPos = box->getAbsCoor() + box->getAbsDir().apply( Vector( 1, 0, 0 ) )*box->getDepth()*0.66f;
    261260  Vector targetDir = targetPos - myCoor;
     261 
     262  Vector boxDir = box->getAbsDir().apply( Vector(1, 0, 0 ) );
     263  float boxDist = boxDir.dot( targetDir );
     264 
     265  if ( boxDist > 0 )
     266  {
     267    Vector myRelCoor = this->getAbsCoor() - box->getAbsCoor();
     268    float newDist = boxDir.dot( myRelCoor );
     269    targetPos = box->getAbsCoor() + box->getAbsDir().apply( Vector( 1, 0, 0 ) )* newDist * 0.8;
     270    targetDir = targetPos - myCoor;
     271  }
    262272 
    263273  moveTowards(targetPos, targetDir, dt);
  • branches/presentation/src/world_entities/space_ships/space_ship.cc

    r10731 r10734  
    574574    this->bSecFire = event.bPressed;
    575575  else if( event.type == KeyMapper::PEV_FIRE1)
     576  {
     577    printf(" %f, %f, %f \n",this->getAbsCoor().x,this->getAbsCoor().y,this->getAbsCoor().z );
    576578    this->bFire = event.bPressed;
     579  }
    577580  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    578581  {
Note: See TracChangeset for help on using the changeset viewer.