class MAGES::Interaction::Interactables::BaseInteractable

Overview

Base Interactable. More…

class BaseInteractable:
    public MonoBehaviour,
    public MAGES::IInteractable
{
public:
    // properties

    IInteractionManager InteractionManager;
    Transform Transform;
    Rigidbody Rigidbody;
    List Colliders;
    Transform AttachTransform;
    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 EnableHoverMaterial;
    Material HoverMaterial;
    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);
    virtual bool CanBeHovered(IInteractor interactor);
    virtual bool CanBeSelected(IInteractor interactor);
    virtual bool CanBeActivated(IInteractor interactor);
    void ExitHover();
    void ExitHover(IInteractor interactor);
    void ExitSelection();
    void ExitSelection(IInteractor interactor);
    void ExitActivation();
    void ExitActivation(IInteractor interactor);
    float GetSelectionIntensity();
    float GetSelectionIntensity(IInteractor interactor);
    float GetActivationIntensity();
    float GetActivationIntensity(IInteractor interactor);
    virtual void PreprocessInteractable(UpdatePhase updatePhase);
    virtual void ProcessInteractable(UpdatePhase updatePhase);
    virtual void ProcessInteractorInput(UpdatePhase updatePhase);
    bool TryGetAttachPose(IInteractor interactor, out Transform attachPose);
};

// direct descendants

class Grabbable;

Inherited Members

public:
    // 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);

Detailed Documentation

Base Interactable.

See also:

IInteractable

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.

List Colliders

Gets The colliders of this interactable.

Transform AttachTransform

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

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 EnableHoverMaterial

Gets or sets a value indicating whether a hovering material should be used.

Material HoverMaterial

Gets or sets the HoverMaterial.

If null and EnableHoverMaterial is true then the default hover material assigned in MAGESInteractionSystem.DefaultHoverMaterial will be used.

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.

virtual 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.

virtual 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.

virtual 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.

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.

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.

virtual 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.

virtual 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.

virtual 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.

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.