protected override void OnTriggerStay(Collider collider) { base.OnTriggerStay(collider); if (currentInteractingVelocityEstimator != null) { Vector3 currentVelocity = currentInteractingVelocityEstimator.GetVelocityEstimate(); // Check each axis for the velocity limit if (xAxisSpeedLimit != 0) { if (Mathf.Abs(currentVelocity.x) > xAxisSpeedLimit) { OnObjectFinishedInteractionArea(new InteractionAreaEventArgs()); } } if (yAxisSpeedLimit != 0) { if (Mathf.Abs(currentVelocity.y) > yAxisSpeedLimit) { OnObjectFinishedInteractionArea(new InteractionAreaEventArgs()); } } if (zAxisSpeedLimit != 0) { if (Mathf.Abs(currentVelocity.z) > zAxisSpeedLimit) { OnObjectFinishedInteractionArea(new InteractionAreaEventArgs()); } } } }
private IEnumerator GetVelocity() { while (gettingVelocity) { velocityMagnitudes.Add(velocityEst.GetVelocityEstimate().magnitude); yield return(null); } }
private void Update() { leftHandSpeed = leftEstimator.GetVelocityEstimate().magnitude; rightHandSpeed = rightEstimator.GetVelocityEstimate().magnitude; if (leftHandSpeed >= requiredSpeed && rightHandSpeed >= requiredSpeed) { canShake = true; } }