Interface IInteractionAttachController
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.
Namespace: UnityEngine.XR.Interaction.Toolkit.Attachment
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
public interface IInteractionAttachController
Properties
hasOffset
Indicates whether the anchor currently has an offset applied.
Declaration
bool hasOffset { get; }
Property Value
Type | Description |
---|---|
bool |
motionStabilizationMode
The mode determining how motion stabilization is applied.
Declaration
MotionStabilizationMode motionStabilizationMode { get; set; }
Property Value
Type | Description |
---|---|
MotionStabilizationMode |
transformToFollow
The transform that the anchor will follow.
Declaration
Transform transformToFollow { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Methods
ApplyLocalPositionOffset(Vector3)
Applies a local position offset to the anchor child. Ensures the z-value of the new position is non-negative.
Declaration
void ApplyLocalPositionOffset(Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | offset | The local position offset to apply. |
ApplyLocalRotationOffset(Quaternion)
Applies a local rotation offset to the anchor child.
Declaration
void ApplyLocalRotationOffset(Quaternion localRotation)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | localRotation | The local rotation offset to apply. |
DoUpdate(float)
Updates the anchor based on motion stabilization settings and applies velocity-based offset calculations.
Declaration
void DoUpdate(float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
float | deltaTime | The time elapsed since the last update. |
GetOrCreateAnchorTransform(bool)
Gets or creates the transform used as the anchor, optionally updating its position and rotation.
Declaration
Transform GetOrCreateAnchorTransform(bool updateTransform = false)
Parameters
Type | Name | Description |
---|---|---|
bool | updateTransform | Whether to update the transform's position and rotation. |
Returns
Type | Description |
---|---|
Transform | The transform used as the anchor. |
MoveTo(Vector3)
Moves the anchor child to a specified world position. Adjusts the position if it results in a negative z-value in local space.
Declaration
void MoveTo(Vector3 targetWorldPosition)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | targetWorldPosition | The target world position to move the anchor child to. |
ResetOffset()
Resets the anchor child's position and rotation to the origin, removing any applied offsets.
Declaration
void ResetOffset()