Class XRSocketInteractor
Interactor used for holding interactables via a socket. This component is not designed to be attached to a controller (thus does not derive from XRBaseControllerInteractor) and instead will always attempt to select an interactable that it is hovering over (though will not perform exclusive selection of that interactable).
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
[DisallowMultipleComponent]
[AddComponentMenu("XR/XR Socket Interactor")]
public class XRSocketInteractor : XRBaseInteractor
Properties
interactableCantHoverMeshMaterial
Material used for rendering interactable meshes on hover when there is already a selected object in the socket (a default material will be created if none is supplied).
Declaration
public Material interactableCantHoverMeshMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
interactableHoverMeshMaterial
Material used for rendering interactable meshes on hover (a default material will be created if none is supplied).
Declaration
public Material interactableHoverMeshMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
interactableHoverScale
Scale at which to render hovered interactable.
Declaration
public float interactableHoverScale { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
isHoverActive
(Read Only) Indicates whether this interactor is in a state where it could hover (always true for sockets if active).
Declaration
public override bool isHoverActive { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Overrides
isSelectActive
(Read Only) Indicates whether this interactor is in a state where it could select (always true for sockets if active).
Declaration
public override bool isSelectActive { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Overrides
recycleDelayTime
Sets the amount of time the socket will refuse hovers after an object is removed.
Declaration
public float recycleDelayTime { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
requireSelectExclusive
(Read Only) Indicates whether this interactor requires exclusive selection of an interactable (always true for sockets).
Declaration
public override bool requireSelectExclusive { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Overrides
selectedInteractableMovementTypeOverride
(Read Only) Overriding movement type of the selected interactable's movement (always Kinematic for sockets).
Declaration
public override XRBaseInteractable.MovementType? selectedInteractableMovementTypeOverride { get; }
Property Value
| Type | Description |
|---|---|
| Nullable<XRBaseInteractable.MovementType> |
Overrides
showInteractableHoverMeshes
Whether this socket should show a mesh at socket's attach point for interactables that it is hovering over.
Declaration
public bool showInteractableHoverMeshes { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
socketActive
Whether socket interaction is enabled.
Declaration
public bool socketActive { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Methods
Awake()
Declaration
protected override void Awake()
Overrides
CanHover(XRBaseInteractable)
Determines if the interactable is valid for hover this frame.
Declaration
public override bool CanHover(XRBaseInteractable interactable)
Parameters
| Type | Name | Description |
|---|---|---|
| XRBaseInteractable | interactable | Interactable to check. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the interactable can be hovered over this frame. |
Overrides
CanSelect(XRBaseInteractable)
Determines if the interactable is valid for selection this frame.
Declaration
public override bool CanSelect(XRBaseInteractable interactable)
Parameters
| Type | Name | Description |
|---|---|---|
| XRBaseInteractable | interactable | Interactable to check. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the interactable can be selected this frame. |
Overrides
CreateDefaultHoverMaterials()
Create the default hover materials for interactableHoverMeshMaterial and interactableCantHoverMeshMaterial if necessary.
Declaration
protected virtual void CreateDefaultHoverMaterials()
DrawHoveredInteractables()
Declaration
protected virtual void DrawHoveredInteractables()
GetValidTargets(List<XRBaseInteractable>)
Retrieve the list of interactables that this interactor could possibly interact with this frame. This list is sorted by priority (in this case distance).
Declaration
public override void GetValidTargets(List<XRBaseInteractable> validTargets)
Parameters
| Type | Name | Description |
|---|---|---|
| List<XRBaseInteractable> | validTargets | Populated List of interactables that are valid for selection or hover. |
Overrides
OnHoverEntering(XRBaseInteractable)
This method is called by the interaction manager right before the interactor first initiates hovering over an interactable.
Declaration
protected override void OnHoverEntering(XRBaseInteractable interactable)
Parameters
| Type | Name | Description |
|---|---|---|
| XRBaseInteractable | interactable | Interactable that is being hovered over. |
Overrides
See Also
OnHoverExiting(XRBaseInteractable)
This method is called by the interaction manager right before the interactor ends hovering over an interactable.
Declaration
protected override void OnHoverExiting(XRBaseInteractable interactable)
Parameters
| Type | Name | Description |
|---|---|---|
| XRBaseInteractable | interactable | Interactable that is no longer hovered over. |
Overrides
See Also
OnSelectExiting(XRBaseInteractable)
This method is called by the interaction manager right before the interactor ends selection of an interactable.
Declaration
protected override void OnSelectExiting(XRBaseInteractable interactable)
Parameters
| Type | Name | Description |
|---|---|---|
| XRBaseInteractable | interactable | Interactable that is no longer selected. |
Overrides
See Also
OnTriggerEnter(Collider)
Declaration
protected void OnTriggerEnter(Collider col)
Parameters
| Type | Name | Description |
|---|---|---|
| Collider | col |
OnTriggerExit(Collider)
Declaration
protected void OnTriggerExit(Collider col)
Parameters
| Type | Name | Description |
|---|---|---|
| Collider | col |
ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
This method is called by the interaction manager to update the interactor. Please see the interaction manager documentation for more details on update order.
Declaration
public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
| Type | Name | Description |
|---|---|---|
| XRInteractionUpdateOrder.UpdatePhase | updatePhase |