Can GlovePIE ignore the postion of the Nunchuck

Can GlovePIE ignore the postion of the Nunchuck

Postby Jay » Wed 16 Jun, 2010 5:20 am

Is there a way to have GlovePIE ignore the position of the nunchuck when executing analog stick movements? The issue that I am having is that I wrote a very simple script which I will include below and if I have the nunchuck positioned so that the analog stick faces up the commands function properly, but If I place my hand on my leg and the position of the nunchuck is now analog stick pointing right the analog stick seems to function as if it is rotated 90 degrees. Up is now left on the nunchuck.

Key.Up = Nunchuk.Up
Key.Down = Nunchuk.Down
Key.Left = Nunchuk.Left
Key.Right = Nunchuk.Right
Key.NUMPAD5 = Wiimote.Minus
Key.NUMPAD6 = Wiimote.Plus
Key.NUMPAD1 = Nunchuk.Z
Key.NUMPAD2 = Wiimote.A
Key.NUMPAD3 = Wiimote.Home
Key.NUMPAD4 = Wiimote.B
Key.NUMPAD7 = Nunchuk.C
Key.NUMPAD9 = Nunchuk.C
Key.Q = Wiimote.One
Key.W = Wiimote.Two

I tried to search but I couldn't find anything dealing with this issue, but it might just be my unfamiliarity with GlovePIE and relevant keywords. Thank you.
Jay
 

Re: Can GlovePIE ignore the postion of the Nunchuck

Postby Jay » Wed 16 Jun, 2010 6:24 am

I started to experiment by using bits and pieces from other scripts and I think, it has been working fine so far, I have found what I was looking for. I accomplished this by replaced the Nunchuk.UP/Down/Left/Right commands with the following

Key.Left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
Key.Right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
Key.Up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
Key.Down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)


My complete script looks like this now

Key.Left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
Key.Right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
Key.Up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
Key.Down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)
Key.NUMPAD5 = Wiimote.Minus
Key.NUMPAD6 = Wiimote.Plus
Key.NUMPAD1 = Nunchuk.Z
Key.NUMPAD2 = Wiimote.A
Key.NUMPAD3 = Wiimote.Home
Key.NUMPAD4 = Wiimote.B
Key.NUMPAD7 = Nunchuk.C
Key.NUMPAD9 = Nunchuk.C
Key.Q = Wiimote.One
Key.W = Wiimote.Two


I don't fully understand the new code but I am assuming that the code I was using previously was too vague. The Nunchuk.Up, etc. commands did exactly as they were supposed to but "Up" will vary depending on the orientation of the nunchuk. This new code, I assume, references specific points of travel in the analog sticks range, and thus does not depend on orientation. Hopefully this helps someone in the future.
Jay
 

Re: Can GlovePIE ignore the postion of the Nunchuck

Postby Guest » Wed 16 Jun, 2010 5:07 pm

Really when you tilted the Nunchuk the axis auto converted? I'll have to try that.

I don't fully understand the new code

you are setting a deadzone

an easier way is
ArrowKeys = Nunchuk.Joy
or
wasd = Nunchuk.Joy

Or If they need to be separated ( like anding tuning instead of side stepping)

Key.Up = Nunchuk.JoyY < -0.2 //Move UP
Key.Down = Nunchuk.JoyY > 0.2 //Move DOWN
Key.Left = Nunchuk.JoyX < -0.2 //Move LEFT
Key.Right = Nunchuk.JoyX > 0.2 //Move RIGHT
Guest
 

Re: Can GlovePIE ignore the postion of the Nunchuck

Postby Jay » Thu 17 Jun, 2010 5:26 am

Really when you tilted the Nunchuk the axis auto converted? I'll have to try that.


That was my experience using GlovePIE 0.43. I just had downloaded GlovePIE last night to try and get the Wiimote and Nunchuk working to use with a Playstation emulator.

I have zero experience programming anything so hopefully you can clarify what you mean by deadzone. I assume you mean it sets a minimum(and maximum?) value that needs to be read from the Nunchuk before any action is registered? To prevent the character twitching around and acting erratic?
Jay
 

Re: Can GlovePIE ignore the postion of the Nunchuck

Postby Guest » Thu 17 Jun, 2010 6:14 am

;) You got it

With the easy way Glovepie does the work of setting the values for you; saving typing and chance of deadzone error

I find maximum values are not needed for Nunchuk.Joy ,unless your planing on using rings (49-way joy).
Guest
 


Return to Nintendo Wii Remote

Who is online

Users browsing this forum: No registered users and 1 guest

cron