namespace UnityEngine.XR.Interaction.Toolkit.Attachment { /// /// Enum representing the stabilization mode for the anchor. /// /// public enum MotionStabilizationMode { /// /// Indicates that stabilization should never be applied. /// Never, /// /// Stabilization is applied only when there is a position offset. /// WithPositionOffset, /// /// Stabilization is always applied regardless of position offset. /// Always, } /// /// Interface defining the control and behavior of an interaction anchor. /// It includes methods for creating and updating anchors, managing motion stabilization, /// and applying position and rotation offsets. /// public interface IInteractionAttachController { /// /// Gets or creates the transform used as the anchor, optionally updating its position and rotation. /// /// Whether to update the transform's position and rotation. /// The transform used as the anchor. Transform GetOrCreateAnchorTransform(bool updateTransform = false); /// /// The transform that the anchor will follow. /// Transform transformToFollow { get; set; } /// /// The mode determining how motion stabilization is applied. /// MotionStabilizationMode motionStabilizationMode { get; set; } /// /// Indicates whether the anchor currently has an offset applied. /// bool hasOffset { get; } /// /// Moves the anchor child to a specified world position. Adjusts the position if it results in a negative z-value in local space. /// /// The target world position to move the anchor child to. void MoveTo(Vector3 targetWorldPosition); /// /// Applies a local position offset to the anchor child. Ensures the z-value of the new position is non-negative. /// /// The local position offset to apply. void ApplyLocalPositionOffset(Vector3 offset); /// /// Applies a local rotation offset to the anchor child. /// /// The local rotation offset to apply. void ApplyLocalRotationOffset(Quaternion localRotation); /// /// Resets the anchor child's position and rotation to the origin, removing any applied offsets. /// void ResetOffset(); /// /// Updates the anchor based on motion stabilization settings and applies velocity-based offset calculations. /// /// The time elapsed since the last update. void DoUpdate(float deltaTime); } }