/// <summary> Fires when the sense glove's calibration finishes. Store the new variables. </summary> /// <param name="source"></param> /// <param name="args"></param> private void SenseGlove_CalibrationFinished(object source, GloveCalibrationArgs args) { if (!calGuard) //LoadCalibration also fires a CalibrationFinished event. { this.GetLastCalibration(); } }
/// <summary> Used to call the OnCalibrationFinished event. </summary> /// <param name="calibrationArgs"></param> protected void FinishCalibration(GloveCalibrationArgs calibrationArgs) { if (CalibrationFinished != null) { CalibrationFinished(this, calibrationArgs); } }
/// <summary> Call the ResizeFingers function. </summary> /// <param name="source"></param> /// <param name="args"></param> protected virtual void SenseGlove_OnCalibrationFinished(object source, GloveCalibrationArgs args) { if (this.resizeFingers) { this.ResizeHand(args.newData.GetFingerLengths()); } }
/// <summary> Used to call the OnCalibrationFinished event. </summary> /// <param name="calibrationArgs"></param> protected void CalibrationFinished(GloveCalibrationArgs calibrationArgs) { if (OnCalibrationFinished != null) { OnCalibrationFinished(this, calibrationArgs); } }
/// <summary> Check if we have any CalibrationComplete events queued, then send them. </summary> /// <remarks>Placed indside a seprate method so we can call it during both Update and LateUpdate. Should only be fired from these</remarks> private void CheckCalibration() { if (this.calibrationArguments != null) { this.CalibrationFinished(this.calibrationArguments); this.calibrationArguments = null; } }
/// <summary> Keeps the glove index position on the same location, while shifting the other glove fingers back or forth. </summary> /// <param name="source"></param> /// <param name="args"></param> protected override void SenseGlove_OnCalibrationFinished(object source, GloveCalibrationArgs args) { //resize so that the index finger position remains on the same place Vector3 dIndex = args.newData.handPositions[1][0] - args.oldData.handPositions[1][0]; this.handBase.transform.localPosition = this.handBase.transform.localPosition - dIndex; this.gloveBase.transform.localPosition = this.gloveBase.transform.localPosition - dIndex; base.SenseGlove_OnCalibrationFinished(source, args); }
//-------------------------------------------------------------------------------------------------------------------------- // Calibration Methods #region Calibration /// <summary> The Calibration of the Sense Glove should be ready to fire. </summary> /// <param name="args"></param> /// <param name="fromDLL"></param> protected virtual void ReadyCalibration(GloveCalibrationArgs args, bool fromDLL) { if (fromDLL) //comes from a possibly async thread within the DLL { this.calibrationArguments.Add(args); //queue } else { this.FinishCalibration(args); //Unity's main thread. just fire, no queue. } }
/// <summary> The Calibration of the Sense Glove should be ready to fire. </summary> /// <param name="args"></param> /// <param name="fromDLL"></param> private void ReadyCalibration(GloveCalibrationArgs args, bool fromDLL) { if (fromDLL) //comes from a possibly async thread within the DLL { this.calibrationArguments = args; //queue } else { this.CalibrationFinished(args); //just fire, no queue. } }
private void SenseGlove_CalibrationFinished(object source, GloveCalibrationArgs args) { this.InstructionText = "Calibration Example\r\nPress " + this.prevSolverKey.ToString() + "/" + this.nextSolverKey.ToString() + " to cycle solvers.\r\nPress " + this.startCalibrationKey + " to calibrate, R to reset."; this.StepText = ""; }
/// <summary> Resets the initation from this script when my calibration completes. </summary> /// <param name="source"></param> /// <param name="args"></param> private void SenseGlove_OnCalibrationFinished(object source, GloveCalibrationArgs args) { this.initiated = false; }