Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2005, 2:07:27 PM (18 years ago)
Author:
snellen
Message:

WARNING: probably doesnt compile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.cc

    r5994 r6044  
    4949  this->energyMax = 10;
    5050  this->lifeSpan = 5.0;
    51   this->agility = 5.0;
     51  this->agility = 0.1;
    5252  this->maxVelocity = 100;
    5353
     
    151151void GuidedMissile::tick (float time)
    152152{
    153   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     153
    154154  if (target != NULL && target->getParent() != NullParent::getInstance())
    155155   {
    156      velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
    157156     float speed = velocity.len();
    158      if (speed > this->maxVelocity)
    159        velocity *= maxVelocity/speed;
     157
     158     velocity += (((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*speed - velocity)*agility;
     159     velocity *= (velocity.getNormalized())*speed;
     160
     161
     162     velocity *= maxVelocity/speed;
    160163
    161164     this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)));
    162165   }
     166
    163167  Vector v = this->velocity * (time);
    164168  this->shiftCoor(v);
Note: See TracChangeset for help on using the changeset viewer.