[Plugin] Leap Motion - Event Driven

That may be the intent for kdumovic, but I was originally trying to use the method in this video:

v=uOy0B3Tb7dk&list=PLZlv_N0_O1gaCL2XjKluO7N2Pmmw9pvhE&index=79

I don’t think this works with the basic rigged character, as the hand is instanced in the C++ code. I believe that you are correct that attribute from the leap page may be the correct way to get this interaction to work, but I am clueless on how to do it. I wanted it to work like the unreal video where you could punch a physics actor sphere.

I tried the method above also to no avail. I just keep getting a value of 0.0. Maybe the return value is supposed to be something other than a float? I’ve successfully gotten sphere radius from the Leap on a web app with the leap.js api and it doesn’t matter how you use it, if your hand is above it it should return a value other than 0 unless your hand is closed…

Update to 0.9.3
-Added LeapCollisionCharacter which adds physics collision enabled by
default. This can be enabled for other setups by using the PhysicsActor
collision preset.
-Updated PhysicsAsset used for collision
-Removed old content
-Fixed SphereRadius property link found on LeapHand

This update should make it much easier for you all to add collision based interaction. You simply select the new convenience character called LeapCollisionCharacter and hit play. Your entire body is covered by a fairly accurate PhysicsAsset which you can modify to suit your needs.


To change other sub-classes to support this interaction, simply change your skeletal mesh preset from character mesh to physics actor.


Hit play and you will be able to push around any movable actors with physics enabled like so


Here’s an example of me playing jenga with no code changes, but simply adding rectangular shapes to push around.

v=bz-_Mixlyxs

What do you think? Useful? Let me know!

Regarding the first issue it may be related to using a C++ character as a baseclass? If that is the case, the problem may be related to [Plugin] Leap Motion - Event Driven - C++ - Epic Developer Community Forums to which the solution was to sub-class your C++ base character as a blueprint and then sub-class that blueprint to use your hydra component/interface. Still unsure why this error occurs, but it only occurs when the base class is derived from C++ not blueprint.

On the second issue, that shoulder position should only occur when you have your hand full stretched out. Just tried the plugin on 4.7.6 and it seemed to behave as expected. Try to get me a video of the specific problem so I can try to replicate the issue.

Some templates now have characters placed directly in the map. They need to be deleted in order for your custom game mode character to be used.

This was my error, you found a value I missed linking up, this has now been fixed in 0.9.3. Unsure of how you want to use this sphere however as it changes with the curvature of your hand and it is probably not what you’re looking for in terms of collision. Try out the new 0.9.3 update for easy collision.

Leap Event Interface used to be found under blueprint props, since 4.7 this is now called Class Settings.


You similarly go to Interfaces and click add->LeapEventInterface. After you hit compile, all the leap events will show up after you right click the event graph and type ‘leap’. If you’re using the convenience content the leap controller bind is placed in the LeapAnimBodyConnector. You can add leap motion events to another blueprint safely but you will also have to add the component in addition to adding the interface in order to receive the events.

This method does work, but with a twist. All you do is attach the collision shapes to the skeletal mesh sockets. You do this by adding them as a child of the mesh and the selecting parent socket in the details pane.

That said using the physics asset now provided in the plugin is much easier and you can still modify the physics asset to cover the range and sizes you need for your particular mesh.

Ehi ! Thank you for the update, trying it out now.
As concern this issue: it’s still there with the new plugin, and I’m using a blueprint only project, so this shouldn’t be the cause.
As soon as I restart the editor, the game blueprint reverts to exploration character.
By the way, I’m on OSX. Is it expected that the binary folder only contains the win dlls and not mac shared libs?

Ok, I’ll try to get a video and I’ll be back

Yeah for mac the dylibs (.dll equivalents) are embedded inside the plugin (look for binaries inside the plugin folder). I’ll have a look on a mac project to see if I can’t replicate what you’re seeing.

is the leap bone type enum handled differently? because i can’t replicate this https://developer.leapmotion.com/documentation/unreal/unreal/Leap_Unreal_BP_CustomControllerDemo.html

and i cant find Functions like “Get Bone Position and Orientation”

You’re thinking about the official leap plugin found here. For documentation on the unofficial plugin (this one) look at the repo readme

Ok, big ol’ n00b question; I installed the update (0.9.3), and can simulate the leap motion movement on the brand new collision rigged character, but when I start VR preview, it spawns a whole new char, rigged the same way.

Also, for some reason, tracking is way off, and articulation is terrible (jumpy, can’t recognize everything). I’ve got the Leap Motion attached to the front of the Oculus, and ithe character just keeps skipping and crumpling in on itself. I’m under something of a deadline, so any help (in addition to your sweet sweet update) would be amazing. Thanks so much.

