private void ApplyConstraintsForType(ref MixedRealityTransform transform, bool isOneHanded, bool isNear, TransformFlags transformType) { ManipulationHandFlags handMode = isOneHanded ? ManipulationHandFlags.OneHanded : ManipulationHandFlags.TwoHanded; ManipulationProximityFlags proximityMode = isNear ? ManipulationProximityFlags.Near : ManipulationProximityFlags.Far; foreach (var constraint in constraints) { if (constraint.ConstraintType == transformType && constraint.HandType.HasFlag(handMode) && constraint.ProximityType.HasFlag(proximityMode)) { constraint.ApplyConstraint(ref transform); } } }
/// <summary> /// Checks to determine if all bits in a provided mask are set. /// </summary> /// <param name="a"><see cref="ManipulationHandFlags"/> value.</param> /// <param name="b"><see cref="ManipulationHandFlags"/> mask.</param> /// <returns> /// True if all of the bits in the specified mask are set in the current value. /// </returns> public static bool IsMaskSet(this ManipulationHandFlags a, ManipulationHandFlags b) { return((a & b) == b); }