Home Forums Software Development Get Eye XYZ Position – cannot find the functions for TX_INTERACTIONBEHAVIORTYPE_ Reply To: Get Eye XYZ Position – cannot find the functions for TX_INTERACTIONBEHAVIORTYPE_

#1342
Anders
Participant

Hi Manuel,
it’s certainly possible to get gaze position and eye position simultaneously.

You can use one interactor or two, that doesn’t matter. But you should only set up one context and one event handler function.

Here’s how I did it. I started from the MinimalGazeDataStream.c sample and modified the InitializeGlobalInteractorSnapshot function like so:


BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
...
	TX_HANDLE hBehavior = TX_EMPTY_HANDLE;

...
	success &= txCreateInteractorBehavior(hInteractor, &hBehavior, TX_INTERACTIONBEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK;

	txReleaseObject(&hBehavior);
	txReleaseObject(&hInteractor);

	return success;
}

Note that hBehavior has to be initialized to TX_EMPTY_HANDLE or else the call will fail.

And then, in the HandleEvent function I added a clause like so:


	if (txGetEventBehavior(hEvent, &hBehavior, TX_INTERACTIONBEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK) {
		printf("gotcha!\n");
		txReleaseObject(&hBehavior);
	}