How to use leap motion in unity, using your hands to control a different game object?

I am a fairly new user to Unity, as part of my studies. Currently, in the scene I have a stick that I want to move using my hands being tracked by the leap motion device. I found a script online to help me do this, which I basically link to the Hand Controller Prefab that comes with Leap motion integration files for unity and attached this to the stick. The stick does move at the moment but the orientation seems to be off (horizontal and vertical have switched). e.g. if my hand is at a vertical angle the stick is horizontal. Also the movement does not seem to be stead. I couldn’t find any other answers that could give me an idea as to why it isn’t working, as about a month ago the orientation was perfect. When I came back to it, I changed nothing but it wasn’t working. I’m trying to get this all to work so you can see it in the Oculus Rift, which the HMD view is working just fine, the leap motion is being temperamental.

Wondering if anyone has any suggestions to how to fix it or a different way to get my hand movements to be linked to a game object so the stick moves as if it is my hand? Hopefully this makes sense.

The script I’m using is shown below:

using UnityEngine;
using System.Collections;
using Leap;

public class MatchHand : MonoBehaviour
{

//Assume a reference to the scene HandController object
public HandController handCtrl;

void Update()
{
    Frame frame = handCtrl.GetFrame();
    Hand hand = frame.Hands.Frontmost;
    if (hand.IsValid)
    {
        transform.position =
          handCtrl.transform.TransformPoint(hand.PalmPosition.ToUnityScaled());
        transform.rotation =
          handCtrl.transform.rotation * hand.Basis.Rotation(false);
    }
}

}

The steadiness issues are probably because you are using Update() without compensating for the variable frame rates.
https://unity3d.com/learn/tutorials/modules/beginner/scripting/update-and-fixedupdate

I’d try using Time.deltaTime as a multiplier for your position/rotation, which causes changes to vary based on the time between frames, which forces the motion to be evenly spaced.
As an alternative, you can use FixedUpdate(), which updates every .02 seconds, giving a reliably spaced experience. However, this is usually used for Physics not for User Input.

If your stick is vertical when your hand is horizontal, and visa-versa, then your issue probably has to do with which axis your rotation is occurring on. You should be able to either add a multiple of 90 degree to correct the offset, or manually change which axis your HandController object or Hands object is interacting with.