Instant and hold-to-interact actions
Tool requirements (e.g., requires pickaxe)
Optional interaction animations
Foliage interaction support (for foliage-based resources)
Important:
InteractionComponentgoes on the Player Controller, not the Character.
Blueprint Setup
Open your Player Controller Blueprint
Add Component → Interaction Component
Configure properties, for example:
Trace Distance: 500 (cm)
bUseSphereTrace: true
SphereTraceRadius: 20
bDrawDebugTrace: false
You can expose these as variables if you want per-controller tuning.
C++ Setup
// In PlayerController.h
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
UInteractionComponent* InteractionComponent;
// In PlayerController.cpp constructor
AMyPlayerController::AMyPlayerController()
{
InteractionComponent = CreateDefaultSubobject<UInteractionComponent>(TEXT("InteractionComponent"));
InteractionComponent->TraceDistance = 500.0f;
InteractionComponent->bUseSphereTrace = true;
InteractionComponent->SphereTraceRadius = 20.0f;
}Use sphere traces over pure line traces for friendlier targeting.
Always show clear prompts (“Press E to Pick Up”, “Hold E to Harvest”).
Enforce range and line-of-sight to avoid weird interactions.
Use hold interactions for harvesting and longer actions.
Add animations and progress bars for good feedback.
Make all important interactions server RPCs.
Use tool requirements to gate advanced resources (pickaxe, axe, etc.).
Test at different FOVs and distances to ensure comfortable interaction.