giorgiouniv
Joined: 20 Jan 2007 Posts: 5
Digg It |
Posted: Mon Jan 29, 2007 7:41 pm Post subject: New IR mouse track script! For 1 IR source |
|
|
Hi to everybody!
That's a new script for wii mouse IR track of 1 IR source.
It is quite precise, in my opinion.
Give me suggestions! http://www.myspace.com/giorgiouniv
that's the code:
| Code: | // Mouse IR Control Script
// by giorgiouniv
// giorgio_univ@hotmail.it
//
// calibration: as the the var.precision value decreases, the mouse
// movement will be smoother, but slower; as it will increase, it will
// become more faster, but less precise
var.precision=0.05
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
Mouse.MiddleButton = Wiimote.Home
Keyboard.Up = Wiimote.Up
Keyboard.Down = Wiimote.Down
Keyboard.Left = Wiimote.Left
Keyboard.Right = Wiimote.Right
if wiimote.plus then
volumeup = true
wait 60 ms
volumeup = false
endif
if wiimote.minus then
volumedown = true
wait 60 ms
volumedown = false
endif
if 0 = 0 then
if var.kitt = 0 then
wiimote.Leds = 1
endif
if var.kitt = 1 then
wiimote.Leds = 3
endif
if var.kitt = 2 then
wiimote.Leds = 6
endif
if var.kitt = 3 then
wiimote.Leds = 12
endif
if var.kitt = 4 then
wiimote.Leds = 8
endif
if var.kitt = 5 then
wiimote.Leds = 12
endif
if var.kitt = 6 then
wiimote.Leds = 6
endif
if var.kitt = 7 then
wiimote.Leds = 3
endif
wait 50 ms
var.kitt = (var.kitt + 1) % 8
endif
if wiimote.dot1vis then
var.oldX=mouse.x
var.oldY=mouse.y
//debug=var.oldX + ' '+ var.oldY
//old method..
//var.xxx=(1024-wiimote.dot1x)/1024
//var.yyy=(wiimote.dot1y)/768
//this works better
var.newWiimoteX=wiimote.dot1x-200
var.xxx=(800-var.newWiimoteX)/800
var.yyy=(wiimote.dot1y)/700
var.dx=var.xxx-var.oldX
var.dy=var.yyy-var.oldY
//debug=var.dx + ' '+ var.dy
if IsZero(var.dx) then
else
mouse.x= var.oldX+ (var.dx*var.precision)
endif
if IsZero(var.dy) then
else
mouse.y= var.oldY+ (var.dy*var.precision)
endif
debug='tracking'
else
debug='not tracking'
endif
|
What do you think about it?
See this new video about wii mouse use with windows..
http://www.youtube.com/watch?v=PEqACmQCWxg
Thanks ya!
Giorgio _________________ http://www.myspace.com/giorgiouniv |
|