Re: [stella] which way to turn?

Subject: Re: [stella] which way to turn?
From: "Aaron" <stella-receiver@xxxxxxxxxxxxxxxxx>
Date: Fri, 22 Jul 2005 00:17:56 -0400
Kirk Israel said:
> So I'm trying to get something a bit like combat biplanes.  And I've
> been musing on this problem: how would I get, say, an onscreen heat
> seeking missile to work?
>
> Basically, it has to know if it should turn left or right to get to the
> target.

Hey, I have something useful to say for once! :)

Take the missile velocity, that's one vector.  Then take the distance from
the missile to its target, that's another vector.  Take their cross
product, i.e. y1*x2 - y2*x1.  If it's negative, you turn one way, if it's
positive you turn the other (I forget which is which, but it should be
easy to figure out).  I did this in a Palm game once and it looks cool...

-Aaron

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread