Path: chuka.playstation.co.uk!news From: Nigel Critten Newsgroups: scee.yaroze.freetalk.english Subject: joystick directions Date: Sun, 07 Jul 2002 21:57:01 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 43 Message-ID: <3D28AB1D.8010407@100Tinsoldiers.com> NNTP-Posting-Host: modem-924.beedrill.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en Hi, Another little problem for everyone, because I'm struggling, must do a remedial maths course at some point, anyway. What I'm trying to do is this using the analog stick I want to know which angle my character should be pointing in. so (excuse the rough ascii sketch) -1 (0 degrees) ^ | | -1 <---o---> 1 (90 degrees) (270) | | v 1 (180 degrees) so the character moves in 3D but its motion is based as if you are looking straight down on it, okay not describing this very well let say a man is standing in the middle of a room facing forward which is (y)-1 (0 degrees) if I then pushed the joystick right he would turn to face (x) 1 (90 degrees) if I then pressed the joystick left he would turn to face (x) -1 (270 degrees). I hope that made some sense, I'm basing this system on a Graftgold method which goes like this "The map of a players movement is a circle. The Graftgold way of doing this was to store a player direction as a number 0-255. This made it easier to handle than 360 degrees. Then we looked up a sample of a sine and cosine table to get the X and Y movement in that direction. " I might be going off at a tangent (sorry about the pun) but I still need to be able to find out the players direction so I'm still no closer, any ideas, anyone recommend a good book :) Cheers Nigel 2D (never should have started in 3D)