- Timestamp:
- Jan 25, 2006, 5:25:15 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
r6692 r6723 367 367 //this->shiftCoor((this->getAbsDirX())*-1); 368 368 //accel -= (this->getAbsDirX())*2; 369 //if(velocity.len() > 50) 369 370 accel -= (this->getAbsDirX())*0.5*acceleration; 371 372 373 370 374 } 371 375 -
branches/spaceshipcontrol/src/world_entities/weapons/aim.cc
r6637 r6723 73 73 this->source = NULL; 74 74 75 this->range = 0; 76 this->angle = 0; 75 this->range = 10000; 76 this->angle = M_PI_4; 77 this->group = OM_GROUP_01; 77 78 this->anim = new tAnimation<Aim>(this, &Aim::setSize); 78 79 this->anim->setInfinity(ANIM_INF_CONSTANT); … … 106 107 { 107 108 std::list<WorldEntity*>::iterator entity; 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)) 113 for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin(); 114 entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end(); 109 110 for (entity = State::getObjectManager()->getObjectList(group).begin(); 111 entity != State::getObjectManager()->getObjectList(group).end(); 115 112 entity ++) 116 113 { … … 119 116 if ( diffVec.len() < range && acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle) 120 117 { 121 if (this->getParent() != (*entity))118 //if (this->getParent() != (*entity)) 122 119 { 123 120 this->anim->replay(); … … 127 124 } 128 125 } 129 //if no target found: 130 this->setParent(PNode::getNullParent()); 126 127 //if no target found: 128 this->setParent(PNode::getNullParent()); 129 130 131 131 132 } 132 133 … … 165 166 166 167 // if (this->source->getAbsCoor().x > this->getAbsCoor().x ) 168 diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() ); 169 //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range 170 if(this->getParent() == PNode::getNullParent() || 171 diffVec.len() > range || 172 ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle)) 173 { 167 174 this->searchTarget(); 175 } 176 168 177 // float z = 0.0f; 169 178 // glReadPixels ((int)this->getAbsCoor2D().x, … … 196 205 { 197 206 207 if( this->getParent() != PNode::getNullParent() ) 208 { 198 209 glPushMatrix(); 199 210 glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); … … 212 223 glEnd(); 213 224 glPopMatrix(); 214 215 } 225 } 226 227 } -
branches/spaceshipcontrol/src/world_entities/weapons/aim.h
r6637 r6723 9 9 #include "p_node.h" 10 10 #include "element_2d.h" 11 #include "object_manager.h" 11 12 12 13 // FORWARD DECLARATION … … 42 43 void setRange(float range){this->range = range;}; 43 44 void setAngle(float angle){this->angle = angle;}; 45 void setGroup(OM_LIST group){this->group = group;}; 44 46 45 47 void setSize(float size); … … 58 60 float range; //!< 59 61 float angle; //!< 62 Vector diffVec; 63 OM_LIST group; 60 64 61 65 PNode* source; //!< Where this Shot has come from. -
branches/spaceshipcontrol/src/world_entities/weapons/aiming_turret.cc
r6671 r6723 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 this->target->setRange(1000); 101 this->target->setAngle(M_PI_4); 102 102 } 103 103 … … 148 148 pj->setAbsDir(this->getAbsDir()); 149 149 pj->activate(); 150 this->target->searchTarget();151 150 } 152 151 -
branches/spaceshipcontrol/src/world_entities/weapons/targeting_turret.cc
r6671 r6723 93 93 this->target->setVisibility(false); 94 94 this->target->setRange(100); 95 this->target->setAngle(M_PI_4/ 2);95 this->target->setAngle(M_PI_4/16); 96 96 this->lockedTime = 0; 97 97 this->neededLockTime = 2; … … 147 147 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 148 148 149 pj->setTarget( this->target->getParent());149 pj->setTarget(lockedTarget); 150 150 pj->setParent(PNode::getNullParent()); 151 151 pj->setAbsCoor(this->getEmissionPoint()); 152 152 pj->setAbsDir(this->getAbsDir()); 153 153 pj->activate(); 154 this->target->searchTarget();154 155 155 } 156 156
Note: See TracChangeset
for help on using the changeset viewer.