Method OnGrabCountChanged
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.
Declaration
public virtual void OnGrabCountChanged(XRGrabInteractable grabInteractable, Pose targetPose, Vector3 localScale)
Parameters
| Type | Name | Description |
|---|---|---|
| XRGrabInteractable | grabInteractable | The XR Grab Interactable being grabbed. |
| Pose | targetPose | The current target pose for the current frame. |
| Vector3 | localScale | The current target scale of the Interactable's transform relative to the GameObject's parent. |
Implements
Remarks
There will always be at least one Interactor selecting the Interactable when this method is called.
In other words, this will be called when the selection count changes from 0 to 1
and whenever it subsequently changes while still above 0.
This method is called by Unity right before Process(XRGrabInteractable, UpdatePhase, ref Pose, ref Vector3) if the selection count changed.
grabInteractable.interactorsSelecting.Count