Path: chuka.playstation.co.uk!news From: "John \( QuietBloke \)" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Daft Question Date: Mon, 20 Aug 2001 21:09:16 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 50 Message-ID: <9lrqqf$3j63@www.netyaroze-europe.com> References: <9loc6a$p3k2@www.netyaroze-europe.com> <9loeu8$p3k3@www.netyaroze-europe.com> <01c1297e$8cb6e8a0$LocalHost@pal-s-omnibook> NNTP-Posting-Host: host213-122-189-16.btinternet.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Hi Pal, I had a good think about this today ( Im afraid a barbeque kinda got me too mashed up to do anything yesterday ) and your solution seems to fit exactly what I thought Id have to end up doing ( ie some sort of lookup table ) as the maths functions arnt exactly speedy on the PSX. I was kinda hoping there was a wierd and wonderful way of getting this done using the matrices or something. As it seems you have done all the hard work and come up with a solution Id be very grateful if you could pass it on to me.. it'll save me a lot of time. I was just about to sit down and try to figure it out.. as if progress on the game isnt slow enough already. Of course Matt and now Omar arnt helping matters by eating onto my spare time .. not that Im complaining :) Cheers John ( QuietBloke ) "pal" wrote in message news:01c1297e$8cb6e8a0$LocalHost@pal-s-omnibook... > Coincidence... I just implemented that in Invs yesterday! After a bit of > research, here is what I finally found out: > > Use atan2. It's designed for that. > angleInPslibDegrees = (4096 * 180/PI) * atan2(x2 - x1, y1 - y2) > with PI ~= 3.141592 > > - beware of the inverted y axis (on the screen it goes downwards while in > math it usually goes upwards). > > - beware of the direction of the original sprite. This formula works with > the original sprite pointing up (I'm not sure why). > > - if x2 == x1 and y2 == y1 can happen, be sure to remember and keep the > angle before that step, as these values are not allowed (you'd get zero, > which is normally not what you want). > > - as the whole calculus (including conversion to pslib degrees) ends up > being far too long, I recommend using a precalculated table. I wrote a > precalculator for Invs; let me know if you want to have a look at it. > > > Hope this helps, > pal >