its been a while since ive actually posted anything on these forums, and i got bored so i threw this together real quick. its a very simple helicopter sim that includes gamepad support.
as controllers vary, i've set this up to work with my xbox 360 controller. you can use the left joystick to control pitch and roll, the left and right triggers to change your heading. `fire button a` will build up your thrust.
the alternate controls are a combination of mouse and keyboard... actually very simular to the battlefield series helicopter controls: `W` adds thrust, `A` and `D` change heading, and the mouse controls both pitch and roll.
i know this isnt very complex but i found myself lost just playin with it so i figured id share. i hope you enjoy
coldfire
` fake helicopter physics by coldfire
set display mode 1024,768,32,1:set window off:autocam off
global thrust# = 0.0
make matrix 1,1024,1024,128,128:position camera 512,4.0,512
do
if joystick fire a() or keystate(17)
inc thrust#,0.001
else dec thrust#,0.001
endif
if thrust#<0.0 then thrust#=0.0:if thrust#>0.2 then thrust#=0.20
pitch camera up 90.0:move camera thrust#:pitch camera down 90
roll camera right joystick x()*0.001:roll camera right mousemovex()*0.05
pitch camera up joystick y()*0.001:pitch camera down mousemovey()*0.05
turn camera left joystick z()*0.001
if keystate(30) then turn camera left 0.1
if keystate(32) then turn camera right 0.1
position camera camera position x(),camera position y()-0.15,camera position z()
if camera position y()<4.0 then position camera camera position x(),4.0,camera position z()
loop
end