GRPLInteractable Public class
Description
This is an abstract base class used for Grapple interactables. The derived interactables work seamlessly with the GRPLInteractableManager if all the pure abstract methods are correctly implemented. This class provides events and methods for detecting proximity and interaction with the interactable object.
Diagram
flowchart LR
classDef interfaceStyle stroke-dasharray: 5 5;
classDef abstractStyle stroke-width:4px
subgraph Rhinox.XR.Grapple.It
Rhinox.XR.Grapple.It.GRPLInteractable[[GRPLInteractable]]
class Rhinox.XR.Grapple.It.GRPLInteractable abstractStyle;
end
subgraph UnityEngine
UnityEngine.MonoBehaviour[[MonoBehaviour]]
end
UnityEngine.MonoBehaviour --> Rhinox.XR.Grapple.It.GRPLInteractable
Members
Properties
Public properties
Type | Name | Methods |
---|---|---|
XRHandJointID | ProximateJointID A read-only property that returns _proximateJointID. | get |
float | ProximateRadius A read-only property that returns _proximateRadius. | get |
bool | ShouldPerformInteractCheck A boolean that determines whether interaction checks should be performed. | get, set |
GRPLInteractionState | State A read-only property that returns the current state of the interactable object. | get |
Methods
Protected methods
Returns | Name |
---|---|
void | Destroyed ()A virtual method that can be overridden in derived classes to perform tasks when the interactable object is destroyed. |
void | Initialize ()A virtual method that can be overridden in derived classes to perform initialization tasks. |
void | InteractStarted ()Invokes the OnInteractStarted event. |
void | InteractStopped ()Invokes the OnInteractEnded event. |
void | OnDestroy ()Invokes the InteractableDestroyed event and calls the Destroyed methods. |
void | OnDisable ()Sets the state of this interactable to disabled. |
void | OnDrawGizmos () |
void | OnEnable ()Sets the state of this interactable to active. |
void | ProximityStarted ()Invokes the OnProximityStarted event. |
void | ProximityStopped ()Invokes the OnProximityStopped event. |
void | Start ()Calls the Initialize method and invoke the InteractableCreated event. |
Public methods
Returns | Name |
---|---|
bool | CheckForInteraction (RhinoxJoint joint, RhinoxHand hand)Check whether the given joint activates the interaction for this interactable. |
Transform | GetReferenceTransform ()Returns the reference transform for this interactible. This can be used for proximate interaction checking. |
void | SetState (GRPLInteractionState newState)Sets the new state for this interactable object and invokes the according events. |
bool | ShouldInteractionCheckStop ()Check, when currently interacting. If the interaction should not get checked anymore. I.e. When the previous interact joint is now behind the button press object. |
bool | TryGetCurrentInteractJoint (ICollection <RhinoxJoint > joints, out RhinoxJoint outJoint, RhinoxHand hand) |
Details
Summary
This is an abstract base class used for Grapple interactables. The derived interactables work seamlessly with the GRPLInteractableManager if all the pure abstract methods are correctly implemented. This class provides events and methods for detecting proximity and interaction with the interactable object.
Remarks
The GRPLInteractable.Start and GRPLInteractable.OnDestroy should NOT be overwritten. Use GRPLInteractable.Initialize GRPLInteractable.Destroyed respectively instead.
Inheritance
MonoBehaviour
Constructors
GRPLInteractable
protected GRPLInteractable()
Methods
Start
protected virtual void Start()
Summary
Calls the Initialize method and invoke the InteractableCreated event.
OnDestroy
protected virtual void OnDestroy()
Summary
Invokes the InteractableDestroyed event and calls the Destroyed methods.
Initialize
protected virtual void Initialize()
Summary
A virtual method that can be overridden in derived classes to perform initialization tasks.
Destroyed
protected virtual void Destroyed()
Summary
A virtual method that can be overridden in derived classes to perform tasks when the interactable object is destroyed.
OnEnable
protected virtual void OnEnable()
Summary
Sets the state of this interactable to active.
OnDisable
protected virtual void OnDisable()
Summary
Sets the state of this interactable to disabled.
SetState
public void SetState(GRPLInteractionState newState)
Arguments
Type | Name | Description |
---|---|---|
GRPLInteractionState | newState | The new state for the interactable object. |
Summary
Sets the new state for this interactable object and invokes the according events.
Remarks
Return early if the newState equals the current state of the interactable object.
InteractStarted
protected virtual void InteractStarted()
Summary
Invokes the OnInteractStarted event.
InteractStopped
protected virtual void InteractStopped()
Summary
Invokes the OnInteractEnded event.
ProximityStarted
protected virtual void ProximityStarted()
Summary
Invokes the OnProximityStarted event.
ProximityStopped
protected virtual void ProximityStopped()
Summary
Invokes the OnProximityStopped event.
ShouldInteractionCheckStop
public virtual bool ShouldInteractionCheckStop()
Summary
Check, when currently interacting. If the interaction should not get checked anymore. I.e. When the previous interact joint is now behind the button press object.
GetReferenceTransform
public virtual Transform GetReferenceTransform()
Summary
Returns the reference transform for this interactible. This can be used for proximate interaction checking.
Returns
The reference transform.
CheckForInteraction
public abstract bool CheckForInteraction(RhinoxJoint joint, RhinoxHand hand)
Arguments
Type | Name | Description |
---|---|---|
RhinoxJoint | joint | The joint to check with. |
RhinoxHand | hand | The hand that the joint is from. |
Summary
Check whether the given joint activates the interaction for this interactable.
Returns
Whether the interaction is now happening.
TryGetCurrentInteractJoint
public abstract bool TryGetCurrentInteractJoint(ICollection<RhinoxJoint> joints, out RhinoxJoint outJoint, RhinoxHand hand)
Arguments
Type | Name | Description |
---|---|---|
ICollection <RhinoxJoint > | joints | |
out RhinoxJoint | outJoint | |
RhinoxHand | hand |
OnDrawGizmos
protected virtual void OnDrawGizmos()
Properties
ProximateJointID
public XRHandJointID ProximateJointID { get; }
Summary
A read-only property that returns _proximateJointID.
ProximateRadius
public float ProximateRadius { get; }
Summary
A read-only property that returns _proximateRadius.
State
public GRPLInteractionState State { get; }
Summary
A read-only property that returns the current state of the interactable object.
ShouldPerformInteractCheck
public bool ShouldPerformInteractCheck { get; set; }
Summary
A boolean that determines whether interaction checks should be performed.
Events
OnInteractStarted
public event Action<GRPLInteractable> OnInteractStarted
Summary
An event that is invoked when interaction with the interactable object starts.
OnInteractEnded
public event Action<GRPLInteractable> OnInteractEnded
Summary
An event that is invoked when interaction with the interactable object ends.
OnProximityStarted
public event Action<GRPLInteractable> OnProximityStarted
Summary
An event that is invoked when the user is close enough to the interactable object for proximity detection.
OnProximityEnded
public event Action<GRPLInteractable> OnProximityEnded
Summary
An event that is invoked when the user is no longer close enough to the interactable object for proximity detection.
Delegates
InteractableEvent
public delegate void InteractableEvent(GRPLInteractable grappleInteractable)
Arguments
Type | Name | Description |
---|---|---|
GRPLInteractable | grappleInteractable |
Generated with ModularDoc