# Grapple (v1.4.0) - Detailed API Reference

By **Twikia Studios** · UE 5.5 - 5.8 · Tested Platform: `Win64` · Single-Player Only (Not Network Replicated)

## Dependencies & Module Setup

- **Required Engine Plugin:** `EnhancedInput` (declared enabled in `Grapple.uplugin`; no Niagara or third-party dependencies required).
- **Runtime Module:** `GrappleRuntime` (`PublicDependencyModuleNames.Add("GrappleRuntime");`)
- **Runtime Module:** `GrappleRuntime` (`Core`, `CoreUObject`, `Engine`, `InputCore`, `EnhancedInput`, `UMG`).

## 1. Architecture & Feature Breakdown

### Architecture & Core Systems

Grapple is split into three focused runtime building blocks: UGrappleComponent (state machine, aim raycasts, exponential pull and WASD perpendicular swing forces, auto-release distance, duration timer, cooldown timer, and bGrappleAllowed runtime permission gate), UGrappleCameraFXComponent (additive FOV widening and lateral camera roll toward the tether via named camera FX layers), and AGrappleSplineActor (procedural sagging rope spline and hook mesh).

Enhanced Input bindings are optional: assign InputMappingContext and IA_Grapple on UGrappleComponent for zero-graph input handling, or leave IA_Grapple unset and drive TryEnterGrapple() and ExitGrapple() directly from custom Blueprint or C++ handlers.

### Physics, Framerate Independence & Contracts

All pull and swing impulses pass through VectorFrameRateCorrection(BaseImpulse, DeltaTime), normalizing movement to a 60 FPS reference step so swing arcs and pull distances remain identical across 30, 60, 120, and 240 FPS.

Custom pawns or rope actors can implement IGrappleCharacterContract, IGrappleSplineContract, and IGrappleListener to override view origin, aim direction, anchor socket location, or react to attach/detach events without subclassing.

## 2. Classes, Components & Subsystems

| Class | Inherits From | Header | Description |
| --- | --- | --- | --- |
| UGrappleCameraModifier | public UCameraModifier | GrappleCameraFXComponent.h | Camera modifier that applies additive Grapple camera FX from UGrappleCameraFXComponent. |
| UGrappleCameraFXComponent | public UActorComponent, public IGrappleListener | GrappleCameraFXComponent.h | Additive camera roll and FOV layers while grappling, applied via UGrappleCameraModifier without writing the camera component. |
| UGrappleComponent | public UActorComponent | GrappleComponent.h | Standalone first-person grapple state, physics-inspired pull/swing, auto-release, and cooldown component for ACharacter owners. |
| AGrappleSplineActor | public AActor, public IGrappleSplineContract | GrappleSplineActor.h | Procedural sagging rope tether and hook actor implementing IGrappleSplineContract for UGrappleComponent. |

## 3. Complete Details Panel Configuration & Properties

| Owner | Property | Type | Category | Default | Description |
| --- | --- | --- | --- | --- | --- |
| FGrappleCameraFXOffset | FOVDegrees | float | Grapple\|CameraFX | 0.0f | Degrees added on top of the camera's current field of view. |
| FGrappleCameraFXOffset | RollDegrees | float | Grapple\|CameraFX | 0.0f | Degrees of roll added about the view forward axis on top of the current camera rotation. |
| UGrappleCameraFXComponent | GrappleFOVOffset | float | Configs | 10.0f | Additive field-of-view offset in degrees applied on top of the camera's current FOV while grappling. |
| UGrappleCameraFXComponent | FOVEnterSpeed | float | Configs | 8.0f | Interpolation speed used to blend grapple layer FOV toward GrappleFOVOffset on attach. |
| UGrappleCameraFXComponent | FOVExitSpeed | float | Configs | 6.0f | Interpolation speed used to blend grapple layer FOV back to zero after detaching. |
| UGrappleCameraFXComponent | MaxCameraRollDegrees | float | Configs | 12.0f | Maximum additive camera roll in degrees when swinging laterally relative to the grapple anchor. |
| UGrappleCameraFXComponent | RollInterpSpeed | float | Configs | 8.0f | Interpolation speed used to blend grapple layer roll during and after a grapple swing. |
| UGrappleCameraFXComponent | BlendSpeed | float | Configs | 8.0f | Interpolation speed used to blend custom named camera FX layers toward their targets. |
| UGrappleCameraFXComponent | CurrentGrappleRoll | float | State | 0.0f | Current blended additive roll in degrees on the reserved Grapple layer (for HUD readback). |
| UGrappleCameraFXComponent | CachedCamera | TWeakObjectPtr<UCameraComponent> | General | - | Configures cached camera under General. |
| UGrappleComponent | GrappleLength | float | Configs | 7000.0f | Maximum raycast distance in centimeters (cm) that the grapple can reach and latch onto geometry. |
| UGrappleComponent | GrappleDuration | float | Configs | 2.0f | Maximum time in seconds that a single grapple tether can remain active before automatically detaching. |
| UGrappleComponent | GrappleStrengthMultiplier | float | Configs | 1.0f | Global multiplier applied to both radial pull and pendulum swing forces (1.0 = default baseline strength). |
| UGrappleComponent | SwingingStrength | float | Configs\|Tuning | 15.0f | Lateral acceleration strength applied when steering mid-air with WASD perpendicular to the tether line. |
| UGrappleComponent | PullStrength | float | Configs\|Tuning | 8.0f | Radial pull acceleration strength applied toward the anchor point while tethered. |
| UGrappleComponent | Cooldown | float | Configs | 2.5f | Cooldown duration in seconds after detaching before the grapple can be fired again. |
| UGrappleComponent | StopDistance | float | Configs | 250.0f | Distance threshold in centimeters (cm) from the anchor point at which the grapple automatically detaches on arrival. |
| UGrappleComponent | bGrappleAllowed | bool | Configs | true | Runtime permission gate controlling whether TryEnterGrapple and TrySetGrapple are allowed to acquire an anchor. Set to false cleanly via SetGrappleAllowed to block grappling during stamina depletion, hitstun, or scripted zones. |
| UGrappleComponent | TraceChannel | TEnumAsByte<ECollisionChannel> | Configs | ECC_Visibility | Collision trace channel used by TrySetGrapple when raycasting for valid anchor surfaces. Change this to a custom Grapple trace channel (configured in Project Settings > Engine > Collision) so specific walls, glass, or non-grapple surfaces set to Ignore do not respond to grapple traces. |
| UGrappleComponent | InputMappingContext | TObjectPtr<UInputMappingContext> | Configs\|Input | - | Enhanced Input Mapping Context automatically registered on the local player when IA_Grapple is assigned. |
| UGrappleComponent | IA_Grapple | TObjectPtr<UInputAction> | Configs\|Input | - | Enhanced Input Action bound automatically for hold-to-grapple (Triggered/Started enters, Completed/Canceled exits). Leave unset to drive TryEnterGrapple/ExitGrapple manually. |
| UGrappleComponent | InputMappingPriority | int32 | Configs\|Input | 1 | Priority level used when adding InputMappingContext to UEnhancedInputLocalPlayerSubsystem. |
| AGrappleSplineActor | AnchorOrigin | TObjectPtr<USceneComponent> | Components | - | Root scene component representing the character-side rope attachment origin. |
| AGrappleSplineActor | SplineMesh | TObjectPtr<USplineMeshComponent> | Components | - | Spline mesh component stretched from the character anchor to the grapple target point. |
| AGrappleSplineActor | HookMesh | TObjectPtr<UStaticMeshComponent> | Components | - | Hook static mesh positioned at the world-space grapple impact point. |
| AGrappleSplineActor | ChainMeshAsset | TSoftObjectPtr<UStaticMesh> | Configs | - | Soft reference to the static mesh used along the rope spline body. |
| AGrappleSplineActor | HookMeshAsset | TSoftObjectPtr<UStaticMesh> | Configs | - | Soft reference to the static mesh placed at the anchor end of the rope. |
| AGrappleSplineActor | Thickness | FVector2D | Configs | FVector2D(0.075f, 0.075f) | Cross-section scale (width, height) applied to the spline mesh segments. |
| AGrappleSplineActor | VelocityStiffness | float | Configs | -0.0006f | Multiplier controlling how much player velocity pulls the rope taut and reduces mid-air slack. |
| AGrappleSplineActor | Gravity | FVector | Configs | FVector(0.0f, 0.0f, -2.0f) | Gravity direction vector applied to the rope midpoint sag calculation. |
| AGrappleSplineActor | Heaviness | float | Configs | 150.0f | Rope weight multiplier controlling the vertical sag magnitude along the tether. |
| AGrappleSplineActor | bSplineVisible | bool | State | false | True while the grapple spline and hook meshes are visible during an active grapple. |
| AGrappleSplineActor | CurrentTargetWorld | FVector | State | FVector::ZeroVector | Current world-space target location of the grapple hook tip. |

