Leap Motion: Try the Diagnostic Visualizer

Leap Motion: Try the Diagnostic Visualizer

With the integrated Diagnostic Visualizer it is easy to test all the features that the leap motion platform is offering. This application is included when you install the Leap Motion software. If you want to open this application yourself, then just follow the steps below.

1. Open the settings

Leap Motion options

2. Open the visualizer

In the Settings, go to the “Troubleshooting”-Tab and there is a button called “Diagnostic Visualizer”, which opens the Visualizer:Leap Motion settings-dialog

3. Try out some of the following commands

  • “j” –  for the cool looking visualisation, as shown in the screenshot on the top of this post
  • “y” – for better looking paths
  • “t” – to show the tracked fingers

Leap Motion: Try the Diagnostic Visualizer

Screen Shot 2014-01-18 at 16.57.25

With the integrated Diagnostic Visualizer it is easy to test all the features that the leap motion platform is offering. This application is included when you install the Leap Motion software. If you want to open this application yourself, then just follow the steps below: Screen Shot 2014-01-18 at 16.47.33In the Settings, go to the “Troubleshooting”-Tab and there is a button called “Diagnostic Visualizer”, which opens the Visualizer: Screen Shot 2014-01-18 at 16.49.54Try out some of the following commands:

  • “j” –  for the cool looking visualisation, as shown in the screenshot on the top of this post
  • “y” – for better looking paths
  • “t” – to show the tracked fingers

 

Leap Motion: Visualize vertical hand movement

Leap Motion: Visualize vertical hand movement

I finally had a bit of time to continue my work with the Leap Motion Framework. My goal this time is to visualize the positions and movements of the hands. To achieve this, I had to decide on a framework that I want to use for the application. I ended up with choosing the Swing-Framework, because it’s easy to draw figures on a canvas and I don’t need to care about platform specific things.

I then roughly wrote down some points I wanted to implement.

  • Display the actual distance between the controller and the hand
  • Display the amount of visible fingers of each hand
  • Either display 1  or 2 hands (according on how many are over the controller)
  • Display the vertical value of the y-axis for each hand
  • Handle a disconnected Leap Motion device correctly

Implementation

screenshot of the coordinate the fingers applicationThere are a few ways to get the relevant position data from the hands. For the application I decided to use the following line:

hand.palmPosition()

This returns a vector which has the values of the palm. Another possibility would be to use stabilizedPalmPosition(). The difference between the vectors of those two methods, is shown here:

palmPosition(): (10.4119, 252.632, 262.645)
stabilizedPalmPosition(): (18.7797, 247.261, 262.403)

The official API documentation described the difference to the normal palmPosition() as below:

Smoothing and stabilization is performed in order to make this value more suitable for interaction with 2D content. The stabilized position lags behind the palm position by a variable amount, depending primarily on the speed of movement. – Leap Motion API Documentation

This means, that for applications where the performance of the UI and the speed of the hands is very important, you better use the normal palmPosition(). But when it comes to accuracy of the data the usage of stabilizedPalmPosition() is recommended.

Vector(x, y, z)
x – Corresponds to the left to right dimension of the Leap Motion controller.
y – Corresponds to height above the device.
z – Corresponds to the front-back dimension of the Leap Motion controller.
Coordinate the fingers

The application is quite quick and very accurate with drawing the heights of the hands. It also displays the y-position and the amount of fingers the sensor recognizes. When the Leap Motion controller is connected correctly, then a green light shows up in the bottom right corner.

The next step for me is to work with the other two axes in another application. You can find the code for this application on GitHub. Keep in mind, that if you want to run it, you need to set up a Leap Motion project first. See this post for more information: Set up a Leap Motion project

Link to the GitHub project: https://github.com/mrwonderman/leap-motion-basics

Unity: How to tag a camera

I just continued my work with the Unity-Framework and run into a basic beginner mistake. I wanted to get the transform values of my camera. So I tried the following lines of code:

Camera cam = Camera.main;
GameObject gameobj = (GameObject)Instantiate(baseobject, cam.transform.position + cam.transform.forward, cam.transform.rotation);

But this gave me the following error message:

NullReferenceException
UnityEngine.Component.get_transform ()

So I then figured out that I need to tag my camera as my MainCamera when I want to use Camera.main. To do such a tag you need to open your camera in the Inspector. Right under the name field is a small dropdown-menu called Tag. There you can set your desired tag for your camera:

Screen Shot 2014-01-18 at 16.22.10

Link: http://answers.unity3d.com/questions/63221/how-to-set-main-camera.html