Changeset 5764 in orxonox.OLD for branches/guidedmissile/src/world_entities/weapons/guided_missile.cc
- Timestamp:
- Nov 24, 2005, 4:29:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note: See TracChangeset
for help on using the changeset viewer.