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 recording/playback functionality of HandController or Image Hands, you may want to wait. If your project relies on particular rigged hands or Widgets, we recommend updating these project elements to the new Hands Module and UI Input Module.
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.
Delete the current Leap Motion assets from your project. This will probably cause compile errors, script unlinks, and generally break everything.
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!
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.
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.
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:
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:
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.
- 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!
- 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.
- 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.
- 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.
Test it! If you run into any mysterious errors, please post the error report and troublesome code sample in our community forums.