Skip to content

Instantly share code, notes, and snippets.

@Adamcbrz
Created April 22, 2019 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adamcbrz/3b6545ec606585e02d1dda8159076513 to your computer and use it in GitHub Desktop.
Save Adamcbrz/3b6545ec606585e02d1dda8159076513 to your computer and use it in GitHub Desktop.
Tracker Tutorial: Tick
void ATracker::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// Find Tracker if trackerID is -1 else update tracker
if (trackerID == -1)
{
// Loop through tracker ids skipping the first one because that is our null HMD.
for (uint32_t i = 1; i <= 8; i++) {
vr::HmdMatrix34_t posMat = UpdateTracker(i);
// Verify the postion of the tracker isn't vector zero.
if (posMat.m[0][3] != 0 && posMat.m[1][3] != 0 && posMat.m[2][3] != 0)
{
trackerID = i;
break;
}
}
}
else
{
UpdateTracker(trackerID);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment