Scaling Joystick return values

Doing a radar simulation where a joystick moves a cursor over bogies heading towards the ship at the center of the screen. The outer marker ring is 10,000 yards. When the cursor is over a bogie, the joystick is pressed to mark that bogies as the current target.

I'm using GameControl Plus to interface to the joystick, and am noticing that as the bogies get close to the ship, there is a lot of jitter and it gets harder to 'mark' them. I have been using the GC+ return values for X and Y as they come (-1 to 1 linear) - but I'm wondering if I should be scaling them as the cursor gets closer to the ship - i.e. have progressive resolution from 10,000 yard to zero?

Wondering how to do this... would making the joystick values proceed at a logarithmic rate be appropriate? Ideas?


  • Answer ✓

    It seems that you want less sensitivity in the returned values nears zero, ie when the joystick is near the rest position. If v is the value in the range -1 to +1 then the adjusted value avcould be calculsted with

    av = v >= 0 ? v * v : -v * v;

    av will still be in the range -1 to +1 but you would need larger joystick movements near rhe rest position to move the cursor.

  • Thanks Quark - will put that code to the test shortly.

Sign In or Register to comment.