Changeset 10152 in orxonox.OLD for branches/playability/src/world_entities/weapons/light_blaster.cc
- Timestamp:
- Dec 27, 2006, 12:03:36 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/weapons/light_blaster.cc
r10109 r10152 45 45 { 46 46 47 this->loadModel("models/guns/ plasmadriver_#.obj", 1.0);47 this->loadModel("models/guns/gattling.obj", 0.333); 48 48 49 49 … … 66 66 this->prepareProjectiles(100); 67 67 68 this->setBarrels(3); 69 this->setSegs(1); 70 this->activeBarrel = 0; 71 72 this->objComp = new PNode**[this->getBarrels()]; 73 this->emissionPoint = new PNode*[this->getBarrels()]; 74 this->shootAnim = new Animation3D**[this->getBarrels()]; 75 for (int i = 0; i < this->getBarrels(); i++) 76 { 77 this->objComp[i] = new PNode* [this->getSegs()]; 78 this->emissionPoint[i] = new PNode; 79 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles 80 this->emissionPoint[i]->setName("EmissionPoint"); 81 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 82 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 83 for(int j = 0; j < this->getSegs(); j++) 84 { 85 this->objComp[i][j] = new PNode; 86 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 87 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 88 } 89 } 90 91 for (int i = 0; i < this->getBarrels(); i++ ) 92 this->emissionPoint[i]->setRelCoor(Vector(1.19, 0.0, 0.1)); 93 94 // Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this); 68 95 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); 69 96 Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this); 70 97 98 // animation1->setInfinity(ANIM_INF_CONSTANT); 71 99 animation2->setInfinity(ANIM_INF_CONSTANT); 72 100 animation3->setInfinity(ANIM_INF_CONSTANT); 73 101 74 this->setEmissionPoint(3.8, 1.2, 0); 102 // this->setEmissionPoint(3.8, 1.2, 0); 103 104 for (int i = 0; i < this->getBarrels(); i++){ 105 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(0, 0, 0), 0.05, ANIM_NULL, ANIM_LINEAR); 106 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(120, 0, 0), 0.0, ANIM_NULL, ANIM_LINEAR); 107 } 108 75 109 76 110 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 96 130 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*180); 97 131 98 pj->setAbsCoor(this-> getEmissionPoint());132 pj->setAbsCoor(this->emissionPoint[this->activeBarrel]->getAbsCoor()); 99 133 pj->setAbsDir(this->getAbsDir()); 100 pj->toList(OM_GROUP_01_PROJ);134 // pj->toList(OM_GROUP_01_PROJ); 101 135 pj->activate(); 136 137 for (int i = 0; i < this->getSegs(); i++) 138 this->shootAnim[this->activeBarrel][i]->replay(); 139 140 // switch barrel 141 this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels(); 102 142 } 103 143 … … 118 158 void LightBlaster::draw() const 119 159 { 160 glMatrixMode(GL_MODELVIEW); 161 glPushMatrix(); 162 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 163 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 164 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 165 static_cast<StaticModel*>(this->getModel())->draw(); 166 glPopMatrix(); 120 167 }
Note: See TracChangeset
for help on using the changeset viewer.