public Vector3 Acceleration; // The acceleration of the whole Stylus. /// <summary> /// Check if stylus transform data is outside of the current limits /// </summary> /// <param name="oldLimit"></param> /// <param name="thresholds"></param> /// <returns></returns> public bool IsOutsideLimits(StylusTransformData oldLimit, Thresholds thresholds) { bool lastThresholdIsValid = false; float moveDistance = StylusDataMethods.GetSqrDistance(oldLimit.Position, this.Position); // check distance threshold if (moveDistance > thresholds.Movement) { lastThresholdIsValid = true; } //check rotation threshold float rotationDistance = StylusDataMethods.GetSqrDistance(oldLimit.Rotation.eulerAngles, this.Rotation.eulerAngles); if (rotationDistance > thresholds.Rotation) { lastThresholdIsValid = true; } //check acceleration threshold float accelerationDistance = StylusDataMethods.GetSqrDistance(oldLimit.Acceleration, this.Acceleration); if (accelerationDistance > thresholds.Acceleration) { lastThresholdIsValid = true; } return(lastThresholdIsValid); }
public float Pressure; // The pressed value of the button. /// <summary> /// Checks if the button pressure is outside of the limits /// </summary> /// <param name="oldLimit"></param> /// <param name="thresholds"></param> /// <returns></returns> public bool IsOutsideLimits(StylusButtonData oldLimit, Thresholds thresholds) { float moveDistance = StylusDataMethods.GetDistance(oldLimit.Pressure, this.Pressure); bool isOutOfLimits = moveDistance > thresholds.ButtonPressureThreshold; return(isOutOfLimits); }