Class XRBaseGrabTransformer
Abstract base class from which all grab transformer behaviors derive. Instances of this class can be assigned to an XRGrabInteractable using the Inspector by setting the Starting Single Grab Transformers (startingSingleGrabTransformers) and Starting Multiple Grab Transformers (startingMultipleGrabTransformers). This serves as a serializable reference instead of using the runtime list of grab transformers which is not serialized.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Transformers
Assembly: solution.dll
Syntax
public abstract class XRBaseGrabTransformer : MonoBehaviour, 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. |
| registrationMode | Controls how this grab transformer will be registered automatically at startup. |
Methods
| Name | Description |
|---|---|
| OnDestroy() | This function is called when the MonoBehaviour will be destroyed. See MonoBehaviour. |
| 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 |
| Start() | This function is called just before any of the Update methods is called the first time. See MonoBehaviour. |