Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 15, 2006, 8:34:47 AM (18 years ago)
Author:
nicolasc
Message:

guiding system (somewhat not working)
minor cleanup in pnode.h
cd/cr in hbolt/lbolt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10078 r10079  
    2828
    2929#include "class_id_DEPRECATED.h"
     30
     31#include "math/vector.h"
    3032
    3133ObjectListDefinitionID(SwarmProjectile, CL_SWARM_PROJECTILE);
     
    5456
    5557  this->target = NULL;
    56 
    57   this->rotationSpeed = 100;
    58   this->angle = 0;
    5958}
    6059
     
    128127
    129128  this->setHealth(10.0* (float)rand()/(float)RAND_MAX);
     129
     130  this->maxVelocity = 300;
     131
     132  this->rotationSpeed = 100;
     133  this->angle = 0;
    130134}
    131135
     
    216220  this->shiftCoor(v);*/
    217221
    218   float projectileVelocity = this->velocity.len();
    219   if (target != NULL){
    220     float tti;  //Time To Impact
    221     float targetVelocity = this->target->getVelocity().len();
    222     if (unlikely(projectileVelocity == 0 && targetVelocity == 0)) // TODO calculate this reasonably
    223       tti = 1; // we do have a problem....
    224     else
    225       tti = this->target->getRelCoor().len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity);
    226     Vector estTargetDir = (this->target->getRelCoor() + this->target->getVelocity()) * tti;
    227     this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time );
    228   }
    229   else
    230     if (likely(projectileVelocity != 0))
    231       this->velocity *= maxVelocity / projectileVelocity; // set speed to max
    232 
    233 
    234   this->shiftCoor(velocity * time);
     222//   float projectileVelocity = this->getVelocity().len();
     223//   if (target != NULL){
     224//     float tti;  //Time To Impact
     225// //     float targetVelocity = this->target->getVelocity().len();
     226// // /*    if (unlikely(projectileVelocity == 0 && targetVelocity == 0)) // TODO calculate this reasonably*/
     227//       tti = 1; // we do have a problem....
     228// // //     else
     229// // //       tti = (this->getAbsCoor() - this->target->getAbsCoor()).len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity);
     230//     Vector estTargetDir =  this->getAbsCoor() - this->target->getAbsCoor() + this->target->getVelocity() * (0.5);
     231// //     this->setVelocity((this->getAbsCoor() - this->target->getAbsCoor()).getNormalized() * this->velocity.len());
     232//     this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time ) * this->maxVelocity;
     233//   }
     234//   else
     235//     if (likely(projectileVelocity != 0))
     236//       this->velocity *= (this->maxVelocity / projectileVelocity); // set speed to max
     237/*
     238  Vector v = this->velocity + this->target->getAbsCoor() - this->getAbsCoor();
     239  v.normalize();
     240  v *= projectileVelocity;*/
     241  this->shiftCoor(velocity * (time));
    235242
    236243  if(this->tickLifeCycle(time))
Note: See TracChangeset for help on using the changeset viewer.