I have an analog gamepad and i want to use the joysticks for two seperate controls. i want to use the left stick for direction and the right for firing. i need 360 movement but i cannot find the right extension to do it.
I have used the built in analog control extension and also AGCO (crashes mmf), ControlX, Control Interpeter and Joypad object. none of these give the required result. the closest i have come is making the object i want to control jump around like mad. please help and you will get a mention in the credits of my game.
I think the Joypad Object should be able to do what you're requiring.
You just have to realize that the analog scale is from 0 to 65280 (I think) on each axis, with 32512 being the neutral center.
thanks for the quick reply. i havent a clue how to use this data though. i have only just thought of using analog controls for the game. please help this is all new to me.
there is one built into mmf but it is crap. the only things i can get out of it are raw values for X Y Z and buttons A B C D. this does not help me much!
Well, using the Joypad Object, you should be able to get the raw values for six different axes. For a standard PS2 controller, the X and Y axes for the left analog stick are simply X and Y, while those for the right analog stick are Z and R.
You say you want 360 degree movement from this? You should be able to just use the Direction Calculator (or Advanced Direction Object, I think it's called now?) to convert these raw values into a 360-degree direction and a speed value.
And find the speed with:
LongDist( "Advanced Direction Object", 32512, 32512, RawX( "Joypad object", 0 ), RawY( "Joypad object", 0 ) )
'Course, the problem that arises then is that the distance values can get too great to calculate, so I'd suggest you scale it down with something like this:
thanks for the help fifth but this is really winding me up now. the code you gave me develops a syntax error so i tried to edit it a little and all i got was jumpy turning again. i'm not bothered about the speed i just need 360 degree turning for now the speed is controlled on a trigger button so that is easy enough to do. can somebody fix this for me or at least create an example for me to edit.
EDIT: Tried the code you gave me again fifth and it was valid this time (?) but it still gives me erratic turning.
ok finally fixed the control system up just one more slight problem. when i stop moving the object it reverts back to it's starting direction instead of the direction it was last moving. can anybody tell me why?
Hmm, I think that'd be because it can't calculate the direction properly when the analog stick is so close to the center.
I'd suggest setting a separate value to the analog stick's distance, and then only adjust your angle when that distance value is greater than some number.
Thanks for the tip but i've realised that it isn't musch of a problem now as you shouldnever be still during the game. keep your eye out for the demo coming soon.