Attach one of these to one of the objects in your scene to use Leap input. It will take care of calling update on LeapInput and create hand objects to represent the hand data in the scene using LeapUnityHandController. It has a number of public fields so you can easily set the values from the Unity inspector. Hands will
Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    // Initialization
    void Start()
    {
        //Add an event of PointableUpdated.
        LeapInput.PointableUpdated += new LeapInput.PointableUpdatedHandler(OnPointableUpdated);

        targetScript = GameObject.Find("LeapController").GetComponent <LeapUnityBridge>();

        if (m_Use_mouse)
        {
            UseMouseFinger();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Acquires a reference to leap unity bridge component and sets initial  _handParentObject offset
    /// </summary>
    void InitializeLeapUnityBridge()
    {
        if (LeapUnityBridge == null)
        {
            LeapUnityBridge = (LeapUnityBridge)GameObject.FindObjectOfType(typeof(LeapUnityBridge));
        }

        if (LeapUnityBridge == null)
        {
            Debug.LogError("There is no LeapUnityBridge component in the scene!");
            return;
        }

        if (LeapUnityBridge.m_InputParent != null)
        {
            _handParentObjectInitialOffset = LeapUnityBridge.m_InputParent.transform.position;
        }
        else
        {
            _handParentObjectInitialOffset = Vector3.zero;
        }
    }