Changeset 5559 in orxonox.OLD for branches/world_entities/src/world_entities/weapons/aiming_turret.cc
- Timestamp:
- Nov 13, 2005, 4:30:07 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/world_entities/src/world_entities/weapons/aiming_turret.cc
r5527 r5559 18 18 19 19 #include "weapon_manager.h" 20 #include "aim.h" 20 21 #include "projectile.h" 21 22 … … 45 46 this->init(); 46 47 47 this->loadModel("models/guns/turret 1.obj");48 this->loadModel("models/guns/turret2.obj"); 48 49 49 50 … … 66 67 { 67 68 // model will be deleted from WorldEntity-destructor 69 delete this->target; 68 70 } 69 71 … … 99 101 //this->getProjectileFactory()->prepare(100); 100 102 101 this->target = NULL;103 this->target = new Aim(); 102 104 } 103 105 … … 119 121 { 120 122 Quaternion quat; 121 if (this->target == NULL)122 this->target = this->getWeaponManager()->getDistanceTarget(this, 50);123 123 Vector direction = this->target->getAbsCoor() - this->getAbsCoor(); 124 124 … … 130 130 quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ; 131 131 132 this->setAbsDirSoft(quat, 20); 132 this->setAbsDirSoft(quat, 5); 133 134 this->target->tick(dt); 133 135 } 134 136 … … 143 145 if (target != NULL) 144 146 { 145 pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))* 100.0 + VECTOR_RAND(13)147 pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13) 146 148 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 147 149 } … … 153 155 pj->setAbsDir(this->getAbsDir()); 154 156 pj->activate(); 155 this->target = this->getWeaponManager()->getDistanceTarget(this, 50);157 this->target->searchTarget(this); 156 158 } 157 159
Note: See TracChangeset
for help on using the changeset viewer.