CharacterInteractor

Character component that manages interaction raycasting, interactable detection, highlighting, and interaction triggering. Bridges the character's camera view to the Interaction System.

Definition

Namespace: Paragon.Townskeep.CharacterSystem Assembly: Townskeep.dll

[Serializable]
public class CharacterInteractor : CharacterComponent

Inheritance: ParagonComponent<Character>CharacterComponentCharacterInteractor

Remarks

CharacterInteractor is a serializable component attached to a Character that handles first-person interaction detection. Each tick, it performs a SphereCastNonAlloc from the character's camera position/direction and maintains a reference to the closest Interactable in view.

Key behaviors:

  • Raycasting — Uses a sphere cast with 0.05 radius and configurable Range to detect interactables.

  • Highlighting — Automatically highlights/unhighlights interactables when the character (possessed by a Player) looks at them.

  • Interaction triggering — Delegates to the underlying Interactor component to start interactions with the viewed interactable.

  • Arm rigs — Exposes LeftArmRig and RightArmRig for animation IK during interactions.

Quick Lookup

Goal
How

Try to interact with what's in view

characterInteractor.TryInteractInView(trigger)

Cancel current interaction

characterInteractor.CancelInteraction()

Get the underlying Interactor

characterInteractor.Interactor

Get active interactions

characterInteractor.ActiveInteractions

Check if player-controlled

characterInteractor.HasInputControl()

Properties

Interactor

The underlying Interactor instance that manages active interactions.

ActiveInteractions

All currently active interactions on this character's interactor. Returns null if the interactor is not initialized.

Fields

Field
Type
Description

LeftArmRig

ArmRig

Left arm IK rig for interaction animations

RightArmRig

ArmRig

Right arm IK rig for interaction animations

Range

float

Maximum raycast distance for detecting interactables

Methods

TryInteractInView

Attempts to interact with the interactable currently in the character's view.

Parameter
Type
Description

trigger

InteractionTrigger

The interaction trigger type (e.g., press, hold)

circle-info

Does nothing if no interactable is currently in view. On success, unhighlights the interactable if the character is player-possessed.

CancelInteraction

Cancels the first active interaction on this character.

HasInputControl

Returns whether this character is currently possessed by a Player.

Returns: true if the character is player-possessed.

Lifecycle

Phase
Behavior

OnInitialize()

Allocates raycast hit buffer (size 5), initializes the Interactor with the character's GameObject

Tick(dt)

Performs sphere cast, updates interactable-in-view tracking and highlighting

OnDestroy()

Cancels any active interaction

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated