/// <summary> /// Updates an individual MLEye with the latest information from the XR.Eyes. /// </summary> /// <param name="device">The Unity XR input device.</param> /// <param name="deviceEyes">The Unity XR eyes.</param> /// <param name="type">The eye type to update.</param> private void UpdateEye(InputDevice device, UnityEngine.XR.Eyes deviceEyes, MLEye.EyeType type) { // Early exist if any of the request methods fail. // Center Vector3 deviceEyeCenter; if ((type == MLEye.EyeType.Left) ? !deviceEyes.TryGetLeftEyePosition(out deviceEyeCenter) : !deviceEyes.TryGetRightEyePosition(out deviceEyeCenter)) { return; } // Gaze Quaternion deviceEyeGaze; if ((type == MLEye.EyeType.Left) ? !deviceEyes.TryGetLeftEyeRotation(out deviceEyeGaze) : !deviceEyes.TryGetRightEyeRotation(out deviceEyeGaze)) { return; } // Blink float deviceEyeBlink; if ((type == MLEye.EyeType.Left) ? !deviceEyes.TryGetLeftEyeOpenAmount(out deviceEyeBlink) : !deviceEyes.TryGetRightEyeOpenAmount(out deviceEyeBlink)) { return; } // Center Confidence // Note: These values are not exposed via UnityEngine.XR.Eyes. // Instead they are pulled through a custom implementation. float deviceCenterConfidence; if ((type == MLEye.EyeType.Left) ? !device.TryGetFeatureValue(MagicLeapHeadUsages.EyeLeftCenterConfidence, out deviceCenterConfidence) : !device.TryGetFeatureValue(MagicLeapHeadUsages.EyeRightCenterConfidence, out deviceCenterConfidence)) { return; } // Update the requested eye. if (type == MLEye.EyeType.Left) { LeftEye.Update(deviceEyeCenter, deviceEyeGaze, deviceCenterConfidence, (deviceEyeBlink == 0f) ? true : false); } else { RightEye.Update(deviceEyeCenter, deviceEyeGaze, deviceCenterConfidence, (deviceEyeBlink == 0f) ? true : false); } }
public override int GetHashCode() { int hash = 2039; hash = hash * 1553 + RawCoordinates.GetHashCode(); hash = hash * 1553 + SmoothedCoordinates.GetHashCode(); hash = hash * 1553 + LeftEye.GetHashCode(); hash = hash * 1553 + RightEye.GetHashCode(); hash = hash * 1553 + State.GetHashCode(); hash = hash * 1553 + IsFixated.GetHashCode(); return(hash); }
private void Form1_Load(object sender, EventArgs e) { LeftEye.SetTextBox(LeftEyeLocation, "左目"); LeftEye.SetOriginPic(); RightEye.SetTextBox(RightEyeLocation, "右目"); RightEye.SetOriginPic(); Nose.SetTextBox(NoseLocation, "鼻"); Nose.SetOriginPic(); Mouse.SetTextBox(MouseLocation, "口"); Nose.SetOriginPic(); game = new Game(); }
// Start is called before the first frame update void Start() { LeftEyeMove = LeftEye.GetComponent <EyeballMoveV2>(); RightEyeMove = RightEye.GetComponent <EyeballMoveV2>(); // Apply inputs // To-Do: move to scriptable object LeftEyeMove.SetInputs("Mouse X", "Mouse Y"); //"Left Analog X", "Left Analog Y"); RightEyeMove.SetInputs("Right Analog X", "Right Analog Y"); // Set current goals LeftEyeMove.SetGoalCoords(CurrentGoal); RightEyeMove.SetGoalCoords(CurrentGoal); // Randomize Eye Rotation LeftEyeMove.Spin(Random.rotation, 2.5f); RightEyeMove.Spin(Random.rotation, 2.5f); }
public override bool Equals(Object o) { var other = o as GazeData; if (other != null) { return (State == other.State && TimeStamp == other.TimeStamp && RawCoordinates.Equals(other.RawCoordinates) && SmoothedCoordinates.Equals(other.SmoothedCoordinates) && LeftEye.Equals(other.LeftEye) && RightEye.Equals(other.RightEye) && IsFixated == other.IsFixated); } return(false); }
private void UpdatePosition(EyesPosition position) { if (position.IsLeftEyeVisible) { LeftEye.UpdatePosition(position.LeftEyePosition2D.X, position.LeftEyePosition2D.Y); LeftEye.IsVisible = true; } else { LeftEye.IsVisible = false; } if (position.IsRightEyeVisible) { RightEye.UpdatePosition(position.RightEyePosition2D.X, position.RightEyePosition2D.Y); RightEye.IsVisible = true; } else { RightEye.IsVisible = false; } }
public override bool Equals(Object o) { if (ReferenceEquals(this, o)) { return(true); } if (!(o is GazeData)) { return(false); } var other = o as GazeData; return (State == other.State && RawCoordinates.Equals(other.RawCoordinates) && SmoothedCoordinates.Equals(other.SmoothedCoordinates) && LeftEye.Equals(other.LeftEye) && RightEye.Equals(other.RightEye) && TimeStamp == other.TimeStamp && TimeStampString.Equals(TimeStampString) && IsFixated == other.IsFixated); }
public void CloseEyes() { LeftEye.SetActive(false); RightEye.SetActive(false); }
public void OpenEyes() { LeftEye.SetActive(true); RightEye.SetActive(true); }