Changeset 6800 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 27, 2006, 4:40:37 PM (19 years ago)
- Location:
- trunk/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/hover.cc
r6799 r6800 97 97 this->getWeaponManager()->changeWeaponConfig(1); 98 98 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); 99 100 this->loadModel("models/ships/hoverglider_mainbody.obj"); 99 101 } 100 102 … … 126 128 127 129 // cameraissue 130 this->cameraNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 128 131 this->cameraNode.setParent(this); 129 132 this->cameraNode.setParentMode(PNODE_ALL); … … 131 134 132 135 // rotors 133 this->topRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 134 this->tailRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 135 136 this->topRotor.setParent(this); 137 this->tailRotor.setParent(this); 138 139 this->topRotor.setRelCoor(Vector(-0.877,0.627,0)); 140 this->tailRotor.setRelCoor(Vector(-4.43,0.297,0.068)); 141 this->tailRotor.setAbsDir(Quaternion(M_PI_2,Vector(1,0,0))); 142 143 this->loadModel("models/ships/rotor.obj",1.0,3); 144 this->loadModel("models/ships/rotor.obj",0.2,4); 136 this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 137 this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 138 139 this->rotorNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 140 this->rotorNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 141 142 this->wingNodeLeft.setParent(this); 143 this->wingNodeRight.setParent(this); 144 145 this->wingNodeLeft.setRelCoor(-1, .5, -.5); 146 this->wingNodeRight.setRelCoor(-1, .5, .5); 147 148 this->rotorNodeLeft.setParent(&this->wingNodeLeft); 149 this->rotorNodeRight.setParent(&this->wingNodeRight); 150 151 this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3); 152 this->loadModel("models/ships/hoverglider_rotor.obj", 1.0f, 4); 145 153 146 154 … … 259 267 void Hover::collidesWith(WorldEntity* entity, const Vector& location) 260 268 { 261 if (entity->isA(CL_TURRET_POWER_UP)) 262 { 263 this->ADDWEAPON(); 264 } 265 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 269 266 270 } 267 271 … … 283 287 284 288 // rotorrotation 285 this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));286 this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));289 // this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0))); 290 // this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0))); 287 291 288 292 // spaceship controlled movement … … 451 455 452 456 /* translate */ 453 glTranslatef (this-> topRotor.getAbsCoor ().x,454 this-> topRotor.getAbsCoor ().y,455 this-> topRotor.getAbsCoor ().z);456 Vector tmpRot = this-> topRotor.getAbsDir().getSpacialAxis();457 glRotatef (this-> topRotor.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );457 glTranslatef (this->wingNodeLeft.getAbsCoor ().x, 458 this->wingNodeLeft.getAbsCoor ().y, 459 this->wingNodeLeft.getAbsCoor ().z); 460 Vector tmpRot = this->wingNodeLeft.getAbsDir().getSpacialAxis(); 461 glRotatef (this->wingNodeLeft.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 458 462 this->getModel(3)->draw(); 459 460 glPopMatrix ();461 glPushMatrix();462 463 /* translate */464 glTranslatef (this->tailRotor.getAbsCoor ().x,465 this->tailRotor.getAbsCoor ().y,466 this->tailRotor.getAbsCoor ().z);467 tmpRot = this->tailRotor.getAbsDir().getSpacialAxis();468 glRotatef (this->tailRotor.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );469 this->getModel(4)->draw();470 463 471 464 glPopMatrix (); … … 535 528 } 536 529 } 537 538 #include "weapons/aiming_turret.h"539 // FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG540 void Hover::ADDWEAPON()541 {542 Weapon* turret = NULL;543 544 if ((float)rand()/RAND_MAX < .1)545 {546 //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))547 {548 turret = new Turret();549 this->addWeapon(turret, 2);550 this->getWeaponManager()->changeWeaponConfig(2);551 }552 }553 else554 {555 //if (this->getWeaponManager()->hasFreeSlot(3))556 {557 turret = new AimingTurret();558 this->addWeapon(turret, 3);559 560 this->getWeaponManager()->changeWeaponConfig(3);561 }562 }563 564 if(turret != NULL)565 {566 turret->setName("Turret");567 turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);568 }569 } -
trunk/src/world_entities/space_ships/hover.h
r6799 r6800 10 10 #include "playable.h" 11 11 12 13 12 class Hover : public Playable 14 13 { 15 16 14 public: 17 15 … … 37 35 virtual void process(const Event &event); 38 36 39 40 41 37 private: 42 38 void calculateVelocity(float time); 43 39 void weaponAction(); 44 45 // !! temporary !!46 void ADDWEAPON();47 40 48 41 bool bUp; //!< up button pressed. … … 64 57 //float cycle; //!< hovercycle 65 58 66 PNode topRotor; 67 PNode tailRotor; 59 PNode wingNodeLeft; 60 PNode wingNodeRight; 61 PNode rotorNodeLeft; 62 PNode rotorNodeRight; 68 63 69 64 PNode cameraNode;
Note: See TracChangeset
for help on using the changeset viewer.