Path: chuka.playstation.co.uk!news From: "Matt Verran" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Sine & Cosine Lookup Tables Date: Mon, 9 Dec 2002 13:47:03 -0800 Organization: PlayStation Net Yaroze (SCEE) Lines: 49 Message-ID: References: NNTP-Posting-Host: host213-122-196-42.in-addr.btopenworld.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Well basically I pushed the right analog stick vector through an arctan to get the angle out to rotate Ron to the right angle. You could use this angle to rotate a normal vector too for bullet firing or whatever (for RR I just multiplied up the stick vector which is why you can fire slow bullets if you don't fully push the stick, it's a feature: analog bullets!). So an arctan function (commonly in C "arctan2()") is what you need. I believe one was posted on these newsgroups once, or there should be loads on the net. I think the one I used might well be (c) Jon Prestidge although I do kinda remember him releasing an old version for free. I'll give him a mail... hope that helps Matt "Andrew Murray" wrote in message news:at24hi$4654@www.netyaroze-europe.com... > Hi All, > > To put it short, I'm trying to do a clone of Smash TV using both digital > movement and analogue movement. I've got the digital down and dusted but the > analogue is a *tad* more difficult. > > Originally I was doing a vector subtraction between the aim vector (the > right analogue stick), and the player position vector then normalising this > which utalises a magnitude function (therefore a square root function... > everything is in fixed point). However, the fixed point square root is > giving me Aritmetic Overflow Errors. > > Now I want to try sine cosine lookup tables as I've heard they are faster > and require less fiddling than my previous method did. Does anyone have any > examples of how I would implement a sine & cosine lookup table and convert > the analogue reading into a vector of direction for fired bullets using > them? I'm sure Matt Verran would be able to suggest something as the game > I'm doing requires the same analogue firing mechanism as is in (the > excellent) RobotRon. > > Any help is much appreciated! > > Andrew. > > P.S. Merry Chrimbo! > >