class MAGES::Interaction::Interactors::BaseControllerInteractor

Overview

Class for basic functionality for all controller based interactors. It handles the input from the controller and can play sounds and haptics on events. More…

class BaseControllerInteractor:
    public MAGES::Interaction::Interactors::BaseInteractor,
    public MAGES::IControllerInteractor
{
public:
    // enums

    enum ControllerSide;

    // properties

    ControllerSide InputControllerSide;
    AudioSource SoundSource;
    AudioClip HoverEnterSound;
    AudioClip SelectEnterSound;
    AudioClip ActivateEnterSound;
    float UIHoverEnterHapticIntensity;
    float HoverEnterHapticIntensity;
    float SelectEnterHapticIntensity;
    float ActivateEnterHapticIntensity;
    override bool IsSelectEnabled;
    override bool IsActivateEnabled;
    override float SelectionIntensity;
    override float ActivationIntensity;
    bool IsSelectInputEnabled;
    bool WasSelectInputEnabledThisFrame;
    bool WasSelectInputDisabledThisFrame;
    bool IsActivateInputEnabled;
    bool WasActivateInputEnabledThisFrame;
    bool WasActivateInputDisabledThisFrame;
    bool IsUISelectInputEnabled;
    bool WasUISelectInputEnabledThisFrame;
    bool WasUISelectInputDisabledThisFrame;

    // methods

    virtual override bool CanSelect(IInteractable interactable);
    virtual override bool CanActivate(IInteractable interactable);
    bool PlayHaptics(float intensity, float duration = 0.1f);
};

// direct descendants

class HandInteractor;

Inherited Members

public:
    // properties

    IInteractionManager InteractionManager;
    InteractionLayer InteractionLayer;
    Transform Transform;
    Rigidbody Rigidbody;
    List Colliders;
    UnityEvent<InteractorRegisterEventArgs> RegisterEntered;
    UnityEvent<InteractorDeregisterEventArgs> DeregisterEntered;
    UnityEvent<HoverEnterInteractionEventArgs> HoverEntered;
    UnityEvent<HoverExitInteractionEventArgs> HoverExited;
    UnityEvent<SelectEnterInteractionEventArgs> SelectEntered;
    UnityEvent<SelectExitInteractionEventArgs> SelectExited;
    UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered;
    UnityEvent<ActivateExitInteractionEventArgs> ActivateExited;
    bool IsHoverEnabled;
    bool HasHover;
    IInteractable HoveredInteractable;
    bool IsSelectEnabled;
    bool HasSelection;
    IInteractable SelectedInteractable;
    IInteractable ManualSelectionInteractable;
    float SelectionIntensity;
    bool IsActivateEnabled;
    bool HasActivation;
    IInteractable ActivatedInteractable;
    float ActivationIntensity;
    IInteractionManager InteractionManager;
    HandPoser HandPoser;
    InteractionLayer InteractionLayer;
    Transform Transform;
    Rigidbody Rigidbody;
    List Colliders;
    UnityEvent<InteractorRegisterEventArgs> RegisterEntered;
    UnityEvent<InteractorDeregisterEventArgs> DeregisterEntered;
    UnityEvent<HoverEnterInteractionEventArgs> HoverEntered;
    UnityEvent<HoverExitInteractionEventArgs> HoverExited;
    UnityEvent<SelectEnterInteractionEventArgs> SelectEntered;
    UnityEvent<SelectExitInteractionEventArgs> SelectExited;
    UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered;
    UnityEvent<ActivateExitInteractionEventArgs> ActivateExited;
    bool IsHoverEnabled;
    bool HasHover;
    IInteractable HoveredInteractable;
    bool IsSelectEnabled;
    bool HasSelection;
    IInteractable ManualSelectionInteractable;
    float SelectionIntensity;
    IInteractable SelectedInteractable;
    bool IsActivateEnabled;
    bool HasActivation;
    float ActivationIntensity;
    IInteractable ActivatedInteractable;
    AudioSource SoundSource;
    AudioClip HoverEnterSound;
    AudioClip SelectEnterSound;
    AudioClip ActivateEnterSound;
    float UIHoverEnterHapticIntensity;
    float HoverEnterHapticIntensity;
    float SelectEnterHapticIntensity;
    float ActivateEnterHapticIntensity;
    bool IsSelectInputEnabled;
    bool WasSelectInputEnabledThisFrame;
    bool WasSelectInputDisabledThisFrame;
    bool IsActivateInputEnabled;
    bool WasActivateInputEnabledThisFrame;
    bool WasActivateInputDisabledThisFrame;
    bool IsUISelectInputEnabled;
    bool WasUISelectInputEnabledThisFrame;
    bool WasUISelectInputDisabledThisFrame;

    // methods

    bool CanHover(IInteractable interactable);
    bool IsHovering(IInteractable interactable);
    bool HoverExit(IInteractable interactable);
    void OnHoverEnter(HoverEnterInteractionEventArgs args);
    void OnHoverEntered(HoverEnterInteractionEventArgs args);
    void OnHoverExit(HoverExitInteractionEventArgs args);
    void OnHoverExited(HoverExitInteractionEventArgs args);
    bool CanSelect(IInteractable interactable);
    bool IsSelecting(IInteractable interactable);
    bool SelectExit(IInteractable interactable);
    void OnSelectEnter(SelectEnterInteractionEventArgs args);
    void OnSelectEntered(SelectEnterInteractionEventArgs args);
    void OnSelectExit(SelectExitInteractionEventArgs args);
    void OnSelectExited(SelectExitInteractionEventArgs args);
    void StartManualSelection(IInteractable interactable);
    void StopManualSelection();
    bool CanActivate(IInteractable interactable);
    bool IsActivating(IInteractable interactable);
    bool ActivateExit(IInteractable interactable);
    void OnActivateEnter(ActivateEnterInteractionEventArgs args);
    void OnActivateEntered(ActivateEnterInteractionEventArgs args);
    void OnActivateExit(ActivateExitInteractionEventArgs args);
    void OnActivateExited(ActivateExitInteractionEventArgs args);
    void OnRegisterEnter(InteractorRegisterEventArgs args);
    void OnRegisterEntered(InteractorRegisterEventArgs args);
    void OnDeregisterEnter(InteractorDeregisterEventArgs args);
    void OnDeregisterEntered(InteractorDeregisterEventArgs args);
    void GetValidTargets(List<IInteractable> result);
    void PreprocessInteractor(UpdatePhase updatePhase);
    void ProcessInteractor(UpdatePhase updatePhase);
    virtual bool CanHover(IInteractable interactable);
    virtual bool CanSelect(IInteractable interactable);
    virtual bool CanActivate(IInteractable interactable);
    virtual void StartManualSelection(IInteractable interactable);
    virtual void StopManualSelection();
    virtual void AttachInteractorToInteractable();
    virtual void DetachInteractorToInteractable();
    void GetValidTargets(List<IInteractable> result);
    bool IsHovering(IInteractable interactable);
    bool HoverExit(IInteractable interactable);
    bool IsSelecting(IInteractable interactable);
    bool SelectExit(IInteractable interactable);
    bool IsActivating(IInteractable interactable);
    bool ActivateExit(IInteractable interactable);
    virtual void PreprocessInteractor(UpdatePhase updatePhase);
    virtual void ProcessInteractor(UpdatePhase updatePhase);
    bool PlayHaptics(float intensity, float duration);

