Problem with adding LeapMotion to project

Hello!

I’m currently working on a project where the primary controls will be the LeapMotion device. The sdk comes with libraries and I’ve successfully added those and the include path for it to a UE4 project (It’ll compile).

Even if i can run it, i don’t get any data from it and it seems like something isn’t correct.

Does anyone have any idea what the problem can be and how to solve it?

You did not specify the platform you are building on.

Maybe there are some inherent permission issues (accessing hardware directly, etc) from the OS preventing the data from being acquired/passed to UE4?

twiddle, did you have to do anything special to get it to work?

No solution for you immediately here, but I have successfully polled the device in a PlayerController and used that to drive the look direction based on changes in hand position, for example, so I can confirm that the device will function with the engine. I am running win7 x64.

I set the leap motion libraries up as a module called LeapMotion in ThirdParty, modified the Oculus build.cs file to suit, and then added

PrivateDependencyModuleNames.Add("LeapMotion"); 

to the Build.cs for a game module.
Then all I did was #include “Leap.h” and start calling functions.

First things first I’d use the VS debugger to verify you are actually loading the leap dll.

Thanks a lot for the answer, managed to get it to work for myself as well. Though I’m currently having some problems with having the game crashing after launching it from the editor. I think it lies with the placement of dll’s. Where did you place the Leap dll?

I manually copied it into the appropriate folder inside Binaries. Im sure theres another way to have it load, and that is a completely dirty hack, but it worked well enough.

Hey twiddle, when you say you “manually” copied the DLL, do you mean literally by hand after building the project, or as a step in the build? And did you have to use the Leap.lib file anywhere? I’m getting errors during the linking phase of my build, so I’d love if you could provide a little insight. :slight_smile:
(Did you use a setup something like this? A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums)

I duplicated the Oculus module in ThirdParty, renamed it to LeapMotionLib and altered its build.cs file to specify linking to Leap.lib, and placed the leap libraries in a subfolder there. I then copied the Leap.dll to the binaries folder. I was then able to create a plugin module that depended on the LeapMotionLib module.
Grab hold of https://github.com/EpicGames/UnrealEngine/pull/112 if you like - its my plugin. Note you’ll need to replace the leap libraries with whatever the version of the SDK you have installed for it to work. You add a LeapInputComponent to any blueprint and can then implement handlers for the various gesture types and each new frame.

Thanks, I’ll take a look!

This may be late reply, but you can now use an event-driven Leap Motion plugin which should make adding leap motion support to any project a breeze.