person-rifleBase Character (BP_TFA_BaseCharacter)

Core character blueprint that drives camera, action state, weapon spawning, and notify targets.

Asset path: /Game/InfimaGames/TacticalFPSAnimations/Common/Core/Character/BP_TFA_BaseCharacter

BP_TFA_BaseCharacter is the main playable character used by the demo, and it acts as the central gameplay hub for camera switching, aiming, recoil, weapon ownership, and temporary animation props. Many animation notifies also target this Blueprint directly, so it is the page to check first when you need to understand why an action is blocked, why a prop spawns, or how a camera mode is being driven.


Quick Navigation



Key Dependencies


  • Base Config (BP_TFA_BaseConfig)

    • Assigned to WeaponConfig.

    • Drives meshes, sockets, montages, offsets, and sounds.

  • Base Weapon (BP_TFA_BaseWeapon)

    • Spawned into CurrentWeaponActor.

    • Provides weapon sockets such as the muzzle and gun camera.

  • UI widgets

    • WBP_TFA_Demo for demo warnings and status text.

    • WBP_TFA_BodycamOverlay for bodycam angle text.


Core Responsibilities


  • Spawns and attaches the current weapon through SpawnWeapon.

  • Updates active camera and perspective state through UpdateCameraPerspective and the third-person helpers.

  • Drives procedural pose offsets for ADS, recoil, and crouch through spring interpolation.

  • Enforces action gating with bIsBusy, movement state checks, and ADS block windows.

  • Hosts notify targets for spawning, attaching, destroying, and throwing temporary props.


Key State and Default Values


These defaults matter most when you start customizing demo behaviour or camera feel.

  • Third-person camera distance

    • InitialCameraDistance = 140

    • MinCameraDistance = 65

    • MaxCameraDistance = 270

    • ZoomStep = 50

  • First-person field of view

    • DefaultFOV = 100

    • AimedFOV = 78

  • Action state flags

    • bIsBusy blocks most actions.

    • bIsRunning and bIsSprinting gate ADS, firing, crouch, and jump.

    • bIsAimingBlocked is driven by notify states during ADS lock windows.

  • Procedural transform pairs

    • ADS: TargetAimDownSightsOffsetCurrentAimDownSightsOffset

    • Recoil: TargetRecoilCurrentRecoil

    • Crouch: TargetCrouchOffsetCurrentCrouchOffset


BeginPlay and Setup Hooks


BeginPlayStartScreenFaded

On BeginPlay, the Blueprint starts the camera fully faded by calling Start Camera Fade with FromAlpha = 1, ToAlpha = 1, and bHoldWhenFinished = true. In practice, that means another part of the demo is expected to fade the scene back in later.

InitialSetup

InitialSetup works like a bootstrap helper. It disables input at startup, executes t.MaxFPS 999 and r.ScreenPercentage 100, adds the enhanced input mapping context IMC_TFA_Default, and validates WeaponConfig.FP_Mesh before assigning it to Mesh. If that mesh is invalid, it prints a hard error.

SpawnUI

SpawnUI creates and adds the following widgets to the viewport:

  • WBP_TFA_Demo, stored as WidgetBP

  • WBP_TFA_BodycamOverlay, stored as WidgetBodycamOverlay


Per-Frame Tick Flow


On Event Tick, the Blueprint runs a fixed sequence, and that order matters because it keeps the camera and procedural offsets stable during perspective changes.

  1. SimulateVelocity

  2. ThirdPersonCameraUpdate

  3. SetCapsuleHalfHeight

  4. Procedural Offsets

SimulateVelocity

The demo character is intentionally stuck in place, so this function simulates movement velocity for first-person animation preview. It takes RawInputVector as FVector2D, builds a target direction with Normalize2D, uses speed 100 or 200 depending on bIsRunning, forces Z = 250, and smooths the result into SimulatedVelocity with VInterpTo using InterpSpeed = 15.

ThirdPersonCameraUpdate

When CurrentCameraPerspective == ThirdPerson, this function smoothly interpolates SpringArm.TargetArmLength toward InitialCameraDistance and moves Camera_Pivot_Point toward the weapon attachment socket. That subtle pivot chase is what gives the third-person camera its gentle runtime motion during actions.

SetCapsuleHalfHeight

Despite the function name, this logic adjusts the mesh relative location rather than the capsule itself. In first person it interpolates the mesh location over time, while in other modes it snaps the mesh to Z = -88.

Procedural Offsets

