Last active
January 3, 2016 09:49
-
-
Save Krewn/8445335 to your computer and use it in GitHub Desktop.
How to get started with the leap motion controller and Unity3D with c#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using Leap; | |
public class GetFrame : MonoBehaviour { | |
private LeapManager manager; //This provides access to leap data | |
public Leap.Frame frame; //this is a home for leap frame | |
private Leap.Controller controller; //This interprites the data stream | |
private Leap.Listener listener; //This is the data stream | |
// Use this for initialization | |
void Start () { | |
manager = Camera.main.GetComponent<LeapManager>(); //This links to some leap data | |
listener = new Leap.Listener (); //initializes the listener | |
controller = new Leap.Controller (); //Initializes the controler | |
controller.AddListener (listener); //Pipes the listener stream into the controler | |
} | |
// Update is called once per frame | |
void Update () { | |
if(controller.IsConnected)//controller is a Controller object | |
{ | |
frame = controller.Frame(); //Puts the controler information into the frame for export to other scripts | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enjoy