Changeset 6159 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities/weapons
- Timestamp:
- Dec 18, 2005, 3:17:29 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/weapons/guided_missile.cc
r6133 r6159 150 150 */ 151 151 void GuidedMissile::tick (float time) 152 { 153 154 152 { 155 153 156 154 if (target != NULL && target->getParent() != NullParent::getInstance()) … … 160 158 correctionVector = ( diffVector * (speed * speed/( velocity.dot(diffVector ) ) )); 161 159 162 if (velocity.dot(diffVector) != 0)163 164 160 if(velocity.dot(diffVector) > 0) 165 161 velocity += (( correctionVector - velocity).getNormalized()) * agility; 162 else if (velocity.dot(diffVector) < 0) 163 velocity -= ( ( correctionVector - velocity).getNormalized()) * agility; 166 164 else 167 velocity -= ( ( correctionVector - velocity).getNormalized()) * agility; 168 169 else 170 velocity += diffVector * agility; 165 velocity += diffVector * agility; 171 166 172 167 this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)));
Note: See TracChangeset
for help on using the changeset viewer.