Tuesday, October 13, 2009

Google Earth

One of the samples scripts that comes along with the free download of glovePIE allows a user to take control of the application Google Earth using the Wiimote.

The following comments are found at the beginning of the script:
Google Earth Interface using Wii Remote
by J.Coulston

Instructions:
Start the GlovePIE script, then calibrate your Wiimote (see next section).
After calibrating, make sure Google Earth is the top window.
Tilting up, down, left and right will simulate arrow keys.
Holding B while tilting up and down will tilt the view up and down.
Holding B while tilting left and right will rotate the view.
Pressing + and - will zoom when the Wiimote is level.
Pressing Home will center the view.
Pressing 1 will toggle fullscreen.

After starting the script I calibrated the Wiimote by referring to these instructions left by the author:
//Calibrate your Wiimote!
//Place the Wiimote face up on a flat surface. Change these values until the
//debug line next to the run button shows zero for each axis.
var.xOffset = 10
var.yOffset = -38
var.zOffset = 8

I then ran Google Earth as my top screen to see how user friendly this script actually was.

Tilting up and down worked as expected. But being able to rotate the globe left and right can be a little tricky at first. Tilting was probably not an accurate description of how to accomplish rotating left in right. I had to roll the Wiimote left or right in order to get the desired effects. One other issue I noticed was that there was only one speed setting. Speed was not reflected by how much I tilted and rolled.

Holding the B trigger down while tilting and rolling worked, but the same complaints listed above reflect on this function as well.

The - and + buttons did not perform the described function even after calibrating the Wiimote. These buttons seemed to just tilt the view of the camera up and down. I was not able to easily zoom in and out like I would with a mouse.

The Home button did center the view as expected, and pushing 1 did put the application in and out of full-screen mode.

A look at the code:
Some functions can be easily modified by simply making easy changes in the script.

The most noticeable problem users will probably face is issues with zooming in and out. The code responsible for this function looks like this:
if Wiimote.minus then
Ctrl+Down = not(abs(var.zRot)>10)
else
Ctrl = false
endif

if Wiimote.plus then
Ctrl+Up = not(abs(var.zRot)>10)
else
Ctrl = false
endif

Since the Wiimote is obviously replacing only keyboard commands, I decided to evaluate what Ctrl+Down and Ctrl+Up do when applied to Google Earth. As expected, these commands pan the camera up in down rather than zoom.

A recent post describes what is necessary to apply the keyboard buttons as an output source, so by using this knowledge, I can alter the code to get the desired results when using the Wiimote.
if Wiimote.minus then
key.Minus = not(abs(var.zRot)>10)
else
key.Minus = false
endif

if Wiimote.plus then
key.Equals = not(abs(var.zRot)>10)
else
key.Equals = false
endif
Unfortunately, I have yet to figure out a way to vary the speed of rotation/zooming using the Wiimote (similar to how a mouse would display such an effect). It is possible to mimic the mouse buttons and movement, however, I have not been able to calculate an algorithm in which the Wiimote can create an analog form of speed.

No comments:

Post a Comment