WiiMote implementation

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
BenJuan26
DBB Cadet
DBB Cadet
Posts: 3
Joined: Tue Jan 17, 2012 3:35 pm
Location: Canada

WiiMote implementation

Post by BenJuan26 »

Hi everyone,
It's been some time since I've been on these forums but I was just looking through my YouTube videos and was reminded that someone had commented saying they wanted to share the video of my WiiMote implementation into D3. I'm not sure if he ever did so I thought I'd share it in case anyone is into that sort of thing. The video can be found here.

On another note, I lost the code I had to make this work, but it could easily be recreated or I could give instructions if anyone is interested in doing this themselves. It was done using GlovePIE and PPJoy, with the WiiMote connected through Bluetooth. To be perfectly honest it's not the most ideal/practical control method but it does offer a nice alternative in case a joystick is not available and you already have a WiiMote lying around.

Cheers
User avatar
snoopy
DBB Benefactor
DBB Benefactor
Posts: 4435
Joined: Thu Sep 02, 1999 2:01 am

Re: WiiMote implementation

Post by snoopy »

Welcome!

Looks cool. You should track down the code again!
Arch Linux x86-64, Openbox
"We'll just set a new course for that empty region over there, near that blackish, holeish thing. " Zapp Brannigan
BenJuan26
DBB Cadet
DBB Cadet
Posts: 3
Joined: Tue Jan 17, 2012 3:35 pm
Location: Canada

Re: WiiMote implementation

Post by BenJuan26 »

I'm going to be around the computer that probably still has the code this weekend, I'll see if I can dig it up.
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6511
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Re: WiiMote implementation

Post by Jeff250 »

Cool!
BenJuan26
DBB Cadet
DBB Cadet
Posts: 3
Joined: Tue Jan 17, 2012 3:35 pm
Location: Canada

Re: WiiMote implementation

Post by BenJuan26 »

Hi all,
I managed to dig up the code. In order for everything to work properly you will need PPJoy and GlovePIE installed (I won't go over how to do that here). The following code is then run within GlovePIE:

Code: Select all

if wiimote1.pointerx > 0.25 and < 0.75
   ppjoy1.analog0 = MapRange(wiimote1.pointerX,0.25,0.75,-0.25,0.25)
   else ppjoy1.analog0 = MapRange(wiimote1.pointerX,0,1,-1,1)
   endif

if wiimote1.pointery > 0.25 and < 0.75
   ppjoy1.analog1 = MapRange(wiimote1.pointery,0.25,0.75,-0.25,0.25)
   else ppjoy1.analog1 = MapRange(wiimote1.pointery,0,1,-1,1)
   endif

PPJoy1.Analog2 = Maprange(Wiimote1.Nunchuk.JoyX,-1,1,-1,1)

if wiimote1.roll > -30 and < 30
   ppjoy1.Analog3 = 0
   else ppjoy1.Analog3 = MapRange(Wiimote1.roll, -120 degrees,120 degrees, -1,1)
   endif

PPJoy1.Analog4 = MapRange(Wiimote1.Nunchuk.JoyY,-1,1,-1,1)
PPJoy1.Analog5 = MapRange(WiiMote1.Nunchuk.Pitch,-90,90,-1,1)
PPJoy1.Digital0 = Wiimote1.A
PPJoy1.Digital1 = Wiimote1.B
PPJoy1.Digital2 = Wiimote1.Nunchuk.CButton
PPJoy1.Digital3 = Wiimote1.Nunchuk.ZButton
PPJoy1.Digital4 = Wiimote1.Plus
PPJoy1.Digital5 = Wiimote1.Minus
PPJoy1.Digital6 = Wiimote1.Home
PPJoy1.Digital7 = Wiimote1.One
PPJoy1.Digital8 = Wiimote1.Two
PPJoy1.Digital9 = Wiimote1.Up
PPJoy1.Digital10 = Wiimote1.Down
PPJoy1.Digital11 = Wiimote1.Left
Hopefully some of you can try it out and see what you think.
Post Reply