Welcome to the GM Motion v2.3!

GM Motion is an extension for GameMaker that lets you use the Leap Motion as an input and use your hands to control your game. This site covers the basics of how to use the extension and all the functions it includes.

Let’s get started!

Getting Started

So you want to start developing with the Leap Motion? Awesome!
First we need to setup a few things, you will need:

Leap Motion

Obviously one of the critical points for using this extension, is the Leap Motion device itself. There are several ways to get your hands on one:


This extension will work for Game Maker 8, 8.1 and Studio, however, in the guide I will assume you are using Studio and won’t be covering any pre-studio specifics.
For the most part everything should be the same.
Don’t forget you can pick up the standard version of Studio for free.

Leap Motion Drivers

You will need version 2.0 drivers or later to use this extension. If you try to run it with earlier drivers, you’ll likely be greeted with many errors.
You can get the latest public drivers at:
If you want to access to the SDK and beta versions then sign up as a developer (it’s free) at:

Let’s Go!

So you’ve got your Leap Motion, latest drivers installed, and GameMaker ready to go… but there’s one key piece we still need!
GM Motion!
If you downloaded the complete package then you’ll have everything you need, otherwise head over to and hit download up the top.


Extract the zip and you’ll be greeted with the following files:

Installing GMMotion.lib

If you’re going to use GM Motion purely with GML then you can skip this part, otherwise read on.
To add the "GM Motion" tab (action library) to the object properties window you need to copy the GMMotion.lib into GameMaker’s “lib” folder.

Here are the standard places you will find the folder (it may be different on your computer)

Once you have copied GMMotion.lib to the “lib” folder, open up GameMaker with a new project (if you already had GameMaker open you’ll need to close it and reopen it)

As a quick test, create a new object and check on the right that you have a tab called “GM Motion”, and when selected it looks like the image below:

Adding the GMMotion extension to your project

If you’re using Studio you simply need to import the GMMotion.gmez extension:

If you’re using 8 or 8.1, you need to import the script file GMMotion.gml and place the GMMotion.dll and Leap.dll in the same directory as your source file.


That’s it! You’re officially ready to use your Leap with GameMaker!

List of Functions

Here are a list of all the functions in GM Motion, there are a few things to know about the data GM Motion returns and also what it expects to receive (arguments):


 Use / Description


Connect to the Leap Motion device (runs leap_dll_init)


Returns the number of hands visible


Returns the x position of the specified hand


Returns the y position of the specified hand


Returns the z position of the specified hand


Returns the x velocity of the specified hand


Returns the y velocity of the specified hand


Returns the z velocity of the specified hand


Returns the roll angle of the specified hand


Returns the pitch angle of the specified hand


Returns the direction/yaw angle of the specified hand

leap_hand_no(hand side)

Returns the hand number for the specified side, use this to keep track of which is the left and right hand


Returns true if the hand is left, false if right


Returns the grab strength of the specified hand


Returns the pinch strength of the specified hand


Returns the number of fingers visible

leap_finger_x(hand, finger)

Returns the x position of the tip of the specified finger

leap_finger_y(hand, finger)

Returns the y position of the tip of the specified finger

leap_finger_z(hand, finger)

Returns the z position of the tip of the specified finger


Returns the name of the specified finger

leap_bone_x(hand, finger, bone)

Returns the x position of the specified bone

leap_bone_y(hand, finger, bone)

Returns the y position of the specified bone

leap_bone_z(hand, finger, bone)

Returns the z position of the specified bone

leap_bone_roll(hand, finger, bone)

Returns the roll angle of the specified bone

leap_bone_pitch(hand, finger, bone)

Returns the pitch angle of the specified bone

leap_bone_direction(hand, finger, bone)

Returns the direction/yaw angle of the specified bone


Updates the status of gestures


Returns direction of a swipe in degrees


Returns speed of a swipe


Returns direction of a circle, 1 or -1 (clockwise or anti-clockwise)


Returns the progress of a circle, e.g. 2.5 = 2 and a half circles completed


Returns the radius of a circle

The following are for GMMotion.dll, use leap_dll_free() when you’re finished using the leap


Sets up access to GMMotion.dll’s functions, this is run by leap_init(), there is no need to run it manually


Free GMMotion.dll from memory

FAQ / Troubleshooting

Q. My object isn’t moving/I’m not getting any data/why isn’t it working?!


Have you plugged in your Leap? Check that the Leap Motion Control Panel Icon (bottom right in taskbar) is green. Got that too? Then right click the Leap Motion Control Panel and select “Visualizer”, this will show a 3D display of the hands the Leap can see. If you’re not getting anything in the Visualizer, then head over to the Leap Motion support page
If the Visualizer is working, and you’re absolutely sure you’ve got everything right in your project - Contact Me!

Q. Function someleapfunction not found!


You tried looking at the GML file in the extension didn’t you? DON’T, GameMaker will modify them when you open them and mess up access to the functions. You’ll need to delete the extension from your project and import it again. Also, the scripts are in a separate GML file GMMotion.gml for you to look at / use / modify.

Useful Links & Contact

Here’s a few sites I recommend for learning/getting help with GameMaker:

Sites: - GameMaker Community forum - Old GameMaker Community forum (GMC) *ARCHIVED* but still great place for finding tutorials and answers. - GameMaker subreddit, quite active and plenty of helpful users. - GameMaker’s official documentation, also available by pressing F1 when in GameMaker.

Contact Me

If you’ve got a question or need help with GM Motion, tweet or pm me:
Or email me at:


Copyright © James Begg 2017