Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 19, 2006, 8:01:08 AM (18 years ago)
Author:
snellen
Message:

aim.cc updated

File:
1 edited

Legend:

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

    r6606 r6614  
    7373  this->source = NULL;
    7474
     75  this->range = 0;
     76  this->angle = 0;
    7577  this->anim = new tAnimation<Aim>(this, &Aim::setSize);
    7678  this->anim->setInfinity(ANIM_INF_CONSTANT);
     
    101103}
    102104
    103 void Aim::searchTarget(float range, float angle)
     105void Aim::searchTarget()
    104106{
    105107  std::list<WorldEntity*>::iterator entity;
     
    107109  diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
    108110
    109 //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range 
    110   if( this == PNode::getNullParent() || diffVec.len() > range  || ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle && (this->source->getAbsDirX()).dot(diffVec) > 0))
     111//only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
     112  if( this == PNode::getNullParent() || diffVec.len() > range  || ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
    111113  for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin();
    112114       entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end();
     
    115117    diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() );
    116118
    117     if ( diffVec.len() < range  &&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle && (this->source->getAbsDirX()).dot(diffVec) > 0)
     119    if ( diffVec.len() < range  &&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle)
    118120    {
    119121      if (this->getParent() != (*entity))
     
    130132
    131133
    132 
    133134/**
    134135 * @brief sets the size of the Aim.
     
    164165
    165166//  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
    166 //    this->searchTarget(1000,M_PI_2);
     167     this->searchTarget();
    167168//   float z = 0.0f;
    168169//   glReadPixels ((int)this->getAbsCoor2D().x,
Note: See TracChangeset for help on using the changeset viewer.