Wiimote Project

Wiimote Projects => Wiimote Glovepie projects => Topic started by: Reckless on August 30, 2009, 06:08:52 PM

Title: IR Mouse Script?
Post by: Reckless on August 30, 2009, 06:08:52 PM
First: Sorry to bother you with such a simple request!

I now spent about 5 hours until I finaly got my wiimote connected with my new HTPC and to set everything up so that the wiimote autoconnects with the 1+2 and Bluesoleil + GlovePIE.

I am searching a simple IR Mouse script!

The coursor should be where I am pointing at - thats all.

I can configure the buttons for myselfe then ;)

I know that there are several mouse scripts provided with GlovePIE but I couldnt figure out which one to use?!
Title: Re: IR Mouse Script?
Post by: mason on November 01, 2009, 12:04:39 AM
Don't forget your sensor bar.

IR Mouse.pie

Code: [Select]
// Wiimote mouse script for Windows desktop
// Requires a sensor bar

var.ButtonFreezeTime = 250ms
var.PointerBump = KeepDown(Pressed(wiimote.A),var.ButtonFreezeTime) or KeepDown(Pressed(wiimote.B),var.ButtonFreezeTime)
Wiimote.Led1 = true

// Mouse movement
if wiimote.PointerVisible but not var.PointerBump then
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

// Mouse Buttons
mouse.LeftButton = Wiimote.A and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.RightButton = Wiimote.B and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.MiddleButton = Wiimote.Home and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.XButton1 = Wiimote.Minus
mouse.XButton2 = Wiimote.Plus

// Mouse Wheel
if wiimote.Up then
  mouse.WheelUp = true
  wait 30ms
  mouse.WheelUp = false
  wait 30ms
end if
if wiimote.Down then
  mouse.WheelDown = true
  wait 30ms
  mouse.WheelDown = false
  wait 30ms
end if
Title: Re: IR Mouse Script?
Post by: greenstar on January 26, 2010, 08:01:12 PM
 :D Thankyou very much. This is the first script i've gotten working in windows 7, and natural lighting provided enough of an IR source for some dodgy point-it-out-the-window aiming.  :D
Title: Re: IR Mouse Script?
Post by: uncleskunky on March 12, 2010, 07:40:50 PM
Hi everybody.

I used a portion of the above script,

if wiimote.PointerVisible but not var.PointerBump then
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

This works great in cod6 modern warfare 2, but I was wondering if someone can tell me how to slow it down just a little, I have to run the mouse sensitivity at the lowest setting in game, and it is still just a hair too fast.

also I have done some searching but haven't found anything on assigning more than one keystroke to wiimote buttons. Is this possible?

thanks in advance...
Title: Re: IR Mouse Script?
Post by: SilentProfit on July 13, 2011, 10:48:06 PM
Hi all.

This Script was "nearly" what I needed. I am running a 3 monitor (19" each) setup. This script wouldnt allow my cursor to move past the middle of the side screens. I tried my homemade IR bar and the Wii Sensor bar, (of course adjusting the calibrations appropriately) and I had issues with distance accuracy and precision.

My home-made sensor bar is 2 IR-LEDs spaced ~60mm apart and set below my center screen running of a CR2032 bat.

I am intending on arranging a 2x2 four monitor display arrangement with possibly 4 IR-LEDs placed either in the four outer corners of the setup or on the ends of the vertical and horizontal axes.

Took me about 2 months on and off to finally get GlovePIE to consistently sense the Wiimote and now im learning scripts... (Im a freshman in a College of Engineering for Software Eng; So you're fueling my future career by helping me  :P )

Need some Newb advice

Title: Re: IR Mouse Script?
Post by: bg4m3r on July 30, 2011, 07:37:13 PM
I'm rather newbish myself, so I don't have an exact answer, but I think you need to map the width and height of your monitor arrangement to the IR range...or maybe multiplying the input from the wiimote to increase mouse speed?
VirtualDesktop, or DirectInput commands might be needed too...I am actually having a similar problem (I need to have the cursor on my secondary monitor, not the primary), so if you get this solved, please post your solution! It will probably be related to mine.
Here is some documentation for GlovePIE .43
http://glovepie.org/w/index.php?title=Preliminary_Documentation_v0.43 (http://glovepie.org/w/index.php?title=Preliminary_Documentation_v0.43)