/// <summary>
 /// Invokes the OnTrackedObjectSelected event to signal that the user chose this tracked object.
 /// </summary>
 /// <param name="clicker"></param>
 void IXRClickable.OnClick(ZEDXRGrabber clicker)
 {
     if (OnTrackedObjectSelected != null)
     {
         OnTrackedObjectSelected.Invoke(deviceIndex);
     }
 }
    /// <summary>
    /// Handles the process of adding a reference point. First logs the starting point as the "virtual" point, and freezes the
    /// 2D video so the user can align the virtual controller with the real-world image. When they click again, this adds
    /// the "real" point and sends it to the AutoCalibrationManager.
    /// </summary>
    private IEnumerator PlacingBall(ZEDXRGrabber clicker)
    {
        if (!isSetup)
        {
            throw new System.Exception("Tried to use AutoCalibBall to calibrate before Setup was called on it.");
        }
        col.enabled = false;

        SetBallStateDisplay(DisplayState.Nothing);

        //Display new message.
        MessageDisplay.DisplayMessageAll("AUTOMATIC MODE\r\nLine up the virtual controller with its real-world counterpart. Then click again.");

        virtualPos = zedManager.transform.InverseTransformPoint(clicker.transform.position);

        //DrawOutputToPlane.pauseTextureUpdate = true; //Pause the video
        zedManager.pauseLiveReading = true;
        //TODO: Graphics stuff.
        //TODO: Hide all other calibration balls.
        //print("Paused - " + ballIndex);

        //First wait to make sure the click key is no longer held, so we can click it a second time separately.
        while (clicker.zedController.CheckClickButton(ControllerButtonState.Down))
        {
            yield return(null);
        }

        //Now wait for it to go down again.
        while (!clicker.zedController.CheckClickButton(ControllerButtonState.Down))
        {
            yield return(null);
        }

        realPos = zedManager.transform.InverseTransformPoint(clicker.transform.position);

        autoCalib.AddNewPositions(ballIndex, virtualPos, realPos);

        zedManager.pauseLiveReading = false;
        col.enabled = true;

        MessageDisplay.DisplayMessageAll("AUTOMATIC MODE\r\nRepeat this process with the rest of the balls, or stop when you're satisfied.");
        hasBeenSet = true;
        SetBallStateDisplay(DisplayState.Checkmark);
    }
示例#3
0
 /// <summary>
 /// What happens when this object is clicked. From IXRClickable.
 /// </summary>
 /// <param name="clicker"></param>
 public override void OnClick(ZEDXRGrabber clicker)
 {
     RequestStateChange();
 }
示例#4
0
    /// <summary>
    /// Invoke the event and play the animation that shrinks and darkens the button temporarily.
    /// </summary>
    /// <param name="clicker"></param>
    public override void OnClick(ZEDXRGrabber clicker)
    {
        OnClicked.Invoke();

        StartCoroutine(DisplayClick());
    }
示例#5
0
 public abstract void OnClick(ZEDXRGrabber clicker);
 /// <summary>
 /// Starts the process of adding a virtual and real reference point. Only called when first activated, as the collider is disabled afterward.
 /// </summary>
 /// <param name="clicker"></param>
 void IXRClickable.OnClick(ZEDXRGrabber clicker)
 {
     //TODO: Graphics stuff.
     StartCoroutine(PlacingBall(clicker));
 }