Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Dec 16, 2005, 4:43:33 PM (19 years ago)
Author:
snellen
Message:

guided_missile.cc in /world_entities/weapon updated

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

Legend:

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

    r6131 r6132  
    4848  this->energyMin = 1;
    4949  this->energyMax = 10;
    50   this->lifeSpan = 5.0;
    51   this->agility = 50;
    52   this->maxVelocity = 300;
     50  this->lifeSpan = 10.0;
     51  this->agility = 4;
     52  this->maxVelocity = 100;
    5353
    5454  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
     
    156156  if (target != NULL && target->getParent() != NullParent::getInstance())
    157157   {
    158     float speed = velocity.len();
    159     Vector diffVector = ((target->getAbsCoor() - this->getAbsCoor()).getNormalized());
     158    speed = velocity.len();
     159    diffVector = ((target->getAbsCoor() - this->getAbsCoor()).getNormalized());
     160    correctionVector = ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) ));
    160161
    161162     if (velocity.dot(diffVector) != 0)
    162163
    163164      if(velocity.dot(diffVector) > 0)
    164        velocity += ( ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) ) - velocity).getNormalized()) * agility;
     165       velocity += (( correctionVector - velocity).getNormalized()) * agility;
    165166      else
    166        velocity -= ( ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) ) - velocity).getNormalized()) * agility;
     167       velocity -= ( ( correctionVector - velocity).getNormalized()) * agility;
    167168
    168169     else
  • branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.h

    r5766 r6132  
    4141    float                             agility;
    4242    float                             maxVelocity;
     43    float                             speed;
     44    Vector                            diffVector ;
     45    Vector                            correctionVector;
    4346
    4447    WorldEntity* hitEntity; // FIXME TEMPORARY
Note: See TracChangeset for help on using the changeset viewer.