TrackIR 5 Unity C# SDK

Post Reply
deepakakkil
Posts: 1
Joined: Mon Jan 25, 2021 8:54 am

TrackIR 5 Unity C# SDK

Post by deepakakkil »

I am trying to use Track 5 Head tracking in my unity project. According to the info here https://www.naturalpoint.com/trackir/developers/, there is an TrackIR Enhanced SDK available for free that i can use to interface with the TrackIR .

I am starting from the Unity sample while using the developer ID as 1000 (Which is what the SDK documentation suggests for personal project), however, with the off the shelf software, i get an exception @ NP_RegisterProgramProfileID returned ERR_UNKNOWN_ID. Not sure why?

In the SDK documentation , it also says "A special version of the TrackIR software will be provided for you, if you did not receive a copy, please contact us.". Do i need a special TrackIR software? Or is this error related to something else? Any insights are appreciated on how to get TrackIR data in Unity.
raggnic
Posts: 2
Joined: Wed Apr 27, 2022 8:24 am

Re: TrackIR 5 Unity C# SDK

Post by raggnic »

Hi
Were you able to get through this? I'm stuck at the same point.
TrackIR 5.4.2 software is installed and device is working in the test software, but I'm always getting
TrackIRException: NP_RegisterProgramProfileID returned ERR_UNKNOWN_ID.

Unity is 2020.3.32
Target is PC standalone, runtime is .Net 4.x
raggnic
Posts: 2
Joined: Wed Apr 27, 2022 8:24 am

Re: TrackIR 5 Unity C# SDK

Post by raggnic »

Strythio
Posts: 1
Joined: Sun Mar 31, 2024 8:41 am

Re: TrackIR 5 Unity C# SDK

Post by Strythio »

For anybody else that runs into this, change the developer ID to 1001.

I had the same issue, but I noticed that the ID was only an unsigned short, so I just brute forced it with this code:

Code: Select all

unsigned short ID = 0;
do {
	result = NP_RegisterProgramProfileID(ID);
	if (result == NP_OK)
		std::cout << "Registered Developer ID " << ID << std::endl;
	else
	{
		std::cout << "NPClient : Error Registering Developer ID " << ID << std::endl;
		//readNPData = false;
		//return;
	}
	ID++;
} while (result != NP_OK);
which outputs:

...
NPClient : Error Registering Developer ID 988
NPClient : Error Registering Developer ID 989
NPClient : Error Registering Developer ID 990
NPClient : Error Registering Developer ID 991
NPClient : Error Registering Developer ID 992
NPClient : Error Registering Developer ID 993
NPClient : Error Registering Developer ID 994
NPClient : Error Registering Developer ID 995
NPClient : Error Registering Developer ID 996
NPClient : Error Registering Developer ID 997
NPClient : Error Registering Developer ID 998
NPClient : Error Registering Developer ID 999
NPClient : Error Registering Developer ID 1000
Registered Developer ID 1001
Data transmission started
Pitch = 0.58, Yaw = 109.09, Roll = 0.00, X = 0.02, Y = -0.61, Z = -0.26, Frame = 1679

So, in the file TrackIR_CPPConsoleClient\src\TrackIR_ClientCPP.cpp at line 28, change NP_DEVELOPER_ID from 1000 to 1001
Post Reply