InteractCore is a lightweight and extensible interaction framework designed for game development.
InteractCore is built around a simple idea:
"Everything that can be interacted with implements a common interface
(Interactable)and communicates through a central interaction system.”
-
UInteractionComponent: Is the main component for interaction (Input,Pivot)UDefaultInteraction: Handel Optimization for raycastUCameraInteraction:Handel Trace from camera for FPS gameUProximityInteraction: Handel trace and hovering with sphere for TPS gameUMouseInteraction: Handel trace from camera compatible with mouse for Isometric/TopDown game
-
UInteractableComponent: Is the Sphere collider for InteractionUInteractableDetection: Handel another sphere for detection befor hoverUInteractablePoint: Handel Indicator for Show Widget
-
IInteractable: Base Interface for interaction indclude (hover,unhover,interact,ShouldHandleInput)
classDiagram
UInteractionComponent <|-- UDefaultInteraction
UDefaultInteraction <|-- UCameraInteraction
UDefaultInteraction <|-- UMouseInteraction
UDefaultInteraction <|-- UProximityInteraction
class UInteractionComponent{
+EInteractionSearchMode DetectionMode
+bool bInteractionInputBound
+UInputAction InteractionInput
+GetMode()
+GetCurrentInteractable()
GetPivot()
+SetPivotToComponent()
+SetPivotToTransform()
+SetInteractionActive(bool bEnable)
}
class UDefaultInteraction{
+bool DynamicInterval
+EInteractionAdaptiveTickTrigger AdaptiveTickMode
+float FastTickRate
+float SlowTickRate
+float RotationThreshold
+float PositionThreshold
+float VelocityThreshold
+float MouseMovementThreshold
+float ThresholdCustom
+CustomAdaptiveTick()
+CanHover()
+CanInteract()
}
class UCameraInteraction{
+EInteractionTraceType TraceType
+FVector Offcet
+float TraceDistance
+TEnumAsByte<ECollisionChannel> TraceChannel
+EInteractionTraceAxis TraceAxis
+TArray<float> SphereFallback
+bool bDrawDebugTrace
+FColor DebugHitColor
+FColor DebugNoHitColor
}
class UMouseInteraction{
+float TraceDistance
+TEnumAsByte<ECollisionChannel> TraceChannel
+bool bDrawDebug
+FColor DebugColor
}
class UProximityInteraction{
+USphereComponent *DetectionSphere
+FVector Offcet
+TArray<FHitResult> CandidateHits
+bool UseInputForHovering
+UInputAction *HoverInput
}
classDiagram
UInteractableComponent <|-- UInteractableDetection
UInteractableDetection <|-- UInteractablePoint
class UInteractableComponent{
+FOnInteractionEvent OnHoverBegin
+FOnInteractionEvent OnHoverEnd
+FOnInteractionEvent OnInteract
+bool EnableInteraction
+TEnumAsByte<ECollisionChannel> InteractChannel
+EInteractionUsageMode InteractMode
+float CooldowDuration
+EInteractionInputMode InputMode
+float HoldTimeThreshold
+float DoubleTapInterval
+bool IsHovered()
+bool IsEnableInteraction()
+bool HasInteracted()
+bool IsInteractionPending()
+void SetEnableInteraction(bool Enable)
+void ResetInteraction()
+bool IsAllowedInteraction()
+bool IsAllowedInteraction_Implementation()
}
class UInteractableDetection{
+FOnInteractionEvent OnZoneBegin
+FOnInteractionEvent OnZoneEnd
+USphereComponent *DetectionComponent
+FVector DetectionOffset
+float DetectionRadius
+TEnumAsByte<ECollisionEnabled::Type> DetectionCollision
+TEnumAsByte<ECollisionChannel> DetectionObjectType
+FCollisionProfileName DetectionProfile
+bool bFirstCheck
+TEnumAsByte<ECollisionChannel> DetectionChannel
+bool bDynamicRadius
+float DistanceThreshold
+FVector2D RadiusRange
+bool bToggleRadius
+float ToggleRadius
+UInteractionComponent *GetCurrentDetected()
+bool IsDetected()
+void K2_ApplyZoneSettings()
+void FirstCheck()
}
class UInteractablePoint{
+TSubclassOf<UInteractionIndicatorWidget> IndicatorClass
+EWidgetSpace WidgetSpace
+EWidgetBlendMode WidgetBlendMode
+FVector2D WidgetDrawSize
+FVector WidgetOffset
+bool bCheckLineOfSight
+TEnumAsByte<ECollisionChannel> SightChannel
+bool bShowDebugSight
+void K2_ApplyWidgetSettings()
+UInteractionIndicatorWidget *GetIndicator()
+bool CanSeeDetectedObject()
}
- Interaction include
DetectionModeto define after raycast check implementation interface in component or actor or both - Interaction include Settting part that define positon and direction and raycast type
- Optimazation part for performace manageing by other paramter for tracing
- Interaction just compatible with Unreal Inhance Input Systme
- Interactable include Dynamic Raduis that lerp sphere raduis by player distance
- Interactable include ToogleDetection that use for change detection raduis after player overlap
- Interactable component incdule predefina some type of interaction type (tap,hover,doubletap)
- Interactable after detection can sight to agent for hide indicator if agent was behind wall
- Basic Indicator with all of type interaction define as widget in plugin
- Add
UCameraInteractionin your player and set interaction input asset - In any actor you want player interact with that you can do
A. Implement
IInteractableInterface B. AddUInteractablePointcomponent in your actor and add Your Widget or plugin default widget to show indicator after that you shouw use Events in your actor
IInteractableinclude important function that need for interaction
ShouldHandleInputthis function get input and return bool if true agent can interact you can control input type in that like holding , double_tap ...