// Use this for initialization void Start() { trackIRclient = new TrackIRUnity.TrackIRClient(); // Create an instance of the TrackerIR Client to get data from status = ""; data = ""; StartCamera (); }
public string TrackIR_Enhanced_Init() { this.NPFrameSignature = 0UL; this.NPStaleFrames = 0UL; string dllPath = ""; string str1 = ""; this.GetDLLLocation(ref dllPath); int num1 = (int)this.NPClient_Init(dllPath); string str2; if (this.NPClient_Init(dllPath) == TrackIRClient.NPRESULT.NP_OK) { string str3 = str1 + "NPClient interface -- initialize OK\r\n"; int foregroundWindow = TrackIRClient.GetForegroundWindow(); string str4 = str3 + "ForegroundWindow handle: " + foregroundWindow.ToString() + "\r\n"; if (this.NP_RegisterWindowHandle(foregroundWindow) == TrackIRClient.NPRESULT.NP_OK) { string str5 = str4 + "NPClient : Window handle registration successful.\r\n"; ushort pwVersion = (ushort)0; if (this.NP_QueryVersion(ref pwVersion) == TrackIRClient.NPRESULT.NP_OK) { string str6 = string.Format("NaturalPoint software version is " + string.Format("{0:d}", (object)((int)pwVersion >> 8)) + "." + ((object)string.Format("{0:d}", (object)((int)pwVersion & (int)byte.MaxValue))).ToString() + "\r\n"); string str7 = str5 + str6; int num2 = (int)this.NP_RequestData((ushort)((uint)(0 | 2) | 4U | 1U | 16U | 32U | 64U)); int num3 = (int)this.NP_RegisterProgramProfileID((ushort)20430); if (this.NP_StopCursor() == TrackIRClient.NPRESULT.NP_OK) { string str8 = str7 + "Cursor stopped\r\n"; if (this.NP_StartDataTransmission() == TrackIRClient.NPRESULT.NP_OK) { return(str8 + "Data Transmission started\r\n"); } str2 = str8 + "NPCLient : Error starting data transmission\r\n"; return((string)null); } else { str2 = str7 + "NPClient : Error stopping cursor\r\n"; return((string)null); } } else { str2 = str5 + "NPClient : Error querying NaturalPoint software version!!\r\n"; return((string)null); } } else { str2 = str4 + "NPClient : Error registering window handle!!\r\n"; return((string)null); } } else { str2 = str1 + "Error initializing NPClient interface!!\r\n"; return((string)null); } }
private void Awake() { // Create an instance of the TrackerIR Client to get data from trackIRclient = new TrackIRClient(); status = ""; data = ""; }
public TrackIRTracker() { Debug.Log("KerbTrack: Initialising TrackIR..."); trackIRclient = new TrackIRUnity.TrackIRClient(); string status = trackIRclient.TrackIR_Enhanced_Init(); Debug.Log("KerbTrack: TrackIR status: " + status); }
public void Dispose() { if (trackIRclient != null && started) { // Stop tracking string status = trackIRclient.TrackIR_Shutdown(); trackIRclient = null; started = false; } }
public TrackIRClient.NPRESULT NPClient_Init(string dllPath) { //LET THE SORCERY COMMENCE if (IntPtr.Size == 4) //32 bit { dllPath = dllPath + "NPClient.dll"; } else if (IntPtr.Size == 8) //64 bit { dllPath = dllPath + "NPClient64.dll"; } if (!File.Exists(dllPath)) { return(TrackIRClient.NPRESULT.NP_ERR_DLL_NOT_FOUND); } int hModule = TrackIRClient.LoadLibrary(dllPath); if (hModule == 0) { return(TrackIRClient.NPRESULT.NP_ERR_DLL_NOT_FOUND); } this.NP_GetSignatureDelegate = (TrackIRClient.dNP_GetSignatureDelegate)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_GetSignature"), typeof(TrackIRClient.dNP_GetSignatureDelegate)); TrackIRClient.LPTRACKIRSIGNATUREDATA signature = new TrackIRClient.LPTRACKIRSIGNATUREDATA(); TrackIRClient.LPTRACKIRSIGNATUREDATA lptrackirsignaturedata = new TrackIRClient.LPTRACKIRSIGNATUREDATA(); lptrackirsignaturedata.DllSignature = "precise head tracking\n put your head into the game\n now go look around\n\n Copyright EyeControl Technologies"; lptrackirsignaturedata.AppSignature = "hardware camera\n software processing data\n track user movement\n\n Copyright EyeControl Technologies"; TrackIRClient.NPRESULT npresult; if (this.NP_GetSignatureDelegate(ref signature) == TrackIRClient.NPRESULT.NP_OK) { if (string.Compare(lptrackirsignaturedata.DllSignature, signature.DllSignature) == 0 && string.Compare(lptrackirsignaturedata.AppSignature, signature.AppSignature) == 0) { npresult = TrackIRClient.NPRESULT.NP_OK; this.NP_RegisterWindowHandle = (TrackIRClient.dNP_RegisterWindowHandle)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_RegisterWindowHandle"), typeof(TrackIRClient.dNP_RegisterWindowHandle)); this.NP_UnregisterWindowHandle = (TrackIRClient.dNP_UnregisterWindowHandle)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_UnregisterWindowHandle"), typeof(TrackIRClient.dNP_UnregisterWindowHandle)); this.NP_RegisterProgramProfileID = (TrackIRClient.dNP_RegisterProgramProfileID)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_RegisterProgramProfileID"), typeof(TrackIRClient.dNP_RegisterProgramProfileID)); this.NP_QueryVersion = (TrackIRClient.dNP_QueryVersion)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_QueryVersion"), typeof(TrackIRClient.dNP_QueryVersion)); this.NP_RequestData = (TrackIRClient.dNP_RequestData)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_RequestData"), typeof(TrackIRClient.dNP_RequestData)); this.NP_GetData = (TrackIRClient.dNP_GetData)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_GetData"), typeof(TrackIRClient.dNP_GetData)); this.NP_StartCursor = (TrackIRClient.dNP_StartCursor)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_StartCursor"), typeof(TrackIRClient.dNP_StartCursor)); this.NP_StopCursor = (TrackIRClient.dNP_StopCursor)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_StopCursor"), typeof(TrackIRClient.dNP_StopCursor)); this.NP_ReCenter = (TrackIRClient.dNP_ReCenter)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_ReCenter"), typeof(TrackIRClient.dNP_ReCenter)); this.NP_StartDataTransmission = (TrackIRClient.dNP_StartDataTransmission)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_StartDataTransmission"), typeof(TrackIRClient.dNP_StartDataTransmission)); this.NP_StopDataTransmission = (TrackIRClient.dNP_StopDataTransmission)Marshal.GetDelegateForFunctionPointer(TrackIRClient.GetProcAddress(hModule, "NP_StopDataTransmission"), typeof(TrackIRClient.dNP_StopDataTransmission)); } else { npresult = TrackIRClient.NPRESULT.NP_ERR_DLL_NOT_FOUND; } } else { npresult = TrackIRClient.NPRESULT.NP_ERR_DLL_NOT_FOUND; } return(npresult); }
private void Awake() { // Create a static instance of the TrackerIR Client to get data from if (trackIRclient == null) { trackIRclient = new TrackIRClient(); } status = ""; data = ""; }
public TrackIRPrecisionPointer(PrecisionPointerMode mode, int sensitivity) { this.mode = mode; trackIRclient = new TrackIRUnity.TrackIRClient(); // Create an instance of the TrackerIR Client to get data from. this.sensitivity = sensitivity; if (trackIRclient != null) { string status = trackIRclient.TrackIR_Enhanced_Init(); if (status != null) { started = true; aTimer = new System.Timers.Timer(33); aTimer.Elapsed += Update; aTimer.AutoReset = false; aTimer.Enabled = true; } } }
// Use this for initialization void Start() { trackIRclient = new TrackIRUnity.TrackIRClient(); StartCamera(); }
// Use this for initialization void Start() { trackIRclient = new TrackIRUnity.TrackIRClient(); // Create an instance of the TrackerIR Client to get data from status = ""; data = ""; }
void Start() { trackIRclient = new TrackIRUnity.TrackIRClient(); // Detecting and creating an TrackIR to get data from status = ""; data = ""; Screen.lockCursor = true; target = GameObject.FindGameObjectWithTag("SpaceShip").transform; }