Changeset 6132 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities
- Timestamp:
- Dec 16, 2005, 4:43:33 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities/weapons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.cc
r6131 r6132 48 48 this->energyMin = 1; 49 49 this->energyMax = 10; 50 this->lifeSpan = 5.0;51 this->agility = 50;52 this->maxVelocity = 300;50 this->lifeSpan = 10.0; 51 this->agility = 4; 52 this->maxVelocity = 100; 53 53 54 54 this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5); … … 156 156 if (target != NULL && target->getParent() != NullParent::getInstance()) 157 157 { 158 float speed = velocity.len(); 159 Vector diffVector = ((target->getAbsCoor() - this->getAbsCoor()).getNormalized()); 158 speed = velocity.len(); 159 diffVector = ((target->getAbsCoor() - this->getAbsCoor()).getNormalized()); 160 correctionVector = ( diffVector * (speed * speed/( velocity.dot(diffVector ) ) )); 160 161 161 162 if (velocity.dot(diffVector) != 0) 162 163 163 164 if(velocity.dot(diffVector) > 0) 164 velocity += ( ( diffVector * (speed * speed/( velocity.dot(diffVector ) ) )- velocity).getNormalized()) * agility;165 velocity += (( correctionVector - velocity).getNormalized()) * agility; 165 166 else 166 velocity -= ( ( diffVector * (speed * speed/( velocity.dot(diffVector ) ) )- velocity).getNormalized()) * agility;167 velocity -= ( ( correctionVector - velocity).getNormalized()) * agility; 167 168 168 169 else -
branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.h
r5766 r6132 41 41 float agility; 42 42 float maxVelocity; 43 float speed; 44 Vector diffVector ; 45 Vector correctionVector; 43 46 44 47 WorldEntity* hitEntity; // FIXME TEMPORARY
Note: See TracChangeset
for help on using the changeset viewer.