Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6159 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities


Ignore:
Timestamp:
Dec 18, 2005, 3:17:29 PM (19 years ago)
Author:
snellen
Message:

guided_missile.cc in /world_entities/weapons updated

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

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.cc

    r6092 r6159  
    247247  // this is the air friction (necessary for a smooth control)
    248248  if(velocity.len() != 0) velocity -= velocity*0.1;
    249  
     249
    250250
    251251  //hoover effect
     
    281281   {
    282282     //this->shiftCoor(this->getAbsDirX());
     283
    283284     accel += Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
    284285     if((this->getAbsDirX()).y > -.2)
  • branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.cc

    r6133 r6159  
    150150*/
    151151void GuidedMissile::tick (float time)
    152 {
    153 
    154    
     152{
    155153
    156154  if (target != NULL && target->getParent() != NullParent::getInstance())
     
    160158    correctionVector = ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) ));
    161159
    162      if (velocity.dot(diffVector) != 0)
    163 
    164160      if(velocity.dot(diffVector) > 0)
    165161       velocity += (( correctionVector - velocity).getNormalized()) * agility;
     162      else if (velocity.dot(diffVector) < 0)
     163       velocity -= ( ( correctionVector - velocity).getNormalized()) * agility;
    166164      else
    167        velocity -= ( ( correctionVector - velocity).getNormalized()) * agility;
    168 
    169      else
    170       velocity += diffVector * agility;
     165       velocity += diffVector * agility;
    171166
    172167     this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)));
Note: See TracChangeset for help on using the changeset viewer.