## 4. Complete Methods & Functions Reference

| Owner | Method | Specifiers | Inputs / Outputs | Functionality |
| --- | --- | --- | --- | --- |
| UGrappleCameraFXComponent | BindCameraReferences | BlueprintCallable | In: UCameraComponent* InCamera<br>In: USceneComponent* InRotationTarget = nullptr | Explicitly binds a camera component for view-target checks when the owner uses multiple cameras or non-standard rigs. |
| UGrappleCameraFXComponent | SetCameraFXLayer | BlueprintCallable | In: FName LayerId<br>In: const FGrappleCameraFXOffset& TargetOffset | Sets or updates a named custom camera FX layer that blends toward the target additive offset. |
| UGrappleCameraFXComponent | RemoveCameraFXLayer | BlueprintCallable | In: FName LayerId | Blends a custom layer's target to zero and removes it once settled. |
| UGrappleCameraFXComponent | ResetCameraFX | BlueprintCallable | None | Sets every layer target to zero and removes custom layers once settled. |
| UGrappleCameraFXComponent | GetCameraFXLayerOffset | BlueprintPure | In: FName LayerId<br>Return: FGrappleCameraFXOffset | Returns the current blended additive offset for a layer (zero if unknown). |
| UGrappleCameraFXComponent | GetTotalCameraFXOffset | BlueprintPure | Return: FGrappleCameraFXOffset | Sum of every layer's current blended additive offset (what the modifier applies on top of the view). |
| UGrappleCameraFXComponent | GetCurrentRollDegrees | BlueprintPure | Return: float | Returns the current total additive roll in degrees across all layers. |
| UGrappleCameraFXComponent | GetCurrentFOV | BlueprintPure | Return: float | Returns the camera's current FOV plus total additive FOV offset in degrees (does not read a written grapple FOV). |
| UGrappleComponent | TrySetGrapple | BlueprintCallable | Out: FVector &OutImpactPoint<br>Return: bool | Performs a single line trace along the owner's view direction up to GrappleLength (cm) and outputs the world hit location if valid geometry is found. |
| UGrappleComponent | TryEnterGrapple | BlueprintCallable | Return: bool | Attempts to fire the grapple along the view ray, attach to the hit point, show the registered spline tether, and start the max duration timer. |
| UGrappleComponent | ExitGrapple | BlueprintCallable | None | Detaches the active grapple tether, hides the spline actor, broadcasts OnGrappleExited / OnGrappleStateChanged, and starts the cooldown timer. |
| UGrappleComponent | ComputeGrappleForceSwing | BlueprintCallable | Out: FVector &OutNormalizedSwing<br>Return: FVector | Computes the perpendicular pendulum swing force vector from the player's WASD input relative to the anchor vector and outputs the normalized swing direction. |
| UGrappleComponent | ComputeGrappleForceTowardAnchor | BlueprintCallable | Return: FVector | Computes the radial pull force vector directed toward the active grapple anchor point scaled by PullStrength and GrappleStrengthMultiplier. |
| UGrappleComponent | VectorFrameRateCorrection | BlueprintPure | In: const FVector &BaseImpulse<br>In: float DeltaTime<br>Return: FVector | Scales a base impulse vector by DeltaTime relative to a 60 FPS reference step so grapple pull and swing distances stay consistent across framerates. |
| UGrappleComponent | SetSplineActor | BlueprintCallable | In: AActor *InSplineActor | Registers an AGrappleSplineActor (or any actor implementing IGrappleSplineContract) to render and update the procedural rope tether during active grapples. |
| UGrappleComponent | SetGrappleAllowed | BlueprintCallable | In: bool bAllowed | Enables or disables grapple permission at runtime; detaches an active grapple immediately when set to false. |
| UGrappleComponent | IsGrappleAllowed | BlueprintPure | Return: bool | Returns true when grappling is currently permitted by the bGrappleAllowed gate. |
| UGrappleComponent | IsGrappling | BlueprintPure | Return: bool | Returns true while the player is actively tethered to a grapple point. |
| UGrappleComponent | IsOnCooldown | BlueprintPure | Return: bool | Returns true while the grapple is on cooldown after detaching and cannot be re-entered. |
| UGrappleComponent | GetCooldownRemainingRatio | BlueprintPure | Return: float | Returns the normalized [0..1] cooldown remaining ratio (1.0 when just exited, 0.0 when ready to fire) for HUD meters and crosshair feedback. |
| UGrappleComponent | GetGrapplePoint | BlueprintPure | Return: FVector | Returns the world-space coordinates of the current (or most recent) grapple anchor point. |
| AGrappleSplineActor | CalculateSpline | BlueprintCallable | In: const FVector& TargetLocationInLocalSpace<br>In: const FVector& PlayerVelocityLocal | Recomputes spline start/end tangents and hook orientation in local space using the target offset and player velocity. |

