Changeset 6614 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Jan 19, 2006, 8:01:08 AM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities/weapons
- Files:
-
- 4 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, -
branches/spaceshipcontrol/src/world_entities/weapons/aim.h
r6606 r6614 38 38 inline PNode* getTarget(PNode* target) { return this->getParent(); }; 39 39 40 void searchTarget(float range, float angle); 40 void searchTarget(); 41 42 void setRange(float range){this->range = range;}; 43 void setAngle(float angle){this->angle = angle;}; 41 44 42 45 void setSize(float size); … … 53 56 tAnimation<Aim>* anim; 54 57 58 float range; //!< 59 float angle; //!< 60 55 61 PNode* source; //!< Where this Shot has come from. 56 62 -
branches/spaceshipcontrol/src/world_entities/weapons/aiming_turret.cc
r6606 r6614 98 98 this->target = new Aim(this); 99 99 this->target->setVisibility(false); 100 this->target->setRange(100); 101 this->target->setAngle(M_PI); 100 102 } 101 103 … … 130 132 this->setAbsDirSoft(quat, 5); 131 133 132 this->target-> searchTarget(100,M_PI_2);134 this->target->tick(dt); 133 135 } 134 136 … … 146 148 pj->setAbsDir(this->getAbsDir()); 147 149 pj->activate(); 148 this->target->searchTarget( 100,M_PI_2);150 this->target->searchTarget(); 149 151 } 150 152 -
branches/spaceshipcontrol/src/world_entities/weapons/targeting_turret.cc
r6606 r6614 92 92 this->target = new Aim(this); 93 93 this->target->setVisibility(false); 94 this->target->setRange(100); 95 this->target->setAngle(M_PI_4/2); 94 96 this->lockedTime = 0; 95 97 this->neededLockTime = 2; … … 150 152 pj->setAbsDir(this->getAbsDir()); 151 153 pj->activate(); 152 this->target->searchTarget( 100,M_PI_2);154 this->target->searchTarget(); 153 155 } 154 156
Note: See TracChangeset
for help on using the changeset viewer.