Changeset 9172 in orxonox.OLD for branches/presentation/src/world_entities/weapons/aiming_system.cc
- Timestamp:
- Jul 4, 2006, 9:45:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/weapons/aiming_system.cc
r9168 r9172 1 /*1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 36 36 AimingSystem::AimingSystem (WorldEntity* entity) 37 37 { 38 this->owner = entity; 39 38 40 this->init(); 39 41 } … … 55 57 this->setName("AimingSystem"); 56 58 57 this->loadModel("models/guns/targeting_system_body.obj"); 59 //this->loadModel("models/guns/targeting_system_body2.obj"); 60 // this->loadModel("models/ships/fighter.obj"); 58 61 59 62 // registering default reactions: 60 63 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY); 64 65 this->range = 1000.0f; 66 this->sideLength = 10.0f; 67 68 // new obb tree 69 this->obbTree = new OBBTree(); 70 this->obbTree->createBox(Vector(0.0f, 0.0f, 0.0f), Vector(this->range, this->sideLength, this->sideLength)); 61 71 } 62 72 … … 69 79 WorldEntity* AimingSystem::getNearestTarget() 70 80 { 81 82 // PRINTF(0)("size: %i\n", this->selectionList.size()); 83 84 71 85 if( this->selectionList.size() == 0) 72 86 return NULL; 73 else if( this->selectionList.size() == 1) 74 return this->selectionList.back(); 87 75 88 76 89 WorldEntity* nearestEntity = NULL; … … 91 104 if( nearestEntity != this->owner) 92 105 return nearestEntity; 93 else return NULL; 106 else 107 return NULL; 94 108 } 95 109 … … 123 137 void AimingSystem::draw() const 124 138 { 125 WorldEntity::draw();139 // WorldEntity::draw(); 126 140 127 if( this->getOBBTree () != NULL) 128 this->getOBBTree()->drawBV(0, 1); 141 glMatrixMode(GL_MODELVIEW); 142 glPushMatrix(); 143 144 /* translate */ 145 glTranslatef (this->getAbsCoor ().x, 146 this->getAbsCoor ().y, 147 this->getAbsCoor ().z); 148 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 149 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 150 151 this->obbTree->drawBV(1, 1); 152 153 glPopMatrix(); 154 129 155 }
Note: See TracChangeset
for help on using the changeset viewer.