Using the Leap Motion Unreal Plugin

The Leap Motion Controller plugin exposes one primary Actor class, LeapMotionControllerActor, which you can add directly to a scene, and a component, LeapMotionControllerComponent, which you can add to other Actors. When you add an Leap Motion Controller Actor or an actor containing the component to a level, and plugin creates game hands and fingers and moves them to match the real hands tracked by the Leap Motion system. You can also use Leap Motion events and tracking data directly in Blueprints. The position of the game hands relative to the Leap Motion Controller Actor matches the position of the real hands above the Leap Motion hardware.

Adding Leap Hands to a scene

Once you’ve enabled the plugin, you can add hands to a scene by dragging the LeapMotionControllerActor to the desired location:

  1. Open the scene.

  2. In the Modes Panel search box, type “Leap”.

  3. Locate the LeapMotionControllerActor class.

    https://di4564baj7skl.cloudfront.net/documentation/v2/images/unreal/ModePanel.png

    Note: Do not add LeapMotionBoneActor or LeapMotionHandActor objects to a scene. They are created automatically by the LeapMotionControllerActor object.

  4. Drag it from the Class Viewer window into the scene and drop it at the desired location.

  5. Fine tune the position and orientation of the Actor with the Unreal object manipulation tools.

    https://di4564baj7skl.cloudfront.net/documentation/v2/images/unreal/PlaceControllerActor.png

The Leap Motion Controller Actor object is added to the scene and appears in the Scene Outliner. You can set the desired properties of the Leap Motion Controller Actor in the Details Panel.

The model hands appear above the position of the Leap Motion Controller Actor in desktop mode. If you set Is in Hmd Mode, then the hands appear in front of the Leap Motion Controller Actor location.

https://di4564baj7skl.cloudfront.net/documentation/v2/images/unreal/HandInWorld.jpg

Note: to add hands that can navigate the scene to a level, you can add the Leap Motion Controller component to a character controller and set the character’s movement controls appropriately.

LeapMotionControllerComponent Properties

You can set the properties of a controller actor instance in the Details panel or in a Blueprint.

  • Scale – Sets the scaling of the hands and their range of motion in the scene. A value of 1 is life size. Do not use the transform scale.
  • Scale for HMD Mode – Sets the scale to use when in HMD mode.
  • Show Collider – Displays the collider objects for the arm and hands.
  • Show Mesh – displays the geometry mesh for the arm and hands.
  • Show Arm – Shows the arm. Deselect to show only the hand and fingers.
  • HMD Mode – Puts the Leap Motion device into HMD mode. Only use when the device is mounted on an HMD. Sets HMD mode and transforms the hand objects so that they are projected in front of the actor object rather than above it.
  • Auto Attach to Player Camera – attaches the controller to the player camera so that the hands move with it.
  • Offset from HMD to Leap Device – Specify linear offset of the Leap Motion hardware from the center of the line between the user’s eyes.
  • Hand Blueprint – Allows you to override the Hand Actor behavior. If not set, the default implmentation is used.
  • Bone Blueprint – Allows you to override the bone behavior (changes apply to the palm “bone” too). If not set, the default implementation is used.
  • Finger Mesh – The mesh used for finger segments. The mesh should be centered at its origin and its long axis should be aligned with the z axis. The mesh is stretched to fit the dimensions of the finger segment. Used by the default LeapMotionBoneActor class.
  • Palm Mesh – The mesh used for the body of the hand. The mesh should be centered at its origin. The forward direction (wrist to finger) should be aligned with the z-axis, while the lateral direction should be aligned with the y-axis. The mesh is stretched to fit the dimensions of the hand. Used by the default LeapMotionBoneActor class.
  • Arm Mesh – The mesh used for the arm. The mesh should be set up like the finger mesh. Used by the default LeapMotionBoneActor class.
  • Material – The material used for all the parts of the hand. Used by the default LeapMotionBoneActor class.

LeapMotionImageComponent Properties

The image component properties can be set to display video passthough from the Leap Motion stereo cameras for Augmented Reality (AR) style applications:

  • Is Visible – Whether the image is displayed.
  • Is Paused – Whether images are updated.
  • Display Surface Distance – The distance between the camera and the surface used to display the images. The surface is automatically scaled.
  • Display Surface Component – The type of mesh to use as the image display surface.
  • Passthrough Material – The material definition.
  • Dynamic Passthrough Material – A dynamic material instance whose texture can be updated at runtime. (Created at runtime.)
  • Image Passthrough Left – The left image from the Leap Motion camera. (Created at runtime.)
  • Image Passthrough Right – The right image from the Leap Motion camera. (Created at runtime.)
  • Distortion Texture Left – The left distortion texture from the Leap Motion camera. (Created at runtime.)
  • Distortion Texture Right – The right distortion texture from the Leap Motion camera. (Created at runtime.)