Detailed Documentation

Class for basic functionality for all controller based interactors. It handles the input from the controller and can play sounds and haptics on events.

Properties

ControllerSide InputControllerSide

Gets or sets the controller side to bind to.

AudioSource SoundSource

Gets or sets the sound source to play sounds from.

AudioClip HoverEnterSound

Gets or sets the sound to be played when the interactor starts hovering.

AudioClip SelectEnterSound

Gets or sets the sound to be played when the interactor starts selecting.

AudioClip ActivateEnterSound

Gets or sets the sound to be played when the interactor starts activating.

float UIHoverEnterHapticIntensity

Gets or sets the haptic feedback strength when the interactor starts hovering over a UI.

float HoverEnterHapticIntensity

Gets or sets the haptic feedback strength when the interactor starts hovering.

float SelectEnterHapticIntensity

Gets or sets the haptic feedback strength when the interactor starts selecting.

float ActivateEnterHapticIntensity

Gets or sets the haptic feedback strength when the interactor starts activating.

override bool IsSelectEnabled

Gets a value indicating whether this interactor should send select event this frame.

Usually set by the controller input, when the grab button is pressed.

override bool IsActivateEnabled

Gets a value indicating whether this interactor should send activate event this frame.

Usually set by the controller input, when the grab button is pressed.

override float SelectionIntensity

Gets the intensity with which the controller’s selection button is pressed.

override float ActivationIntensity

Gets the intensity with which the controller’s activation button is pressed.

bool IsSelectInputEnabled

Gets a value indicating whether the controller select button is pressed.

bool WasSelectInputEnabledThisFrame

Gets a value indicating whether the controller select button was pressed this frame.

/>

bool WasSelectInputDisabledThisFrame

Gets a value indicating whether the controller select button was released this frame.

bool IsActivateInputEnabled

Gets a value indicating whether the controller activate button is pressed.

bool WasActivateInputEnabledThisFrame

Gets a value indicating whether the controller activate button was pressed this frame.

bool WasActivateInputDisabledThisFrame

Gets a value indicating whether the controller activate button was released this frame.

bool IsUISelectInputEnabled

Gets a value indicating whether the controller button that performs a UI selection is pressed.

bool WasUISelectInputEnabledThisFrame

Gets a value indicating whether the controller button that performs a UI selection was pressed this frame.

bool WasUISelectInputDisabledThisFrame

Gets a value indicating whether the controller button that performs a UI selection was released this frame.

Methods

virtual override bool CanSelect(IInteractable interactable)

Gets if this interactor can send select events to the interactable.

Parameters:

interactable

The interactable to check if this interactor can send the select event to.

Returns:

true if the interactable can be selected by this interactor.

virtual override bool CanActivate(IInteractable interactable)

Gets if this interactor can send activate events to the interactable.

Parameters:

interactable

The interactable to check if this interactor can send the activate event to.

Returns:

true if the interactable can be activated by this interactor.

bool PlayHaptics(float intensity, float duration = 0.1f)

Plays haptics on the controller, if it is supported.

Parameters:

intensity

The intensity of the haptics.

duration

The duration of the haptics.

Returns:

true if haptics are supported and the operation was successful.