interface MAGES::IInteractable

Overview

Interface that should be implemented by all interactable objects. More…

interface IInteractable
{
    // properties

    IInteractionManager InteractionManager;
    Transform Transform;
    Rigidbody Rigidbody;
    Transform AttachTransform;
    List Colliders;
    InteractionMode InteractionMode;
    bool DisableKinematicOnSelectEnter;
    bool EnableKinematicOnSelectExit;
    UnityEvent<InteractableRegisterEventArgs> RegisterEntered;
    UnityEvent<InteractableDeregisterEventArgs> DeregisterEntered;
    UnityEvent<HoverEnterInteractionEventArgs> HoverEntered;
    UnityEvent<HoverExitInteractionEventArgs> HoverExited;
    UnityEvent<HoverEnterInteractionEventArgs> FirstHoverEntered;
    UnityEvent<HoverExitInteractionEventArgs> LastHoverExited;
    UnityEvent<SelectEnterInteractionEventArgs> SelectEntered;
    UnityEvent<SelectExitInteractionEventArgs> SelectExited;
    UnityEvent<SelectEnterInteractionEventArgs> FirstSelectEntered;
    UnityEvent<SelectExitInteractionEventArgs> LastSelectExited;
    UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered;
    UnityEvent<ActivateExitInteractionEventArgs> ActivateExited;
    UnityEvent<ActivateEnterInteractionEventArgs> FirstActivateEntered;
    UnityEvent<ActivateExitInteractionEventArgs> LastActivateExited;
    bool IsHovered;
    bool IsSelected;
    bool IsActivated;
    List<IInteractor> HoveringInteractors;
    List<IInteractor> SelectingInteractors;
    List<IInteractor> ActivatingInteractors;
    IInteractor FirstHoverInteractor;
    IInteractor LastHoverInteractor;
    IInteractor FirstSelectInteractor;
    IInteractor LastSelectInteractor;
    IInteractor FirstActivateInteractor;
    IInteractor LastActivateInteractor;

    // methods

    bool IsHoveredBy(IInteractor interactor);
    bool IsSelectedBy(IInteractor interactor);
    bool IsActivatedBy(IInteractor interactor);
    bool CanBeHovered(IInteractor interactor);
    bool CanBeSelected(IInteractor interactor);
    bool CanBeActivated(IInteractor interactor);
    float GetSelectionIntensity();
    float GetSelectionIntensity(IInteractor interactor);
    float GetActivationIntensity();
    float GetActivationIntensity(IInteractor interactor);
    void OnHoverEnter(HoverEnterInteractionEventArgs args);
    void OnHoverEntered(HoverEnterInteractionEventArgs args);
    void OnHoverExit(HoverExitInteractionEventArgs args);
    void OnHoverExited(HoverExitInteractionEventArgs args);
    void OnSelectEnter(SelectEnterInteractionEventArgs args);
    void OnSelectEntered(SelectEnterInteractionEventArgs args);
    void OnSelectExit(SelectExitInteractionEventArgs args);
    void OnSelectExited(SelectExitInteractionEventArgs args);
    void OnActivateEnter(ActivateEnterInteractionEventArgs args);
    void OnActivateEntered(ActivateEnterInteractionEventArgs args);
    void OnActivateExit(ActivateExitInteractionEventArgs args);
    void OnActivateExited(ActivateExitInteractionEventArgs args);
    void OnRegisterEnter(InteractableRegisterEventArgs args);
    void OnRegisterEntered(InteractableRegisterEventArgs args);
    void OnDeregisterEnter(InteractableDeregisterEventArgs args);
    void OnDeregisterEntered(InteractableDeregisterEventArgs args);
    void ExitHover();
    void ExitHover(IInteractor interactor);
    void ExitSelection();
    void ExitSelection(IInteractor interactor);
    void ExitActivation();
    void ExitActivation(IInteractor interactor);
    void PreprocessInteractable(UpdatePhase updatePhase);
    void ProcessInteractorInput(UpdatePhase updatePhase);
    void ProcessInteractable(UpdatePhase updatePhase);
    bool TryGetAttachPose(IInteractor interactor, out Transform attachPose);
};

// direct descendants

class BaseInteractable;

Detailed Documentation

Interface that should be implemented by all interactable objects.

Properties

IInteractionManager InteractionManager

Gets or sets the interaction manager this interactable is registered with. Null if not registered.

Transform Transform

Gets or sets the transform of this interactable.

Rigidbody Rigidbody

Gets or sets the rigidbody of this interactable.

Transform AttachTransform

Gets the transform this interactable may be attached from when selected. Usually the same as Transform.

List Colliders

Gets The colliders of this interactable.

InteractionMode InteractionMode

Gets or sets the interaction mode of this interactable.

bool DisableKinematicOnSelectEnter

Gets or sets a value indicating whether to disable kinematic before selecting.

The kinematic option will return to the previous value on deselect.

bool EnableKinematicOnSelectExit

Gets or sets a value indicating whether to enable kinematic on detach.

Will force the object to kinematic on detach even if it wasn’t kinematic before grabbing it.

UnityEvent<InteractableRegisterEventArgs> RegisterEntered

