// Update is called once per frame void Update() { if (this.setupComplete) { this.setupComplete = false; } //reset the setupCOmplete "Event" back to zero. //update the glove. if (trackedGlove != null && trackedGlove.GloveReady()) { if (!wristCalibrated) { if (calibrationTime < calibrationTimer) { calibrationTime += Time.deltaTime; } else { this.CalibrateWrist(); //Show the hand & lower arm only after the wrist has been calibrated. int activate = (anchor != AnchorPoint.Wrist) ? 2 : 1; for (int i = 0; i < activate && i < this.transform.childCount; i++) { this.transform.GetChild(i).gameObject.SetActive(true); } wristCalibrated = true; } } UpdateGlove(trackedGlove.GloveData()); UpdateHand(trackedGlove.GloveData()); UpdateWrist(trackedGlove.GloveData()); } }
// Update is called once per frame void Update() { if (senseGlove != null && senseGlove.GloveReady() && text != null) { text.text = "Recieving " + senseGlove.GloveData().packetsPerSecond + " packets / second"; } }
void UpdateAngles() { if (this.glove != null && glove.GloveReady()) { float[][] angles = this.glove.GloveData().gloveValues; SenseGloveCs.GloveData data = this.glove.GetRawGloveData(); string msg = ""; for (int f = 0; f < angles.Length; f++) { for (int j = 0; j < angles[f].Length; j++) { msg += (int)Mathf.Round(SenseGloveCs.Values.Degrees(angles[f][j])); msg += "/"; if (j == 0) { msg += (int)Mathf.Round(SenseGloveCs.Values.Degrees(data.kinematics.gloveLinks[f].joints[j].relativeAngle.z)); } else { msg += (int)Mathf.Round(SenseGloveCs.Values.Degrees(data.kinematics.gloveLinks[f].joints[j + 1].relativeAngle.y)); } if (j < angles[f].Length - 1) { msg += " \t"; } } msg += "\r\n"; } this.text.text = msg; } }
// Update is called once per frame void Update() { if (leftGlove != null) { if (leftGlove.GloveReady() && !leftReady) { this.leftReady = true; if (!rightReady) { SetModels(true, false); } } } if (rightGlove != null) { if (rightGlove.GloveReady() && !rightReady) { this.rightReady = true; if (!leftReady) { SetModels(false, true); } } } if (Input.GetKeyDown(swapHandsKey) && (leftReady || rightReady)) { SetModels(!this.leftHandModel.activeInHierarchy, !this.rightHandModel.activeInHierarchy); } if (Input.GetKeyDown(switchSolver)) { if (leftReady) { if (leftGlove.solver == SolveType.InterpolateAsIMU) { leftGlove.solver = SolveType.Kinematic3D; } else if (leftGlove.solver == SolveType.Kinematic3D) { leftGlove.solver = SolveType.InterpolateAsIMU; } } if (rightReady) { if (rightGlove.solver == SolveType.InterpolateAsIMU) { rightGlove.solver = SolveType.Kinematic3D; } else if (rightGlove.solver == SolveType.Kinematic3D) { rightGlove.solver = SolveType.InterpolateAsIMU; } } } }
// Update is called once per frame void Update() { if (leftGlove != null) { if (leftGlove.GloveReady() && !leftReady) { this.leftReady = true; if (!rightReady) { SetModels(true, false); } } } if (rightGlove != null) { if (rightGlove.GloveReady() && !rightReady) { this.rightReady = true; if (!leftReady) { SetModels(false, true); } } } if (Input.GetKeyDown(swapHandsKey) && (leftReady || rightReady)) { SetModels(!this.leftHandModel.activeInHierarchy, !this.rightHandModel.activeInHierarchy); } if (Input.GetKeyDown(switchSolver)) { if (leftReady) { if (leftGlove.solver == SenseGloveCs.Solver.Interpolate4Sensors) { leftGlove.solver = SenseGloveCs.Solver.InverseKinematics; } else if (leftGlove.solver == SenseGloveCs.Solver.InverseKinematics) { leftGlove.solver = SenseGloveCs.Solver.Interpolate4Sensors; } } if (rightReady) { if (rightGlove.solver == SenseGloveCs.Solver.Interpolate4Sensors) { rightGlove.solver = SenseGloveCs.Solver.InverseKinematics; } else if (rightGlove.solver == SenseGloveCs.Solver.InverseKinematics) { rightGlove.solver = SenseGloveCs.Solver.Interpolate4Sensors; } } } }