Do you have a Wii yet? Think that little wiimote can do so much more? Well, now it can! Using a program called GlovePIE (
http://carl.kenner.googlepages.com/glovepie_download] and the following script, you can zoom, pan, rotate and move your polies and verts using your wiimote (and nunchuck, if connected)!
Just download and run GlovePIE, connect your Wiimote to your pc, load the following script (save it to notepad and open that file in GlovePIE) and run it. Tada!
It assumes standard key layout in max. It's for nunchuck or just the wiimote alone and it has a crude-ish on-the-fly calibration setting so you can adjust your hand position for prolonged use of the wiimote.
The most used functions are mapped (zoom (extent), pan, rotate, changing geometry level, left/right mouseclick) and motion is done using the acceleration sensors so you don't have to point anywhere specific, just pitch and roll the wiimmote.
Any comments (either on implementation (motion/buttons) or coding) are hugely appreciated.
<font class="small">Code:</font><hr /><pre> // wiidsmax
//a wiimote project for use with 3dsmax by Maarten "MacD" Edgar
//4 lines of the wiimote movement ripped from WiiMouse Version 0.2 by Sam Tyson
//HOW TO USE:
//-Install GlovePIE (copy contents of archive to whatever directory and run from
//there)
//-Connect Wiimote to pc (hold button 1 and 2 throughout the whole process)
//-load script (file>open...)
//-run script
//-CALIBRATE STANDARD OFFSETS to your specific wiimote (you only do this once):
//Place your wiimote on a table (buttons facing upwards). In the debug line
//of PIE you will see x/y/zOffSstd. Write these numbers down and stop running
//the script. Now fill in the numbers you wrote down in var.x/y/zOffSstd (near
//the bottom of the script) and save the script. Now the script is customised
//and accurate for your specific wiimote: you're ready to use the script to
//operate 3dsmax.
//-it doesn't matter if you open 3dsmax before or after PIE...as soon as you
//press "Run" in PIE the wiimote will function as mouse; try opening max with the
//wiimote to practice! Wiimote trigger is leftclick, A button is rightclick.
//MOVEMENT:
//This is based on the pitch and roll of the wiimote; point the wiimote up and
//down to move the mouse up and down, and roll the wiimote from side to side to
//move the mouse left and right.
//Because it sucks working with 3dsmax with a totally level wiimote, this script
//uses a dynamic calibration scheme so you can hold the wiimote in a more
//natural position. Just hold the wiimote level with the cursor to the center of
//the screen.Now press A on the wiimote and whilst holding A, move your hand to
//the position and orientation you wish to use the wiimote in (for example on
//your right leg with the wiimote pointing slightly up). Now release the A button
//and the wiimote cursor should be centered whilst your hand is in a comfortable
//position.
//This procedure takes some getting used to and is slightly fiddley. Try it a
//few times to get used to it. Yeah, this still needs some work
//LED indicators:
// LED 1 lights up to show wiimote connected
// LED 2 lights up to show you're in ROTATE mode
// LED 3 lights up to show you're in PAN mode
// LED 4 lights up to show you're in ZOOM mode
//Key layout depends if you have a nunchuk connected or not (this is autodetected).
//NO NUNCHUCK:
// wiimote.Up = alt+z, LMB = ZOOM toggle
// wiimote.Down = z key (zoom extents selected)
// wiimote.Left = ctrl+p, LMB = PAN toggle
// wiimote.Right = alt+MMB = arc ROTATE toggle
//
// wiimote.A = RMB
// wiimote.B = LMB
// wiimote.Home = enter
// wiimote.Home doubleclick = turn off PIE emulation for wiimote
// plus and minus shift numbers 1 through 5 for vertex/edge/element/face selection
// wiimote.One = zero current reference point (fix orientation)
// wiimote.Two = alt+w = multipane view/fullscreen current window
//WITH NUNCHUCK:
// wiimote.Up + Nunchuk Joystick up/down = alt+z, LMB = ZOOM on press
// wiimote.Down = z key (zoom extents selected)
// Wiimote.Left = Shift key
// wiimote.Right = unassigned
//
// Nunchuk C + Nunchuk Joystick: ROTATE on press
// Nunchuk Z + Nunchuk Joystick: PAN on press
//
// wiimote.A = RMB
// wiimote.B = LMB
// wiimote.Home = enter
// wiimote.Home doubleclick = turn off PIE emulation for wiimote
// plus and minus shift numbers 1 through 5 for vertex/edge/element/face selection
// wiimote.One = zero current reference point (fix orientation)
// wiimote.Two = alt+w = multipane view/fullscreen current window
//turns on first LED to show it's working and connected
wiimote.Led1 = 1
//wiimote key mappings:
//If no nunchuk:
if Wiimote.HasNunChuck=false then
//circle/rotate= alt+led2 toggle
if Wiimote.Right
if var.rottoggle=0
key.Alt && Mouse.MiddleButton=true
wiimote.Led2=true
var.rottoggle=var.rottoggle+1
else
key.Alt && Mouse.MiddleButton=false
wiimote.Led2=false
var.rottoggle=var.rottoggle-1
endif
wait 300 ms
endif
//pan=ctrl+p
if Wiimote.Left
if var.pantoggle=0
key.Ctrl && key.p=true
key.Ctrl && key.p=false
wiimote.Led3=true
var.pantoggle=var.pantoggle+1
wait 10 ms
Mouse.LeftButton=true
else
Mouse.LeftButton=false
wiimote.Led3=false
var.pantoggle=var.pantoggle-1
endif
wait 300 ms
endif
//zoom=alt+z
if Wiimote.Up
if var.zoomtoggle=0
key.Alt && key.z=true
key.Alt && key.z=false
wiimote.Led4=true
var.zoomtoggle=var.zoomtoggle+1
wait 10 ms
Mouse.LeftButton=true
else
Mouse.LeftButton=false
wiimote.Led4=false
var.zoomtoggle=var.zoomtoggle-1
endif
wait 300 ms
endif
else
//if you do have a nunchuck connected:
Key.shift = Wiimote.Left
//zoom=alt+z
if Wiimote.Up
key.Alt && key.z=true
key.Alt && key.z=false
wait 10 ms
Mouse.LeftButton = wiimote.Up
wiimote.Led4=true
mouse.DirectInputY = mouse.DirectInputY + 100*Wiimote.Nunchuk.JoyY
else
wiimote.Led4=false
endif
//Nunchuk C button rotate
if Wiimote.Nunchuk.CButton
key.Alt && Mouse.MiddleButton = Wiimote.Nunchuk.CButton
wiimote.Led2=true
mouse.DirectInputX = mouse.DirectInputX + 100*Wiimote.Nunchuk.JoyX
mouse.DirectInputY = mouse.DirectInputY + 100*Wiimote.Nunchuk.JoyY
else
wiimote.Led2=false
endif
//Nunchuk Z button pan
if Wiimote.Nunchuk.ZButton
key.Ctrl && key.p=true
key.Ctrl && key.p=false
wait 10 ms
Mouse.LeftButton = wiimote.Nunchuk.Zbutton
wiimote.Led3=true
mouse.DirectInputX = mouse.DirectInputX + 100*Wiimote.Nunchuk.JoyX
mouse.DirectInputY = mouse.DirectInputY + 100*Wiimote.Nunchuk.JoyY
else
wiimote.Led3=false
endif
endif
//end of nunchuck specific controls
//The rest is all the same no matter what controller is connected
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
//cyle routine so plus and minus shift number keys 1 thru 5
Inc(var.numbercycle) = pressed(Wiimote.Plus)
Dec(var.numbercycle) = pressed(Wiimote.Minus)
if var.numbercycle > 5 then var.numbercycle = 1
if var.numbercycle < 0 then var.numbercycle = 5
One = KeepDown(Pressed(var.numbercycle=1), 100ms)
Two = KeepDown(Pressed(var.numbercycle=2), 100ms)
Three = KeepDown(Pressed(var.numbercycle=3), 100ms)
Four = KeepDown(Pressed(var.numbercycle=4), 100ms)
Five = KeepDown(Pressed(var.numbercycle=5), 100ms)
if Wiimote.home
if doubleclicked(Wiimote.home)
ExitProgram //stops wiimote emulation script
else
Key.enter = Wiimote.home
endif
endif
key.z = Wiimote.Down
//multipane view/fullscreen current window
key.alt && key.w = wiimote.Two
//rumble on wiimote.B
//if Wiimote.B then
//if var.rmbl = false
//wiimote.Rumble = 1
//wait 50 ms
//wiimote.Rumble = 0
//endif
//var.rmbl = true
//else
//var.rmbl = false
//endif
//speed and movement settings:
//get these from debuginfo...set x/y/zOffSstd so x/y/zRot=0 in variable readout when wiimote is laid down on table:
var.xOffSstd = -1
var.yOffSstd = -25
var.zOffSstd = 0
var.speed = 1.5
var.xCutoff = 3
var.zCutoff = 1
//used for zeroing calibration axes
if var.calibrate = 0 then
var.xOffset = var.xOffSstd
var.yOffset = var.yOffSstd
var.zOffset = var.zOffSstd
else
var.xOffset = var.xOffSdyn
var.yOffset = var.yOffSdyn
var.zOffset = var.zOffSdyn
endif
var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset
//if button not pressed, map wiimote to mouse, if button pressed stop mapping and set offset
if Wiimote.One=false
if var.xRot > var.xCutoff then mouse.x = mouse.x - .001 * var.speed * (var.xRot - var.xCutoff)
if var.xRot < -var.xCutoff then mouse.x = mouse.x - .001 * var.speed * (var.xRot + var.xCutoff)
if var.zRot > var.zCutoff then mouse.y = mouse.y - .004 * var.speed * (var.zRot - var.zCutoff)
if var.zRot < -var.zCutoff then mouse.y = mouse.y - .004 * var.speed * (var.zRot + var.zCutoff)
else
var.xOffSdyn = -var.xRot
var.yOffSdyn = -var.yRot
var.zOffSdyn = -var.zRot
var.calibrate = 1
endif
debug = ('wiidsmax by MacD: ') + "xOffSstd= " + var.xRot + " yOffSstd= " + var.yRot + " zOffSstd= " + var.zRot </pre><hr />
Replies
wot?
There's also tons of scripts for GlovePIE, from scripts for FPS' to games for emulators to flightstick controls (hold the wiimote like a joystick!). Some obviously work better than others, and some just absolutely rock (the driving controlls are pretty cool, especially for those of us without a steering wheel).
As for connecting you wiimote to your pc...go to your bluetooth places, hold down buttons 1+2 on your wiimote, search for devices in range, select the wiimote and start the bluetooth wizard, select 'skip pairing' and when the wiimote icon has green arrows in bluetooth places, you're done and can release 1+2.
[ QUOTE ]
NOTE! You may not use this software on military bases, or for military purposes, or in Israel (which amounts to the same thing)
[/ QUOTE ]
I am not exactly a political person, but I'd rather search for an alternative software solution, than from a guy like this. I am sure I got software from people with all kinds of prejudices and questionable ideologies, but if the author expressively makes aware of it in the license...
Anyway, back on topic... I'm not particularly interested in using the WiiMote with 3DS Max, but being able to use the WiiMote on a PC could open up some pretty awesome homebrew possibilities. Too bad I don't have Wii... just one more reason to buy one I guess.
I wonder how the Wiimote would go in Mudbox. Methinks it might be as more practical application than your traditional 3d package.
[/ QUOTE ]
It could be interesting in Mudbox, even more so if you could use both controls, and have two cursors at the same time.
Don't get me wrong its a neat idea and I applaud the ingenuity behind the idea but its just not practical, not to mention the Wii-mote set up is meant to be used 2-10ft away from the Wii-wand, sitting 2ft away min is not practical at all.
I might try it out but maybe I shouldn't since I might use it to depict a violent military act, oh noes!!!11one