Saturday, October 07, 2006

Stupid Laptop Tricks

First a disclaimer: DO NOT SHAKE YOUR LAPTOP!!! If you shake or thrash your laptop and kill yor hard drive, do not blame me. Laptops are delicate complex electronic devices and should not be jostled, beaten, dropped, abused, or tossed around.

Okay with that out of the way, a stupid plugin trick. This is only for Mac users with a MacBook, MacBook Pro, or possibly some of the newer G4 laptops (although I haven't tested on these).

First, download "SMSHack.xpl". Unzip it and drag the .xpl file into your plugins folder.

Start X-Plane. In an external view, rotate your laptop about 45 degrees to the left and right and 45 degrees up and back. this calibrates "SMSHack" to know the orientation of your computer. You must do this calibration every time you use SMSHack.

Then: fly using your laptop like a yoke. Roll your laptop to roll the plane, and pitch the laptop to climb and descend. Disable the plugin to get normal joystick control back.



How it works: I use a library called Unimotion. (Hrm..it's LGPL...well, source is here then.) Unimotion reads the SMS (sudden motion sensors) on modern Mac laptops. These are three accelerometers that the Macintosh can use to detect it has been dropped; the operating system will try to park the hard drive heads to prevent a disk failure on impact.

Because gravity is a constant acceleration on the laptop, the accelerometers can be used to detemrine the roll and pitch of the laptop. This plugin simply shovels the relative accelerations into the joystick deflections.

6 comments:

Joshwa said...

Ooo.. can someone post video of this working?

N_Altafini said...

now i know why the WED is late.. :-)

ok just kidding...

seriously, does this new technology can be used for new game/sim devices?

is your intent to test it and put it on xp?

Benjamin Supnik said...

Yes...WED is about 5 minutes later now... :-)

I do not think this technology is terribly useful for a game -- generally you don't want to be swatting your laptop around while flying. It's just a silly hack.

It's not my intent to put this into X-Plane...I just posted it because I thought it might amuse people over the long weekend.

Anonymous said...

Strap it to your head.
Viola!:=()
Total imersion!

Andrew said...

Hi, BENJAMIN!
You've made a great thing, really! But there's a problem with my MacBook Pro (2009)..
When I wont to turn left I have to rotate my Macbook to the right and when I wont to turn right I have to rotate it to the left (same thing with climbing and descending).
Help me please if you can,
How to fix that?

cheap computers said...

I think this is only for Mac users with a MacBook, MacBook Pro, or possibly some of the newer G4 laptops