Heya all, I was wondering if some keys take precedence over another?
for example, I have the following control for an aircraft
w - pitch down
s - pitch up
a - yaw left
d - yaw right
q - bank left
e - bank right
I am using keystate() commands to manouevre my aircraft. Individually, there is no problem with these commands, but using particular keys at the same time sometimes runs into problems.
THe main example is if I try to pitch forward, and bank right at the same time, (w and e keys together). If I press w first, then pressing the e key has no effect (i.e. it wont bank - although I can use the q key to bank left). However if I have the e key pressed, then I am able to use the w and s to pitch quite happily
this is waht I am using:
FUNCTION chopcont
rem this section is for controlling the chopper
lifterx# = OBJECT POSITION X(1)
liftery# = OBJECT POSITION Y(1)
lifterz# = OBJECT POSITION Z(1)
Rem control pitch with S and W keys
if keystate(31)=1
if liftptch#>320 OR liftptch#<40
liftptch#=wrapvalue(liftptch#-2.5)
endif
endif
if keystate(17)=1
if liftptch#>320 OR liftptch#<40
liftptch#=wrapvalue(liftptch#+2.5)
endif
endif
if liftptch#<358 AND liftptch#>270 AND scancode()<>31 AND scancode()<>17
liftptch#=wrapvalue(liftptch#+2.5)
endif
if liftptch#>2 AND liftptch#<90 AND scancode()<>31 AND scancode()<>17
liftptch#=wrapvalue(liftptch#-2.5)
endif
Rem control yaw with A and D keys
if keystate(30)=1 then lifthead#=wrapvalue(lifthead#-2.5)
if keystate(32)=1 then lifthead#=wrapvalue(lifthead#+2.5)
Rem control bank using Q and E keys
if keystate(16)=1
if liftbank#>320 OR liftbank#<40
liftbank#=wrapvalue(liftbank#+2.5)
endif
endif
if keystate(18)=1
if liftbank#>320 OR liftbank#<40
liftbank#=wrapvalue(liftbank#-2.5)
endif
endif
if liftbank#<358 AND liftbank#>270 AND scancode()<>16 AND scancode()<>18
liftbank#=wrapvalue(liftbank#+2.5)
endif
if liftbank#>2 AND liftbank#<90 AND scancode()<>16 AND scancode()<>18
liftbank#=wrapvalue(liftbank#-2.5)
endif
rotate limb 1,1,0,0,liftbank#
Rem Update rotation
xrotate object 1,liftptch#
yrotate object 1,lifthead#
endfunction