Gets or sets the UnityEvent invoked when the interactable is registered to an IInteractionManager.

UnityEvent<InteractableDeregisterEventArgs> DeregisterEntered

Gets or sets the UnityEvent invoked when the interactable is deregistered from an IInteractionManager.

UnityEvent<HoverEnterInteractionEventArgs> HoverEntered

Gets or sets the UnityEvent invoked when an interactor begins hovering this interactable.

UnityEvent<HoverExitInteractionEventArgs> HoverExited

Gets or sets the UnityEvent invoked when an interactor ends hovering this interactable.

UnityEvent<HoverEnterInteractionEventArgs> FirstHoverEntered

Gets or sets the UnityEvent invoked when the first interactor begins hovering this interactable.

This event will not be invoked when there is an interactor hovering this interactable and another interactor begins hovering it.

UnityEvent<HoverExitInteractionEventArgs> LastHoverExited

Gets or sets the UnityEvent invoked when the first interactor begins hovering this interactable.

This event will not be invoked when an interactor stops hovering this interactable but another interactor is still hovering it.

UnityEvent<SelectEnterInteractionEventArgs> SelectEntered

Gets or sets the UnityEvent invoked when an interactor begins selecting this interactable.

UnityEvent<SelectExitInteractionEventArgs> SelectExited

Gets or sets the UnityEvent invoked when an interactor has finished selecting this interactable.

UnityEvent<SelectEnterInteractionEventArgs> FirstSelectEntered

Gets or sets the UnityEvent invoked when the first interactor begins hovring this interactable.

This event will not be invoked when there is an interactor hovering this interactable and another interactor begins selecting it.

UnityEvent<SelectExitInteractionEventArgs> LastSelectExited

Gets or sets the UnityEvent invoked when the first interactor begins hovring this interactable.

This event will not be invoked when an interactor stops selecting this interactable but another interactor is still selecting it.

UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered

Gets or sets the UnityEvent invoked when an interactor has began activation of this interactable.

UnityEvent<ActivateExitInteractionEventArgs> ActivateExited

Gets or sets the UnityEvent invoked when an interactor has ended activation of this interactable.

UnityEvent<ActivateEnterInteractionEventArgs> FirstActivateEntered

Gets or sets the UnityEvent invoked when the first interactor has began activation of this interactable.

This event will not be invoked when an interactor stops activating this interactable but another interactor is still activating it.

UnityEvent<ActivateExitInteractionEventArgs> LastActivateExited

Gets or sets the UnityEvent invoked when the first interactor begins hovring this interactable.

This event will not be invoked when an interactor stops activating this interactable but another interactor is still activating it.

bool IsHovered

Gets a value indicating whether this interactable is currently being hovered by an interactor.

bool IsSelected

Gets a value indicating whether this interactable is currently being selected by an interactor.

bool IsActivated

Gets a value indicating whether this interactable is currently being activated by an interactor.

List<IInteractor> HoveringInteractors

Gets all the interactors hovering this interactable, in the order they sent the hover enter events.

List<IInteractor> SelectingInteractors

Gets all the interactors selecting this interactable, in the order they sent the select enter events.

List<IInteractor> ActivatingInteractors

Gets all the interactors activating this interactable, in the order they sent the activate enter events.

IInteractor FirstHoverInteractor

Gets the interactor which first hovered this interactable.

IInteractor LastHoverInteractor

Gets the interactor which last hovered this interactable.

IInteractor FirstSelectInteractor

Gets the interactor which first selected this interactable.

IInteractor LastSelectInteractor

Gets the interactor which last selected this interactable.

IInteractor FirstActivateInteractor

Gets the interactor which first activated this interactable.

IInteractor LastActivateInteractor

Gets the interactor which last activated this interactable.

Methods

bool IsHoveredBy(IInteractor interactor)

Gets if this interactable is currently being hovered by the specified interactor.

Parameters:

interactor

The interactor to check for hovering.

Returns:

true if the interactable is currently hovered by the interactor.

bool IsSelectedBy(IInteractor interactor)

Gets if this interactable is currently being selected by the specified interactor.

Parameters:

interactor

The interactor to check for selection.

Returns:

true if the interactable is currently selected by the interactor.

bool IsActivatedBy(IInteractor interactor)

Gets if this interactable is currently being activated by the specified interactor.

Parameters:

interactor

The interactor to check for activation.

Returns:

true if the interactable is currently activated by the interactor.

bool CanBeHovered(IInteractor interactor)

Gets if this interactable can be hovered by the specified interactor.

Parameters:

interactor

The interactor to check if this interactable can receive hover events from.

Returns:

true if this interactable can be hovered by the specified interactor.

bool CanBeSelected(IInteractor interactor)

Gets if this interactable can be selected by the specified interactor.

Parameters:

interactor

The interactor to check if this interactable can receive select events from.

Returns:

true if this interactable can be selected by the specified interactor.

bool CanBeActivated(IInteractor interactor)

Gets if this interactable can be activated by the specified interactor.

Parameters:

interactor

The interactor to check if this interactable can receive activate events from.

Returns:

