Author Topic: Getting the Nunchuck Joystick to be Analog  (Read 11565 times)

Offline revel911

  • *
  • Posts: 26
  • Karma: +0/-0
    • View Profile
on: April 04, 2009, 03:03:30 PM
Greetings, I am trying to get the Joystick to run a large gambit of accelerations depending on how little or much I push the joystick. I am hoping there is a code specifically for this, but since I didn't know of one, I wrote one with variables. (The code is set up for WASD, since I want to use the Nunchuck with My mouse for a smoother FPS experience.)

Quote
   
if (-0.2 < Wiimote.Nunchuk.JoyX < -0.1) {
   A = True
   wait 400 ms
   A = False
   }
if (-0.3 < Wiimote.Nunchuk.JoyX < -0.2) {
   A = True
   wait 200 ms
   A = False
   }
if (-0.4 < Wiimote.Nunchuk.JoyX < -0.3) {
   A = True
   wait 300 ms
   A = False
   }
if (-0.5 < Wiimote.Nunchuk.JoyX < -0.4) {
   A = True
   wait 100 ms
   A = False
   }
if (-0.6 < Wiimote.Nunchuk.JoyX < -0.5) {
   A = True
   wait 75 ms
   A = False
   }
if (-0.7 < Wiimote.Nunchuk.JoyX < -0.6) {
   A = True
   wait 50 ms
   A = False
   }
if (-0.8 < Wiimote.Nunchuk.JoyX < -0.7) {
   A = True
   wait 25 ms
   A = False
   }
if (-0.9 < Wiimote.Nunchuk.JoyX < -0.8) {
   A = True
   wait 10 ms
   A = False
   }
if (-1.5 < Wiimote.Nunchuk.JoyX < -0.9) {
   A = True
   wait 1 ms
   A = False
   }


if (0.1 < Wiimote.Nunchuk.JoyX < 0.2) {
   D = True
   wait 400 ms
   D = False
   }
if (0.2 < Wiimote.Nunchuk.JoyX < 0.3) {
   D = True
   wait 300 ms
   D = False
   }
if (0.3 < Wiimote.Nunchuk.JoyX < 0.4) {
   D = True
   wait 200 ms
   D = False
   }
if (0.4 < Wiimote.Nunchuk.JoyX < 0.5) {
   D = True
   wait 100 ms
   D = False
   }
if (0.5 < Wiimote.Nunchuk.JoyX < 0.6) {
   D = True
   wait 75 ms
   D = False
   }
if (0.6 < Wiimote.Nunchuk.JoyX < 0.7) {
   D = True
   wait 50 ms
   D = False
   }
if (0.7 < Wiimote.Nunchuk.JoyX < 0.8) {
   D = True
   wait 25 ms
   D = False
   }
if (0.8 < Wiimote.Nunchuk.JoyX < 0.9) {
   D = True
   wait 10 ms
   D = False
   }
if (0.9 < Wiimote.Nunchuk.JoyX < 1.5) {
   D = True
   wait 1 ms
   D = False
   }
       

                 
if (0.1 < Wiimote.Nunchuk.JoyY < 0.2) {
   s = True
   wait 400 ms
   s = False
   }
if (0.2 < Wiimote.Nunchuk.JoyY < 0.3) {
   s = True
   wait 300 ms
   s = False
   }
if (0.3 < Wiimote.Nunchuk.JoyY < 0.4) {
   s = True
   wait 200 ms
   s = False
   }
if (0.4 < Wiimote.Nunchuk.JoyY < 0.5) {
   s = True
   wait 100 ms
   s = False
   }
if (0.5 < Wiimote.Nunchuk.JoyY < 0.6) {
   s = True
   wait 75 ms
   s = False
   }
if (0.6 < Wiimote.Nunchuk.JoyY < 0.7) {
   s = True
   wait 50 ms
   s = False
   }
if (0.7 < Wiimote.Nunchuk.JoyY < 0.8) {
   s = True
   wait 25 ms
   s = False
   }
if (0.8 < Wiimote.Nunchuk.JoyY < 0.9) {
   s = True
   wait 10 ms
   s = False
   }
if (0.9 < Wiimote.Nunchuk.JoyY < 1.5) {
   s = True
   wait 1 ms
   s = False
   }




if (-0.2< Wiimote.Nunchuk.JoyY < -0.1) {
   w = True
   wait 400 ms
   w = False
   }
if (-0.3< Wiimote.Nunchuk.JoyY < -0.2) {
   w = True
   wait 300 ms
   w = False
   }
if (-0.4< Wiimote.Nunchuk.JoyY < -0.3) {
   w = True
   wait 200 ms
   w = False
   }
if (-0.5< Wiimote.Nunchuk.JoyY < -0.4) {
   w = True
   wait 100 ms
   w = False
   }
if (-0.6< Wiimote.Nunchuk.JoyY < -0.5) {
   w = True
   wait 75 ms
   w = False
   }
if (-0.7< Wiimote.Nunchuk.JoyY < -0.6) {
   w = True
   wait 50 ms
   w = False
   }
if (-0.8< Wiimote.Nunchuk.JoyY < -0.7) {
   w = True
   wait 25 ms
   w = False
   }
if (-0.9< Wiimote.Nunchuk.JoyY < -0.8) {
   w = True
   wait 10 ms
   w = False
   }
if (-1.5< Wiimote.Nunchuk.JoyY < -0.9) {
   w = True
   wait 1 ms
   w = False
   }

There is definitely a major problem with this though. It moves far then stops rather than a variable of pace, so I figured a way to fix that was to make each variable contain a wait after the button is released like this:
Quote
if (-0.2< Wiimote.Nunchuk.JoyY < -0.1) {
   w = True
   wait 1 ms
   w = False
   wait 400 ms
   }

This makes the second wait as a stopper, which works great in "most" games. Problem though, in some of the fast FPS games like UT3 or Quake, this makes you double jump or dodge instead of moving since it sees this continual moving as a double tap.

Anyone have an idea how to fix this?



Offline revel911

  • *
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Reply #1 on: April 21, 2009, 11:23:03 PM
nothing?



Offline bg4m3r

  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Reply #2 on: July 30, 2011, 07:19:03 PM
Have you tried using PPJoy? Of course, that would require those games to have gamepad support...