View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Heat seeking missile

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1NewDeal  Members

Posted 05 March 2000 - 02:04 PM

Im currently working on a 2D space shooter (topview). Ive been trying to figure out the best way to control heat seeking missiles. The missiles can only move forward with a freedom of 45 degrees to each side (in steps of 5 degrees cuz of the sprites). Now im simply checking if the targets x-position is less/greater than the missiles x-pos. If this is the case i add/substract 5 degrees from the missiles heading. This basicly works but im not getting the movement effect i want (they dont move naturally). Does anybody know of a better way to do this ? Or where i can find info on this topic. Thanx

### #2Anonymous Poster_Anonymous Poster_*  Guests

Posted 05 March 2000 - 03:13 PM

The way I see doing heat seeking is by converting the angle of the heading to a slope, then just check to see on which side of the line is the target. If its to the right then turn clockwise else counter clockwise. Then you''ll just need to do some code for when the target is on the line infront of the miscile so that it doesn''t gitter back and left and right, and for inbehind so that it will turn instead of going straight. To check if the target is in front or in back siply invert the slope and do another check.
If anyone has better ideas let me know.

- 60815

### #3Spellbound  Members

Posted 06 March 2000 - 01:56 AM

I would give the missiles these properties:

struct Missile
{
Target;
Position;
Speed;
};

Every time the missile should be moved the speed is added to the position, and then the speed is accelerated towards the target. If the missile misses the target it will take some time before it is able to reverse its speed, which is quite realistic without imposing to much physics into it.

When the missile is rendered it is always rendered so that it faces the target.

### #4NewDeal  Members

Posted 06 March 2000 - 09:42 AM

I got it working now

Thanx

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.