## 5. Complete Event Delegates & Callbacks

| Owner | Delegate | Signature / Parameters | Description |
| --- | --- | --- | --- |
| UGrappleCameraFXComponent | OnCameraFXLayerChanged | FName, LayerId, const FGrappleCameraFXOffset&, TargetOffset | Broadcast when a layer's target offset is set or cleared (including the built-in Grapple layer). |
| UGrappleCameraFXComponent | OnCameraFXReset | void | Broadcast when ResetCameraFX targets all layers to zero. |
| UGrappleComponent | OnGrappleStateChanged | bool, bIsGrappling | Broadcasts true when a grapple attaches and false when it detaches. |
| UGrappleComponent | OnGrappleEntered | const FVector &, GrapplePoint | Broadcasts the world-space anchor point immediately when a grapple attaches. |
| UGrappleComponent | OnGrappleExited | float, CooldownDuration | Broadcasts the active Cooldown duration in seconds when a grapple detaches. |

## Blueprint & C++ Interfaces

| Interface | Method | Specifiers | Inputs / Outputs | Functionality |
| --- | --- | --- | --- | --- |
| IGrappleCharacterContract | GetGrappleViewLocation | BlueprintCallable, BlueprintNativeEvent | Return: FVector | Returns the world-space eye/camera origin from which grapple traces are cast. |
| IGrappleCharacterContract | GetGrappleViewForward | BlueprintCallable, BlueprintNativeEvent | Return: FVector | Returns the normalized world-space forward aim vector for grapple traces. |
| IGrappleCharacterContract | GetGrappleRightVector | BlueprintCallable, BlueprintNativeEvent | Return: FVector | Returns the normalized world-space right vector used to compute perpendicular swing forces. |
| IGrappleCharacterContract | GetGrappleMoveInput | BlueprintCallable, BlueprintNativeEvent | Return: FVector2D | Returns the 2D horizontal movement input (X = right, Y = forward) used for mid-air swing steering. |
| IGrappleCharacterContract | GetGrappleAnchorOrigin | BlueprintCallable, BlueprintNativeEvent | Return: FVector | Returns the world-space origin where the grapple tether attaches on the character (e.g., hand or launcher socket). |
| IGrappleSplineContract | ShowSpline | BlueprintCallable, BlueprintNativeEvent | In: const FVector &HitLocation | Shows the grapple rope/spline and snaps its endpoint to the world hit location. |
| IGrappleSplineContract | HideSpline | BlueprintCallable, BlueprintNativeEvent | None | Hides the grapple rope/spline when the grapple detaches. |
| IGrappleSplineContract | UpdateSplineTarget | BlueprintCallable, BlueprintNativeEvent | In: const FVector &TargetPositionWorld<br>In: const FVector &PlayerVelocity | Updates the spline endpoint and mid-air sag curvature each tick using the target world position and player velocity. |
| IGrappleListener | OnGrappleEntered | BlueprintCallable, BlueprintNativeEvent | In: const FVector &GrapplePoint | Called when a grapple attaches to the specified world-space anchor point. |
| IGrappleListener | OnGrappleExited | BlueprintCallable, BlueprintNativeEvent | In: float CooldownDuration | Called when a grapple detaches and begins its cooldown period. |

## Structs

| Struct | Header | Description |
| --- | --- | --- |
| FGrappleCameraFXOffset | GrappleCameraFXComponent.h | Additive FOV and roll offsets applied on top of the active camera view (degrees). |