This function updates three spring-driven layers in sequence:

  • Crouch spring: TargetCrouchOffsetCurrentCrouchOffset

  • ADS spring: TargetAimDownSightsOffsetCurrentAimDownSightsOffset

  • Recoil spring and decay: TargetRecoilCurrentRecoil


Weapon Setup


WeaponConfig

WeaponConfig is a BP_TFA_BaseConfig instance, and it is the single source of truth for sockets, meshes, montages, sounds, and offsets. If a weapon setup feels wrong, this data asset is usually the first place worth checking.

SpawnWeapon

SpawnWeapon spawns Base Weapon (BP_TFA_BaseWeapon), stores it in CurrentWeaponActor, passes WeaponConfig into the spawned weapon as CurrentConfig, and attaches the weapon actor to the character mesh at WeaponConfig.SocketGunAttachment.


Camera Perspectives


Camera switching is handled by ToggleCameraPerspective, which cycles the enum, and UpdateCameraPerspective, which applies the selected mode. Supported modes are first person, third person, gun camera, and bodycam using the helmet or chest sockets.

UpdateCameraPerspective

This function updates the bodycam overlay angle text through WidgetBodycamOverlay, then switches on E_TFA_CameraPerspectives and calls the matching Enable... function. When switching back to first person, it also calls StopWeaponAnimation and DestroyAttachedItem, which helps prevent visual leftovers from other perspectives.

EnableFirstPersonPerspective

This mode sets Mesh to WeaponConfig.FP_Mesh, activates Camera_FP, deactivates Camera_TP, assigns ABP_TFA_FP_BaseCharacter, hides the head bone to avoid clipping, disables PP_Bodycam, and removes the muffled submix effect SEF_TFA_Muffled.

EnableThirdPersonPerspective

This mode sets Mesh to WeaponConfig.TP_Mesh, activates Camera_TP, deactivates Camera_FP, assigns ABP_TFA_TP_BaseCharacter, attaches Camera_TP to the SpringArm, sets FOV to 105, unhides the head bone, and removes the muffled submix effect.

EnableGunCameraPerspective

This mode still uses the third-person camera component, but it attaches that camera to CurrentWeaponActor.SK_Receiver at WeaponConfig.SocketGunCamera. It also enables PP_Bodycam, sets FOV to 120, and adds the muffled submix effect.

EnableBodycamPerspective

This mode uses the same lens treatment as gun cam, but it attaches Camera_TP to the character mesh instead. The attachment socket comes from WeaponConfig.SocketHelmetCamera or WeaponConfig.SocketChestCamera, depending on the selected bodycam angle. It also sets FOV to 120 and adds the muffled submix effect.

Third-Person Camera Helpers

When the character is in third person, these helper functions drive the runtime camera behavior:

  • ThirdPersonCameraUpdate for spring arm length and pivot interpolation

  • ThirdPersonCameraLook for pivot rotation and pitch clamp

  • ThirdPersonCameraZoom for camera distance changes

ThirdPersonCameraZoom adjusts InitialCameraDistance by ZoomStep and clamps it to [MinCameraDistance, MaxCameraDistance]. ThirdPersonCameraLook rotates Camera_Pivot_Point, clamps pitch to [-80, 80], and keeps accumulating yaw.


Procedural Pose Offsets


The character uses target transforms plus spring smoothing for ADS, recoil, and crouch:

  • TargetAimDownSightsOffsetCurrentAimDownSightsOffset

  • TargetRecoilCurrentRecoil

  • TargetCrouchOffsetCurrentCrouchOffset

All of this is updated in Procedural Offsets by using CalculateSpring.

Aiming Flow

The aiming graph gates ADS if bIsRunning, bIsSprinting, or bIsAimingBlocked is true. If ADS is allowed, it pulls the target transform from WeaponConfig.OffsetAimDownSights, then runs TL_ADS_FOV to blend Camera_FP.FieldOfView from DefaultFOV to AimedFOV.

When ADS starts, the Blueprint sets bIsAiming = true, applies TargetAimDownSightsOffset, optionally clears crouch offsets to avoid stacking, and plays WeaponConfig.SoundCue_WEP_AimIn through a DoOnce gate. When ADS stops, or when something like ForceStopAiming interrupts it, the Blueprint sets bIsAiming = false, resets ADS offsets to identity, and reapplies WeaponConfig.OffsetCrouch if the character is crouched.

CalculateSpring

