Changeset 6693 in orxonox.OLD for branches/network/src/world_entities/weapons/aim.cc
- Timestamp:
- Jan 25, 2006, 2:19:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/weapons/aim.cc
r6512 r6693 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)105 void Aim::searchTarget() 104 106 { 105 107 std::list<WorldEntity*>::iterator entity; 106 108 Vector diffVec(0.0, 0.0, 0.0); 109 diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() ); 110 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)) 107 113 for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin(); 108 114 entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end(); 109 115 entity ++) 110 116 { 111 if (this->source->getAbsCoor().x < (*entity)->getAbsCoor().x && (this->source->getAbsCoor() - (*entity)->getAbsCoor()).len() < range) 117 diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() ); 118 119 if ( diffVec.len() < range && acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle) 112 120 { 113 121 if (this->getParent() != (*entity)) … … 119 127 } 120 128 } 121 } 122 129 //if no target found: 130 this->setParent(PNode::getNullParent()); 131 } 123 132 124 133 … … 155 164 156 165 157 if (this->source->getAbsCoor().x > this->getAbsCoor().x )158 this->searchTarget(1000);166 // if (this->source->getAbsCoor().x > this->getAbsCoor().x ) 167 this->searchTarget(); 159 168 // float z = 0.0f; 160 169 // glReadPixels ((int)this->getAbsCoor2D().x,
Note: See TracChangeset
for help on using the changeset viewer.