VR preview should work right, maybe try to exit out of simulate before hitting play on VR preview. If that isn’t the issue, remember that you need to plug in the leap NOT into the oculus usb port, but rather its own, since it is a bandwidth hog and will not be happy with shared bandwidth. The other thing to remember is that you need a pretty powerful computer to hit 75fps on the oculus. If you hit both of those and you see your left hand, your elbow->wrist should be 1:1 and very smooth. The hands may differ slightly due to rigged mesh geometry.

Feel free to rescale bones if you want that fully 1:1 experience.

Hi , did you manage to reproduce this issue on a mac?

I’m using the LeapRiggedCharacter but want to put the Leap stationary in front of me. I know OptimizeForHMD should be used for this. Can someone help me with:

  1. Which settings to use for OptimizeForHMD when using the Leap placed on a table.
  2. Where in the LeapRiggedCharacter is OptimizeForHMD called, so I know where to change the settings.

Thanks in advance!

I just wanted to jump in and say that this looks fantastic. Great job, !

As little help for those who have had a few issues getting the leap motion to work with UE4.7 here’s a few tips that I found helpful. Firstly once you have copied the files into the root directory, when you load UE4 check the 0.9… version of the leap rather than v1.0.

Then once inside UE4, delete the character start model so that you can see you hands inside the environment.

38e6ed0447e8cd345751051eff7597bae8c50772.jpeg to

Once these extra steps are taken, the leap motion should work inside you environment.

I’m super new to this, though I kind of wish I weren’t. How can I create a reference to the leap character? For instance, If I want to parent an object to the rigged hands, I’d need to create a reference to the object, yes?

But for some reason, I can’t seem to figure this out.

If you’re using Leap Rigged Character, then it automatically supports both VR mode and regular mode. If you wish to adjust the Leap base offset (where the controller is on your table), modify the position of the DefaultModeSprite in the LeapAnimBodyConnector, imagine that sprite as your virtual leap motion controller.


All leap-specific parts for convenience characters can be found under LeapAnimBodyConnector.

I sadly don’t have the resources to support the mac version more often than once per engine release. This will be inspected when I compile the plugin for 4.8.

Thanks! Glad you like it :slight_smile:

This is very helpful, I will point future questions of the sort to your post.

The convenience assets are not that easy to decode, because they’re meant to separate the input hardware from the actual visual/physics assets. That said if you want to attach something to the hand, simply find the bone or socket you want an item to be attached to and attach it to the mesh. You don’t have to worry about the leap motion at all and simply interact with your character mesh as if it is another UE pawn/character knowing it will track your hands when they’re visible.

If you want something leap specific such as their supported gesture events, you can follow the documentation on adding a leap component to any blueprint you wish to respond to the leap events (see heading How to use it - Blueprint without Convenience Content, Quick Setup). You can mix and match convenience with custom as the plugin supports multi-casting leap components. The repository is your how-to for everything related to this unofficial leap motion plugin

Has anyone tried the Leap Motion UE4 plugin with Android the GearVR? (where the new GearVR has a USB port). It sounds like there is an for Leap Motion: https://community.leapmotion.com/t/i...axy-note4/2753 but is it included already in the UE4 plugin??

Your plugin seems to work great but the leap itself is jittering like crazy. My hand is just jumping around and even simple gestures aren’t recognized reliable. I tried to setup the debug circles, but left and right seems to be switched. Tried to mount the sensor the other way around, but didn’t make any difference.

EDIT: Found the reason, the sensor was not configured in HMD mode:

This fixed it:

RYRXxp2.png

Yep the ‘Use Topdown’ tickbox does all the transformations necessary for the leap to be used in VR and all your reported positions should be 1:1 with the real world.

If the leap is jittering, you may want to ensure you don’t have extra infrared light sources such as sunlight, additionally the leap will perform poorly if you have tables and objects very close to the sensor.

This plugin doesn’t support it out of the box, but you have full source to attempt a bind yourself. Make sure to make a pull request if you get it working!

New Learning resources, full example project!

Check out the latest leap motion blog entry for a run down on a full example of how to use the plugin to make cool things in VR!

The three tutorial videos contain parts on how to implement basic jenga, jenga with pickup/drop cabilitilies, and finally telekinesis powers.

Part 1 - Setup and Collision

What you’ll learn from the first part:

Drag and drop installation


Selecting a leap character and hitting Play to see interactive hands.


Build Jenga stacks and push them around with the Leap Collision Character.


Full instructions available in the video below

v=I39nohn-Fq0

Part 2 - Picking up and dropping objects
Dig into the second part and learn to extend functionality with input mapping in order to pickup and drop blocks

Part 3 - Raytracing and Telekinesis
Learn how to do raytracing in UE4


Enable your telekinetic powers to pickup blocks from the ground and place them back on top of the stack!

Resources
When you’ve finished you can compare your results to the final project zip, or use it as a reference!

If you just want to try the demo, grab the executable instead.

If you want to see an example of leap-only locomotion try the mage arena game.

Let me know if you’ve found any of this helpful :slight_smile:

Thanks so much for this .