Changeset 6614 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities/weapons/aim.cc
- Timestamp:
- Jan 19, 2006, 8:01:08 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/weapons/aim.cc
r6606 r6614 73 73 this->source = NULL; 74 74 75 this->range = 0; 76 this->angle = 0; 75 77 this->anim = new tAnimation<Aim>(this, &Aim::setSize); 76 78 this->anim->setInfinity(ANIM_INF_CONSTANT); … … 101 103 } 102 104 103 void Aim::searchTarget( float range, float angle)105 void Aim::searchTarget() 104 106 { 105 107 std::list<WorldEntity*>::iterator entity; … … 107 109 diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() ); 108 110 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)) 111 113 for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin(); 112 114 entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end(); … … 115 117 diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() ); 116 118 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) 118 120 { 119 121 if (this->getParent() != (*entity)) … … 130 132 131 133 132 133 134 /** 134 135 * @brief sets the size of the Aim. … … 164 165 165 166 // if (this->source->getAbsCoor().x > this->getAbsCoor().x ) 166 // this->searchTarget(1000,M_PI_2);167 this->searchTarget(); 167 168 // float z = 0.0f; 168 169 // glReadPixels ((int)this->getAbsCoor2D().x,
Note: See TracChangeset
for help on using the changeset viewer.