As beautiful as the control via the gyroscopic sensor is, it is not to be used for the exact mouse control. In spite of everything, this control is also worth a try of its own. We simulate the X-axis by rolling the Wiimote around its longitudinal axis, the Y-axis by simple up s and down of the Wiimote or wiimote. Rotation around the short X axis.
As a reminder, once again the control axes. With the values for accuracy, of course, something can be played, depending on the taste and area of application. And beware: don't forget the wrist loop!
Mouse control without IR sensor bar directly via gyroscope:
var.x = Wiimote.RawForceX + 6 = Values from calibration
var.y = Wiimote.RawForceY + 20
var.z = Wiimote.RawForceZ + 6
Accuracy
var.sense0 = 500
var.thresh0x = 5
var.thresh0y = 2
first sensitivity setting
xaxis
if var.x > var.thresh0x
mouse.x = mouse.x – 1/var.sense0
Endif
if var.x< -var.thresh0x
mouse.x = mouse.x + 1/var.sense0
Endif
yaxis
if var.z > var.thresh0y
mouse.y = mouse.y – 1/var.sense0
Endif
if var.z< -var.thresh0y
mouse.y = mouse.y + 1/var.sense0
Endif
Theoretically, you can already build on this and simulate a steering wheel by an equivalent rotation around the Z-axis. This is done in the next script, with which you can play Trackmania Nations using Wiimote "steering wheel". The Wiimote is held like a steering wheel, the IR sensor points to the left in the horizontal basic position
Trackmania script:
var.led = 0 /1 = Leds on ; 0 = Leds off
Var. BaseOn = 30
Var. AddOn = 4
Var. BaseOff = 20
Var. AddOff = 0
var.zBase = 0.20
var.zAdd = 0.04
Control panel
Keyboard.Enter = Wiimote.A /Enter key
Keyboard.Down = Wiimote.One
Keyboard.Up = Wiimote.Two
Keyboard.Escape = Wiimote.Home /ESC key
Keyboard.NUMPAD1 = Wiimote.Up
Keyboard.NUMPAD2 = Wiimote.Right
Keyboard.NUMPAD3 = Wiimote.Down
Steering to the right
if Wiimote.gZ >= var.zBase and< (var.zBase + var.zAdd)
Keyboard.Right = 1
wait (var.baseon ms)
Keyboard.Right = 0
wait (var.baseoff ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd) and< (var.zBase + var.zAdd * 2)
Keyboard.Right = 1
wait (var.baseon + var.addon ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 2) and< (var.zBase + var.zAdd * 3)
Keyboard.Right = 1
wait (var.baseon + var.addon * 2 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 2 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 3) and< (var.zBase + var.zAdd * 4)
Keyboard.Right = 1
wait (var.baseon + var.addon * 3 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 3 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 4) and< (var.zBase + var.zAdd * 5)
Keyboard.Right = 1
wait (var.baseon + var.addon * 4 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 4 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 5) and< (var.zBase + var.zAdd * 6)
Keyboard.Right = 1
wait (var.baseon + var.addon * 5 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 5 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 6) and< (var.zBase + var.zAdd * 7)
Keyboard.Right = 1
wait (var.baseon + var.addon * 6 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 6 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 7) and< (var.zBase + var.zAdd * 8)
Keyboard.Right = 1
wait (var.baseon + var.addon * 7 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 7 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 8) and< (var.zBase + var.zAdd * 9)
Keyboard.Right = 1
wait (var.baseon + var.addon * 8 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 8 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 9) and< (var.zBase + var.zAdd * 10)
Keyboard.Right = 1
wait (var.baseon + var.addon * 9 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 9 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 10) and< (var.zBase + var.zAdd * 11)
Keyboard.Right = 1
wait (var.baseon + var.addon * 10 ms)
Keyboard.Right = 0
wait (var.baseoff + var.addoff * 10 ms)
Endif
if Wiimote.gZ >= (var.zBase + var.zAdd * 11)
Keyboard.Right = 1
Endif
Steering to the left
if Wiimote.gZ <= -(var.zbase)="" and="">-(var.zBase + var.zAdd)</=>
Keyboard.Left = 1
wait (var.baseon ms)
Keyboard.Left = 0
wait (var.baseoff ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd)="" and="">-(var.zBase + var.zAdd * 2)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 2)="" and="">-(var.zBase + var.zAdd * 3)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 2 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 2 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 3)="" and="">-(var.zBase + var.zAdd * 4)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 3 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 3 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 4)="" and="">-(var.zBase + var.zAdd * 5)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 4 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 4 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 5)="" and="">-(var.zBase + var.zAdd * 6)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 5 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 5 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 6)="" and="">-(var.zBase + var.zAdd * 7)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 6 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 6 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 7)="" and="">-(var.zBase + var.zAdd * 8)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 7 ms)
Keyboard.Left = 0
wait 20ms
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 8)="" and="">-(var.zBase + var.zAdd * 9)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 8 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 8 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 9)="" and="">-(var.zBase + var.zAdd * 10)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 9 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 9 ms)
Endif
if Wiimote.gZ <= -(var.zbase="" +="" var.zadd="" *="" 10)="" and="">-(var.zBase + var.zAdd * 11)</=>
Keyboard.Left = 1
wait (var.baseon + var.addon * 10 ms)
Keyboard.Left = 0
wait (var.baseoff + var.addoff * 10 ms)
Endif
if Wiimote.gZ<= -(var.zBase + var.zAdd * 11)
Keyboard.Left = 1
Endif
End of the Controls for steering to the left
Zero Point (Dead Zone)
if Wiimote.gZ > -(var.zBase) and< var.zBase
Keyboard.Left = 0
Keyboard.Right = 0
if var.led = 1
Wiimote.Leds = 6
Endif
Endif
LED control
if var.led = 1 and (Wiimote.gz > 0.20 and< 0.50)
Wiimote.Leds = 3
Endif
if var.led = 1 and Wiimote.gz >= 0.50
Wiimote.Leds = 1
Endif
if var.led = 1 and (Wiimote.gz < -0.20 and > -0.50)
Wiimote.Leds = 12
Endif
if var.led = 1 and Wiimote.gz<= -0.50
Wiimote.Leds = 8
Endif
Trackmania Nations with Wiimote control
Summary and conclusion
The use of the Wiimote on the desktop PC, notebook and HTPC as a control and input device makes perfect sense in some respects and can even save money (e.g. used as a whiteboard). Of course, the connection to the PC does not automatically offer the same functionality for games as the Wii itself. If you want an exact copy in this area and you have a little programming effort too much, you should buy the Wii, because almost every single game has to be customized on the PC. And even then, the perfect result is not always guaranteed. But if you like to experiment, the Wiimote becomes an indispensable fourth control unit next to the mouse, keyboard and gamepad.
Without sensor bar, no usable use as a mouse replacement is possible, therefore either the self-construction or the purchase of a finished sensor bar is mandatory. We used the Wiimote control on the home HTPC; the Mediacenter can be controlled more conveniently than with a normal IR remote control. In addition, the Wiimote was used as a pointer and control for a PowerPoint presentation via a beamer. The use was much more efficient than the fumbling mixture of laptop mouse and laser pointer. This is certainly where the strengths of the presented control system lie. And it was also quite passable to play, once you got used to the Wiimote.
From this point of view, not only the self-construction and programming was fun, but in the end a really usable new input device was created. Who does not shy away from the effort and to whom approx. 40 Euros for a Wiimote are not too much, you can only recommend the replica.
Kommentieren