Analogue controller turning

Blitz3D Forums/Blitz3D Programming/Analogue controller turning

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Really you should be using something like this for the deadzone:

Joy_X# = GetValue( joyx() , .1 )

function GetValue#( joy# , DeadZone# )

  If Abs( joy ) < Deadzone
    joy# =0
  Else
    joy# = ( Joy - Sgn( Joy ) * DeadZone ) / ( 1.0 - DeadZone )
  EndIf

  return joy
end function


Say for example you have to use a high deadzone of .25. As soon as you hit .26 your speed will initially lurch rather than move smoothly.

You could also use deltayaw by parenting and positioning a pivot like so:


pivot = createpivot( cube )

joy_x# = GetValue( joyx(), .1 )
joy_y# = GetValue( joyy(), .1 )

if abs( joy_x ) > 0 or abs( joy_y) > 0 
  positionentity Pivot, joy_x , 0 , joy_y
  DY# = deltayaw( cube , pivot )
  turnentity cube, 0 , DY * .8 , 0
endif


Stevie