true if this interactable can be activated by the specified interactor.

float GetSelectionIntensity()

Gets the selection intensity from the first interactor that begun selection.

Returns:

A value between 0 and 1 representing the intensity of the selection.

float GetSelectionIntensity(IInteractor interactor)

Gets the selection intensity from the interactor.

Parameters:

interactor

The interactor to get the selection intensity from.

Returns:

An analog value between 0 and 1 representing the intensity of the selection. If the interactor is not selecting this interactable, will return 0.

float GetActivationIntensity()

Gets the activation intensity from the first interactor that begun activation.

Returns:

A value between 0 and 1 representing the intensity of the activation.

float GetActivationIntensity(IInteractor interactor)

Gets the activation intensity from the interactor.

Parameters:

interactor

The interactor to get the activation intensity from.

Returns:

An analog value between 0 and 1 representing the intensity of the activation. If the interactor is not activating this interactable, will return 0.

void OnHoverEnter(HoverEnterInteractionEventArgs args)

Called before an interactor begins hovering this interactable.

Parameters:

args

Hover Event arguments.

void OnHoverEntered(HoverEnterInteractionEventArgs args)

Called after an interactor begins hovering this interactable.

Parameters:

args

Hover Event arguments.

void OnHoverExit(HoverExitInteractionEventArgs args)

Called before an interactor ends hovering this interactable.

Parameters:

args

Hover Event arguments.

void OnHoverExited(HoverExitInteractionEventArgs args)

Called after an interactor ends hovering this interactable.

Parameters:

args

Hover Event arguments.

void OnSelectEnter(SelectEnterInteractionEventArgs args)

Called before an interactor begins selecting this interactable.

Parameters:

args

Select Event arguments.

void OnSelectEntered(SelectEnterInteractionEventArgs args)

Called after an interactor begins selecting this interactable.

Parameters:

args

Select Event arguments.

void OnSelectExit(SelectExitInteractionEventArgs args)

Called before an interactor stops selecting this interactable.

Parameters:

args

Select Event arguments.

void OnSelectExited(SelectExitInteractionEventArgs args)

Called after an interactor stops selecting this interactable.

Parameters:

args

Select Event arguments.

void OnActivateEnter(ActivateEnterInteractionEventArgs args)

Called before an interactor begins activating this interactable.

Parameters:

args

Activate Event arguments.

void OnActivateEntered(ActivateEnterInteractionEventArgs args)

Called after an interactor begins activating this interactable.

Parameters:

args

Activate Event arguments.

void OnActivateExit(ActivateExitInteractionEventArgs args)

Called before an interactor stops activating this interactable.

Parameters:

args

Activate Event arguments.

void OnActivateExited(ActivateExitInteractionEventArgs args)

Called after an interactor stops activating this interactable.

Parameters:

args

Activate Event arguments.

void OnRegisterEnter(InteractableRegisterEventArgs args)

Called before the interactor is registered to an IInteractionManager.

Parameters:

args

The register event arguments.

void OnRegisterEntered(InteractableRegisterEventArgs args)

Called after the interactor is registered to an IInteractionManager.

Parameters:

args

The register event arguments.

void OnDeregisterEnter(InteractableDeregisterEventArgs args)

Called before the interactor is deregistered from an IInteractionManager.

Parameters:

args

The deregister event arguments.

void OnDeregisterEntered(InteractableDeregisterEventArgs args)

Called after the interactor is deregistered from an IInteractionManager.

Parameters:

args

The deregister event arguments.

void ExitHover()

Force stop the hover of this interactable by all interactors.

void ExitHover(IInteractor interactor)

Force stop the hover of this interactable by the interactor.

Parameters:

interactor

The interactor to force stop the hover with.

void ExitSelection()

Force stop the selection of this interactable by all interactors.

void ExitSelection(IInteractor interactor)

Force stop the selection of this interactable by the interactor.

Parameters:

interactor

The interactor to force stop the selection with.

void ExitActivation()

Force stop the activation of this interactable by all interactors.

void ExitActivation(IInteractor interactor)

Force stop the activation of this interactable by the interactor.

Parameters:

interactor

The interactor to force stop the activation with.

void PreprocessInteractable(UpdatePhase updatePhase)

Called by the IInteractionManager before the Interactable is processed by the interaction manager, in the given update phase.

Parameters:

updatePhase

The update phase this method is called.

void ProcessInteractorInput(UpdatePhase updatePhase)

Called by the IInteractionManager before the Interactable is processed by the interaction manager, in the given update phase.

Use this method to process input from interactors, such as grip or trigger strength.

Parameters:

updatePhase

The update phase this method is called.

void ProcessInteractable(UpdatePhase updatePhase)

Called by the InteractionManager after the Interactable is processed by the interaction manager, in the given update phase.

Parameters:

updatePhase

The update phase this method is called.

bool TryGetAttachPose(IInteractor interactor, out Transform attachPose)

Gets the attach pose transform of the given interactor, for this interactable.

Parameters:

interactor

The interactor to get the pose for.

attachPose

The local attach pose of the given interactor, for this interactable.

Returns:

true if the attach pose was successfully obtained.