Changeset 9516 in orxonox.OLD for branches/proxy/src/world_entities/weapons/aim.cc
- Timestamp:
- Jul 27, 2006, 6:45:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/world_entities/weapons/aim.cc
r9406 r9516 50 50 Aim::~Aim () 51 51 { 52 if (this->material)53 delete this->material;54 55 52 /* if (this->text != NULL) 56 53 delete this->text;*/ … … 70 67 71 68 this->setBindNode(this); 72 this->material = new Material;73 69 this->source = NULL; 74 70 75 71 this->range = 10000; 76 72 this->angle = M_PI_4; 77 this-> group = OM_GROUP_01;73 this->targetGroup = OM_GROUP_02_PROJ; 78 74 this->anim = new tAnimation<Aim>(this, &Aim::setSize); 79 75 this->anim->setInfinity(ANIM_INF_CONSTANT); … … 103 99 LoadParam(root, "rotation-speed", this, Aim, setRotationSpeed) 104 100 .describe("the Speed with which the Aim should rotate"); 101 102 LoadParam(root, "target-group", this, Aim, setTargetGroupS); 105 103 } 106 104 … … 108 106 { 109 107 ObjectManager::EntityList::iterator entity; 110 111 for (entity = State::getObjectManager()->getObjectList(group).begin(); 112 entity != State::getObjectManager()->getObjectList(group).end(); 108 //printf("%d\n", this->targetGroup); 109 110 for (entity = State::getObjectManager()->getObjectList(this->targetGroup).begin(); 111 entity != State::getObjectManager()->getObjectList(this->targetGroup).end(); 113 112 entity ++) 114 113 { 115 114 diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() ); 116 115 117 if ( diffVec.len() < range && acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle)116 if ( diffVec.len() < range )//&& acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle) 118 117 { 119 118 //if (this->getParent() != (*entity)) 120 119 { 120 printf("found target::: %d %s::%s\n", (*entity)->getOMListNumber(), (*entity)->getClassCName(), (*entity)->getCName()); 121 121 this->anim->replay(); 122 this->setParent Soft(*entity, 5);122 this->setParent/*Soft*/(*entity/*, 5 */); 123 123 return; 124 124 } … … 128 128 //if no target found: 129 129 this->setParent(PNode::getNullParent()); 130 131 132 133 } 134 130 } 131 132 void Aim::setTargetGroupS(const std::string& groupName) 133 { 134 printf("::::::::::::::::::::::: TEST\n"); 135 OM_LIST id = ObjectManager::StringToOMList(groupName); 136 if (id != OM_NULL) 137 this->setTargetGroup(id); 138 else 139 PRINTF(2)("List %s not found for targetting\n", groupName.c_str()); 140 141 printf("targetGroup: %s, %d", groupName.c_str(), id); 142 } 135 143 136 144 /** … … 149 157 void Aim::setTexture(const std::string& textureFile) 150 158 { 151 this->material ->setDiffuseMap(textureFile);159 this->material.setDiffuseMap(textureFile); 152 160 } 153 161 … … 170 178 //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range 171 179 if(this->getParent() == PNode::getNullParent() || 172 diffVec.len() > range ||173 ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))180 diffVec.len() > range )// || 181 //( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle)) 174 182 { 175 183 this->setParentSoft(PNode::getNullParent(),5); … … 213 221 214 222 glRotatef(this->getAbsDir2D(), 0,0,1); 215 this->material ->select();223 this->material.select(); 216 224 glBegin(GL_TRIANGLE_STRIP); 217 225 glTexCoord2f(0, 0);
Note: See TracChangeset
for help on using the changeset viewer.