Skip to content

Put Back Socket Interactor

eisclimber edited this page Jan 18, 2024 · 3 revisions

Put Back Socket Interactor

class in ExPresSXR.Interaction / Extends class in ExPresSXR.Interaction.HighlightableSocketInteractor GameObject instantiable via ExPresS XR/Put Back Socket Interactor

Description

An Expansion of the HighlightableSocketInteractor to restrict access to a single GameObject an instance of the putBackPrefab. After a certain amount of time outside the interactor and not being held or selected elsewhere, the object will be snap back to this socket.

The putBackPrefab will be automatically be instanced. If it does not have a XRGrabInteractable-Component and allowNonInteractables = true it will be instanced at the attach point of the socket but won't be able to be interacted with.

If the socket does not hold an object, it will be disabled.

Members

Public Properties

  • GameObject putBackPrefab: The prefab that is displayed at the socket. Will automatically create an instance of the prefab and update the references.
  • bool allowNonInteractables: If enabled GameObjects without an XRGrabInteractable-Component will be allowed to be set as putBackPrefab. Otherwise those will be cleared.
  • putBackObjectInstance: (readonly) A reference to the instance of the current putBackPrefab. If this instance could not be created (putBackPrefab = null) the socket will be disabled.
  • XRGrabInteractable putBackInteractable: (readonly) A reference to the XRGrabInteractable of the current putBackPrefab.
  • float putBackTime: The duration in seconds how long the put back object can be unselected outside the socket until being snapped back to the socket. If less or equal to 0, the object will snap back instantaneous.

Public Methods

  • void UpdatePutBackObject(): Updates the putBackPrefab by destroying and creating instances, adding/removing listeners and de-/selecting the interactable. Will be automatically called when setting putBackPrefab.

Inherited Members

Protected Methods

  • void Awake(): Deactivates the socket if no putBackObjectInstance could be created and sets up the inherited socket classes. Can be overwritten but base.Awake() should be called to ensure correct behavior.
  • void OnEnable(): Resets the putBackObject when rebuilding to prevent errors. Can be overwritten but base.OnEnable() should be called to ensure correct behavior.
  • bool CanHover(IXRHoverInteractable interactable): Determines if a XRGrabInteractable can hover, e.g. is considered a valid target. Can be overwritten but base.CanHover(interactable) should be called to ensure correct behavior.
  • bool CanSelect(IXRSelectInteractable interactable): Determines if a XRGrabInteractable can be selected, e.g. is considered a valid target. Can be overwritten but base.CanSelect(interactable) should be called to ensure correct behavior.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally