Path: chuka.playstation.co.uk!news From: Jake Turner Newsgroups: scee.yaroze.beginners Subject: Re: angles, angles Date: Wed, 18 Nov 1998 19:50:13 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 56 Message-ID: <365324F5.258FE38B@cthullu.freeserve.co.uk> References: <72spa7$dvm12@chuka.playstation.co.uk> <72sr28$dvm13@chuka.playstation.co.uk> <3652971c.228584498@news.playstation.co.uk> NNTP-Posting-Host: modem-59.polonium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; I) Richard Cutting wrote: > On Tue, 17 Nov 1998 21:50:40 -0000, "Darren Jackson" > wrote: > > >HHmmm... > > > >The previous message isn't quite right, I am confusing myself at the minute > >!! > > > >The thing is how do I get the correct x and y values according to the angle. > >I know that x and y can only be integers but I need to know how many pixels > >across for every one up, for example. ( I have had a hard day at work and I > >trying to figure this out now!!). > > > >Darren > > > > > > To compute the trajectory the following bit of maths is used; > > xv = sin( angle ) * magnitude > yv = cos( angle ) * magnitude > > ( where angle is the angle relative to the horizon and magnitude is > the overall speed of the sprite in pixels per game cycle ) > > If you apply xv and yv to your sprites x and y co-ordinates the sprite > will move in a straight line path from its point of origin. > > To get around the floating point problem you'll need a fixed point > trig library. There are a couple floating around, two I know of can > be found at http://www.netyaroze-europe.com/~shaughnj or > http://www.netyaroze-europe.com/~nslaven > > Richard. An even better method would be to use the internal matrix functions of the Yaroze e.g. RotMatrixX (or Y or Z), that will give cos (angle) and sin(angle) in GTE fixed point values e.g. 4096 = 1.0, look it up in the library reference Cheers Jake -- Jake Turner : Token Rocket Scientist ========================================= Practice VI it may save your life one day Home e-mail: jaket@cthullu.freeserve.co.uk Work e-mail: jaket@revolution.co.uk