Class XRSingleGrabFreeTransformer
Grab transformer which supports moving and rotating unconstrained with a single Interactor. Maintains the offset from the attachment point used for that Interactor.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Transformers
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/Transformers/XR Single Grab Free Transformer", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Transformers.XRSingleGrabFreeTransformer.html")]
public class XRSingleGrabFreeTransformer : XRBaseGrabTransformer, IXRGrabTransformer
Methods
Process(XRGrabInteractable, UpdatePhase, ref Pose, ref Vector3)
Called by the linked Interactable to calculate the target pose and scale.
Modify the value of targetPose
and/or localScale
(or neither).
Declaration
public override void Process(XRGrabInteractable grabInteractable, XRInteractionUpdateOrder.UpdatePhase updatePhase, ref Pose targetPose, ref Vector3 localScale)
Parameters
Type | Name | Description |
---|---|---|
XRGrabInteractable | grabInteractable | The XR Grab Interactable to calculate the target pose and scale for. |
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Pose | targetPose | The target pose for the current frame. |
Vector3 | localScale | The target scale of the Interactable's transform relative to the GameObject's parent. |
Overrides
Remarks
When there is more than one linked grab transformer that can process, the updated value of each ref parameter is passed to each in series according to its order in the list. You can utilize this by, for example, having the first grab transformer compute the target pose, and the second compute just the scale.
Examples
If your transformer requires the use of two or more selections, you should first check for that condition in your implementation method:
if (grabInteractable.interactorsSelecting.Count < 2) return;