CalculateSpring is the core smoothing primitive for crouch, ADS, and recoil. It builds a transform from Vector Spring Interp for location and another Vector Spring Interp for rotation, which is then converted into a rotator. Separate spring state is stored for each layer in SpringCrouch, SpringAimDownSights, and SpringRecoil.


Firing, Fire Modes, Recoil, and VFX


Fire

Firing is gated by !bIsRunning, !bIsSprinting, and !bIsBusy. If firing is allowed, the character plays a synced montage set based on CurrentFireMode. When CurrentFireMode != Safety, it also calls AddRecoil and SpawnMuzzleFlash, then subtracts 1 from CurrentWeaponActor.AmmoCount. In the demo, that integer is used as a visual ammo value for the animated magazine setup rather than a full gameplay ammo system. Safety mode uses the empty or dry-fire montage selection instead.

FireModeSwitch

If the character is not busy, FireModeSwitch cycles Safety → Semi → Auto → Safety, plays the fire-mode switch montage, and calls WidgetBP.ShowFireModeText.

AddRecoil

AddRecoil builds the target transform that later gets spring-smoothed in tick. RecoilRampCount increases with each shot, translation and rotation pull from random ranges plus clamps, and some components scale with Clamp(float(RecoilRampCount), 5..25). In plain terms, recoil ramps up over the first few shots and then caps once the clamp is reached.

Recoil Decay

Every tick, TargetRecoil interpolates back to identity with TInterpTo using InterpSpeed = 22, and DeltaTime is clamped to <= 0.016. That delta clamp helps avoid large recoil jumps during heavy frame hitches.

SpawnMuzzleFlash

The character spawns NS_TFA_MuzzleFlash attached to CurrentWeaponActor.SK_Receiver at WeaponConfig.SocketMuzzle.


Action State and Notify Hooks



Demo Stance Limitations


This Blueprint intentionally limits locomotion features outside first person. That is a demo constraint, and it helps avoid implying full third-person locomotion support where the pack is really focused on animation preview and presentation.

ToggleCrouch

If the character is not in first person, ToggleCrouch calls WidgetBP.ShowThirdPersonWarning and exits. In first person, it still blocks crouch while running or sprinting. When crouch is allowed, it toggles stance by applying WeaponConfig.OffsetCrouch on crouch start and resetting the target transform to identity on stand.

PlayJump

If the character is not in first person, PlayJump shows the third-person warning. Otherwise, jump is allowed only when the stance is standing and the character is not busy, running, or sprinting. When valid, it plays WeaponConfig.FP_JumpFull.


Notify-Driven Functions


ForceStopAiming

This function is called by Block ADS (ANS_TFA_BlockADS) on notify begin. It routes into the aiming logic, sets bIsAiming = false, resets ADS procedural offsets, and relies on the usual start-aim guard clause to keep ADS disabled while bIsAimingBlocked is true. In practice, the begin of ANS_TFA_BlockADS both blocks ADS and forces an immediate exit from it.

ThrowPhysicsObject(...)

This function is called by Throw Physics Object (AN_TFA_ThrowPhysicsObject). At a high level, it spawns the actor class provided by the notify at a socket-derived transform, finds a PrimitiveComponent on the spawned actor, applies linear and angular impulse with bVelChange = true, and optionally destroys previously attached actors that use the DisposableItem tag when bClearSocketItem is true.

circle-info

The notify labels this option as DestroySocketItem, but the actual behavior is broader. It destroys previously attached disposable props rather than a single named socket item.

DestroyAttachedItem

DestroyAttachedItem is not a notify target on its own, but it is called during camera perspective switches. It removes attached actors that carry the DisposableItem tag.

StopWeaponAnimation

StopWeaponAnimation stops the montage currently playing on the weapon’s anim instance and also clears bIsBusy = false.


Tag Conventions


  • DisposableItem

    • Marks temporary spawned or attached props.

    • Used by DestroyAttachedItem and the cleanup path inside ThrowPhysicsObject.


Common Gotchas


  • Bodycam or gun cam looks wrong

    • Verify SocketGunCamera, SocketHelmetCamera, and SocketChestCamera.

    • A bad socket usually looks like the camera is stuck at the origin.

  • ADS offset feels wrong after switching perspectives

    • Make sure your logic calls ForceStopAiming when ADS is blocked.

    • The pack expects ADS to be forcibly exited during certain montage windows.

  • Muzzle flash does not spawn

    • Check that WeaponConfig.SocketMuzzle exists on the receiver skeleton.



Last updated

Was this helpful?