Quantcast
Channel: Leap Motion Blog
Viewing all articles
Browse latest Browse all 481

How to Upgrade to the Orion Core Unity Assets

$
0
0

We’ve just released an updated version of our newly overhauled Unity Core Assets for the Orion Beta. Along with major performance improvements and an improved workflow, you also now have access to the first of many add-on modules. There’s never been a better time to upgrade from the older Unity assets for V2 tracking, so we put together a quick guide to show you how.

These are truly “core” Core Assets, so there are some features missing from the current Orion assets. If your project relies on the following, you might want to wait:

  • The recording/playback functionality of HandController
  • Image Hands
  • Rigged hands (except for the new “Capsule Hands” seen in Blocks)
  • Widgets

NOTE: Simply trying to move the old scripts for these resources into the Orion assets will not work. We are currently working on adding this functionality back into the assets.

Step 1

Delete the current Leap Motion assets from your project. This will probably cause compile errors, script unlinks, and generally break everything.

Step 2

Import the new assets into your project. This is not expected to fix compile errors or script links. But we’re on the right path!

Step 3

Resolve compile errors:

  • Any references to HandController.GetFrame() should now be directed at LeapProvider.CurrentFrame.
  • For any component that references LeapProvider, you will need to add a serialized LeapProvider field to the component, and link it to the LeapProvider component via the Unity gameObject inspector.

Step 4

Verify that demo scenes work. Visit Assets/LeapMotion/Scenes/Leap_Hands_Demo or Leap_Hands_Demo_VR to verify that the Orion Core Unity Assets are functioning correctly.

Step 5

Change coordinate space references in scripts.

Previously, if you wanted to get the position of the palm of a hand, you might have done something like this to convert from the Leap Motion coordinate space to the Unity coordinate space:

handController.transform.TransformPoint(hand.PalmPosition.ToUnityScaled());

With our new system, the Frame object is converted to the Unity coordinate space ahead of time. This saves time and improves performance because the calculations don’t have to be continuously repeated each time you want to access a position, but it also means that the code would need to be updated:

hand.PalmPosition.ToVector3();

Step 6

Re-create your camera rig.

We recommend that you create your camera rig by starting with the LMHeadMountedRig, and adding or changing things about it to create your own camera rig. Here’s a quick tour of the new camera rig and its components.

CenterEyeAnchor:

  • Camera: The main camera object for the camera rig. Target eye should be ‘Both’!
  • LeapImageRetriever: Responsible for uploading the controller’s video passthrough and other relevant image information to the graphics card.
  • LeapVRCameraControl: Responsible for overriding the IPD and camera position in the case that Image/Hand alignment is desired. Also dispatches useful camera events that other scripts are dependent on. If you don’t want Image/Hand alignment, we highly recommend unchecking OverrideEyePosition so that the user’s IPD is normal!

LeapSpace:

  • LeapVRTemporalWarping: Responsible for applying the correct offset to the movement of the camera rig to account for any latencies or differences in movement. This can drastically help the feeling of ‘swaying’ that can otherwise happen when the head moves.

LeapHandController:

  • LeapProvider: Responsible for acquiring frames from the service and making them available to the scene. Also responsible for doing the conversion from the Leap Motion coordinate space to the Unity coordinate space.
  • HandPool: Responsible for organizing Hand objects. Used by the user to specify the hand representations they want in the scene.
  • LeapHandController: Acts as the ‘glue’ between LeapProvider and HandPool. Acquires hand representations from HandPool, and drives them using frame data acquired from LeapProvider.

QuadBackground:

  • This quad is rendering using a special shader that accesses the controller’s image data. The quad is rendered behind all other objects, allowing objects like Leap Motion hands to align with it. It can be disabled or removed if you don’t plan to have an image background in your scene.

Step 7

Test it! If you run into any mysterious errors, please post the error report and troublesome code sample in our community forums.

The post How to Upgrade to the Orion Core Unity Assets appeared first on Leap Motion Blog.


Viewing all articles
Browse latest Browse all 481

Trending Articles