ULimenInteractionComponent
Overview
ULimenInteractionComponent serves as a base class for defining interaction mechanics, including hover and interact events, as well as interaction-specific logic such as handling line of sight and interaction ranges. It is designed to be replicated across the network and supports both client and server interactions.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| Controller | Public | The controller associated with the interaction component. |
| Pawn | Public | The pawn associated with the interaction component. |
| InteractionParams | Private | Parameters for replication, including controller and pawn. |
| InteractionUpdateData | Private | Data used for replication of interaction updates. |
| bDebugMode | Public | Debug mode flag to enable additional debugging tools or visualizations. |
| InteractionRange | Public | The maximum range within which interactions can occur. |
Functions
Return Type | Signature | Description |
|---|---|---|
| GetLifetimeReplicatedProps(TArray & OutLifetimeProps) const | Registers properties for replication. |
| OnComponentCreated() override | Called when the component is created. |
| BeginPlay() override | Called when the component begins play. |
| TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override | Called every frame to update interaction logic. |
| SetupInteractionParams(AController* Controller, APawn* Pawn) | Sets up interaction parameters with the given controller and pawn. |
| GetInteractionRange() const | Retrieves the current interaction range. |
| SetInteractionRange(const float NewValue) | Sets a new interaction range. |
| DebugMode() const | Checks if debug mode is enabled. |
| RestartInteraction() | Virtual function to restart interaction logic. |
| Interact() | Initiates the interaction logic with the current interactable object. |
| Interact(const AActor* SpecificInteractable) | Attempts to perform an interaction with a specific interactable actor. |
| Interact(ULimenInteractableComponent* SpecificInteractableComponent) | Attempts to perform an interaction with a specified interactable component. |
| StopInteraction() | Stops the current interaction process. |
| GetInteractionController() const | Retrieves the controller associated with the interaction component. |
| GetInteractionPawn() const | Retrieves the pawn associated with the interaction component. |
| GetCurrentInteractableComponent() const | Retrieves the current interactable component. |
| GetOwnerViewPoint(FVector& Start, FVector& End) const | Retrieves the view point start and end vectors for the component's owning actor. |
Usage & Implementation Notes
Threading Constraints: This component is designed to be used on both client and server threads.
Replication Requirements: The
InteractionParamsandInteractionUpdateDataproperties are replicated usingREPLIFETIME_WITH_PARAMS_FAST.Memory Lifetime Management: The component uses weak pointers (
TWeakObjectPtr) for managing the lifetime of interactable components, ensuring that memory is properly managed without causing dangling references.Initialization Dependencies: The component requires a valid owner actor with authority to set up interaction mechanics.