Skip to content

RaycastInteractor

Namespace: FireSoftworks.Interaction
Assembly: FireSoftworks.Interaction
Type: Class

Implementation of Interactor that uses 3D Raycasting to detect interactable objects. Perfect for first-person or third-person 3D games.

[DefaultExecutionOrder(-10)]
public class RaycastInteractor : InteractorBase, IInteractor

Methods

DetectInteractable()

Performs a raycast from the camera center to detect interactable objects.

protected virtual void DetectInteractable()

Update()

Polls the raycast every frame to update the focused target.

protected virtual void Update()

Fields

interactableMask

LayerMask determining which objects can be interacted with.

public LayerMask interactableMask

interactionRange

[Header("Raycast Settings")]
public float interactionRange

playerCamera

The camera used to determine the raycast origin and direction.

public Camera playerCamera