Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

guided_missile.cc in /world_entities/weapons updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.