Home Forums Unity SDK 01_GazePointData Reply To: 01_GazePointData

#18706
Alberto Melchor
Participant

thank you, I wanted to ask a question about GazeScene01, I wanted to ask about ray casting, aside from the moveable point I also wanted to include a ray casting. I tried to modify the script at ProjectPlaneToWorld but I wanted to ask how I would use the Debug.DrawLine method, the debug.Drawline method was taken from a tutorial but this time I wanted to see how the eyegaze would be implemented. The code below did not display the Raycast Line.

public float maxRayDistance = 25;
private Vector3 ProjectToPlaneInWorld(GazePoint gazePoint)
{
Vector3 gazeOnScreen = gazePoint.Screen;
gazeOnScreen += (transform.forward * VisualizationDistance);
Ray ray = Camera.main.ScreenPointToRay(gazeOnScreen);
RaycastHit hit;
Debug.DrawLine(transform.position, transform.position + gazeOnScreen * maxRayDistance, Color.red);
return Camera.main.ScreenToWorldPoint(gazeOnScreen);
}