 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
olaf
Joined: 11 Dec 2006 Posts: 3
Digg It |
Posted: Mon Dec 11, 2006 7:16 pm Post subject: |
|
|
i tried it with the remote code and it kinda works but not really accurate and not in all directions but it has some sense of where it is
:EDIT
I just found this script wich works a LOT better, still buggy but a major improvement
i dont have the nintendo 'sensorbar' so i had to use some candles wich gives the same result in short range.
i dont really get the code yet but you guys will know what to do with this
| Code: |
//Mouse Control Script using IR
//by vkapadia
//vkapadia@vkapadia.com
//
//Options:
var.smooth = 10 //how many frames to smooth over. higher = more smooth, less precise
//var.smooth doesnt work yet, if you want to change the smoothing,
//find the "Mouse.CursorPosX =" and "Mouse.CursorPosY =" lines and change
//the very last number (should be 10 initially) to whatever value.
var.KITTspeed = 100 ms //delay speed for flashing LEDs. higher = slower
//more options to be added later
//Controls:
//Point Wiimote = Move Mouse
//D-Pad = Arrow Keys
//B-Button = Left Click
//Home = Middle Click
//A-Button = Right Click
//Plus and Minus = Control Volume
//One = Unmapped
//Two = Unmapped
//
//If the pointer hits the edge of the screen, the Wiimote will rumble a bit.
//
//The LEDs attempt to emulate KITT's grill from Knight Rider
//Display the location of the mouse in Pixels
//debug = round(RemoveUnits(Mouse.x * screen.Width)) + ", " + round(RemoveUnits(Mouse.y * screen.Height))
//Set the D-Pad to function as the Arrow Keys
if wiimote.Up
Up = true
Wait 200 ms
Up = false
endif
if wiimote.Down
Down = true
Wait 200 ms
Down = false
endif
if wiimote.Left
Left = true
Wait 200 ms
Left = false
endif
if wiimote.Right
Right = true
Wait 200 ms
Right = false
endif
//Mouse Buttons
Mouse.RightButton = Wiimote.A
Mouse.LeftButton = Wiimote.B
Mouse.MiddleButton = Wiimote.Home
//Plus and Minus handle Volume
if wiimote.plus then
volumeup = true
wait 60 ms
volumeup = false
endif
if wiimote.minus then
volumedown = true
wait 60 ms
volumedown = false
endif
//wiimote.One
//wiimote.Two
//LEDs look somewhat like KITT's grill from Knight Rider
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 var.KITTspeed
var.kitt = (var.kitt + 1) % 8
endif
//If the mouse reaches the end, rumble for 200 milliseconds
if mouse.x = 0 or mouse.x = 1 or mouse.y = 0 or mouse.y = 1 then
if var.rmbl = false
wiimote.Rumble = 1
wait 200 ms
wiimote.Rumble = 0
endif
var.rmbl = true
else
var.rmbl = false
endif
if wiimote.dot1vis then
if abs(wiimote.dot1x - var.ox) > 1 then
Mouse.CursorPosX = smooth(((1024-wiimote.dot1x) * Screen.Width / 1024) * 1.1 - 50, 10)
var.ox = wiimote.dot1x
endif
if abs(wiimote.dot1y - var.oy) > 1 then
Mouse.CursorPosY = smooth(((wiimote.dot1y) * Screen.Height / 768) * 1.1 - 40, 10)
var.oy = wiimote.dot1y
endif
endif
|
|
|
| Back to top |
|
 |
HiNtZ
Joined: 27 Dec 2007 Posts: 67
Digg It |
Posted: Fri Jan 11, 2008 10:51 am Post subject: |
|
|
Blackfrog, I'm very interested in what you are doing here!
Add me to MSN Lightside55 AT hotmail DOT com
I need to ask you some things :p |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|