Class XRSocketGrabTransformer
Transformer used when an interactable is snapped to a socket. Applies both when select is active and when hover socket snapping is active.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Transformers
Assembly: solution.dll
Syntax
[HelpURL("https://docs.unity.cn/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Transformers.XRSocketGrabTransformer.html")]
public class XRSocketGrabTransformer : IXRGrabTransformer
Properties
| Name | Description |
|---|---|
| canProcess | Whether this grab transformer can process targets. Transformers that can process targets receive calls to Process(XRGrabInteractable, UpdatePhase, ref Pose, ref Vector3), transformers that cannot process do not. Transformers will still have other event methods called to allow for initialization on the frame the grab changes happens. |
| fixedScale | Scale factor applied to the interactable when scale mode is set to Fixed. |
| scaleMode | Scale mode used to calculate the scale factor applied to the interactable when hovering. |
| socketInteractor | The current socket interactor. |
| socketSnappingRadius | When socket snapping is enabled, this is the radius within which the interactable will snap to the socket's attach transform while hovering. |
| targetBoundsSize | Bounds size used to calculate the scale factor applied to the interactable when scale mode is set to Stretched To Fit Size. |
Methods
| Name | Description |
|---|---|
| OnGrab(XRGrabInteractable) | Called by Unity when the given Interactable is grabbed (in other words, when entering the Select state). This method won't be called again until the Interactable is released by every Interactor. Use this to do any code initialization based on the first Interactor that selects the Interactable. |
| OnGrabCountChanged(XRGrabInteractable, Pose, Vector3) | Called by Unity each time the number of selections changes for the given Interactable while grabbed by at least one Interactor, including when it is first grabbed. Use this to do any code initialization based on each Interactor currently selecting the Interactable, for example computing the initial distance between both Interactors grabbing the object. |
| OnLink(XRGrabInteractable) | Called by Unity when the given Interactable links to this grab transformer. Use this to do any code initialization for the given Interactable. |
| OnUnlink(XRGrabInteractable) | Called by Unity when the given Interactable unlinks from this grab transformer. Use this to do any code cleanup for the given Interactable. |
| Process(XRGrabInteractable, UpdatePhase, ref Pose, ref Vector3) | Called by the linked Interactable to calculate the target pose and scale.
Modify the value of |