Changeset 5764 in orxonox.OLD for branches/guidedmissile/src
- Timestamp:
- Nov 24, 2005, 4:29:29 PM (19 years ago)
- Location:
- branches/guidedmissile/src/world_entities/weapons
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/guidedmissile/src/world_entities/weapons/aiming_turret.cc
r5762 r5764 145 145 pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13) 146 146 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 147 pj->setTarget(this->target->getParent()); 148 147 149 148 150 pj->setParent(NullParent::getInstance()); -
branches/guidedmissile/src/world_entities/weapons/guided_missile.cc
r5761 r5764 42 42 43 43 float modelSize = .3; 44 this->loadModel("models/projectiles/orx- guided_missile.obj", .3);44 this->loadModel("models/projectiles/orx-rocket.obj", .3); 45 45 46 46 this->energyMin = 1; … … 48 48 this->remove(); 49 49 this->lifeSpan = 5; 50 this->agility = 1;50 this->agility = 5; 51 51 52 52 this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5); … … 82 82 ParticleSystem* GuidedMissile::explosionParticles = NULL; 83 83 84 85 void GuidedMissile::setTarget(PNode* target)86 {87 88 this->target.setParent(target);89 90 }91 84 92 85 … … 158 151 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 159 152 float speed = velocity.len(); 160 velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 161 velocity *= speed/velocity.len(); 153 if (target != NULL) 154 { 155 velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 156 velocity *= speed/velocity.len(); 157 } 162 158 Vector v = this->velocity * (time); 163 159 this->shiftCoor(v); -
branches/guidedmissile/src/world_entities/weapons/guided_missile.h
r5760 r5764 22 22 virtual ~GuidedMissile (); 23 23 24 void setTarget(PNode* target);25 24 virtual void activate(); 26 25 virtual void deactivate(); … … 40 39 41 40 ParticleEmitter* emitter; 42 PNode target;43 41 float agility; 44 42 -
branches/guidedmissile/src/world_entities/weapons/projectile.cc
r5511 r5764 38 38 this->lifeCycle = 0.0; 39 39 this->lifeSpan = 1.0f; /* sec */ 40 this->target = NULL; 40 41 41 42 this->remove(); … … 98 99 } 99 100 101 102 103 void Projectile::setTarget(PNode* target) 104 { 105 106 if (this->target == NULL) 107 this->target = new PNode(); 108 this->target->setParent(target); 109 } 110 111 100 112 /** 101 113 * signal tick, time dependent things will be handled here -
branches/guidedmissile/src/world_entities/weapons/projectile.h
r5500 r5764 31 31 inline bool isChageable() { return this->bChargeable; }; 32 32 33 void setTarget(PNode* target); 33 34 34 35 /** @brief This is called, when the Projectile is Emitted */ … … 54 55 55 56 Vector velocity; //!< velocity of the projectile. 57 58 PNode* target; //!< A target for guided Weapons. 56 59 }; 57 60 -
branches/guidedmissile/src/world_entities/weapons/turret.cc
r5750 r5764 138 138 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(13) 139 139 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 140 140 141 141 142 pj->setParent(NullParent::getInstance());
Note: See TracChangeset
for help on using the changeset viewer.