Skip to main content

Blueprint Reference

Every class in the plugin, with its editable properties and the functions meant for you. Each C++ class has a Blueprint child that the example content uses; edit the Blueprint children or make your own.

C++ classBlueprint childFolder
ATurretPawnB_TurretPawn, B_TurretPawn2Turret
ATurretAIControllerB_TurretAIControllerTurret
ATurretPlasmaProjectileB_TurretProjectileTurret
ATeamPlayerControllerB_TeamPlayerControllerExamples/Blueprints

ATurretPawn​

The turret: mesh, firing, effects and team. Implements IGenericTeamAgentInterface. Components: TurretSceneComponent (root) and MeshComponent (skeletal mesh).

B_TurretPawn is the dual-barrel turret with SKM_Turret and ABP_Turret. B_TurretPawn2 is the single-barrel turret with SKM_Turret_Single_HighPoly and ABP_Turret2.

PropertyDisplay nameDefaultDescription
TeamIDTeam ID255 (no team)Team of the turret
VelocityScaleProjectile Velocity1000Projectile speed in cm/s
bDualBarrelDual BarrelfalseFire from both barrels
DualBarrelShootDelayDual Barrel Shoot Delay0.2Seconds before the second barrel fires
ProjectileClassProjectile ClassATurretPlasmaProjectileProjectile to spawn
Name_SocketMuzzleMuzzle SocketmuzzleMuzzle of a single-barrel turret
Name_SocketMuzzleLeft, Name_SocketMuzzleRightLeft / Right Muzzle Socketmuzzle_left, muzzle_rightMuzzles of a dual-barrel turret
ShootSound, ResetTurretSoundSounds for a shot and for the reset
MuzzleFlashEffect, ProjectileEffectNiagara systems for the muzzle flash and the projectile trail
TurretRotationAim of the head relative to the base. Set by the controller, replicated; drives the Animation Blueprint

Defaults are those of the C++ class; the Blueprint children override some of them.

Function or eventDescription
OnProjectileImpactEvent: one of this turret's projectiles hit something. Not implemented by default: implement it to deal damage
SpawnShootFXShot sound and muzzle flash. Override for custom effects
ResetTurretCalled by the controller when it gives up its target. Turns the head back and plays the reset sound
GetSocketLocationFromMeshWorld location of a socket on the mesh. Override for meshes without sockets
GetMuzzleLocation, GetMuzzleLocationLeft, GetMuzzleLocationRightWorld locations of the muzzle sockets

ATurretAIController​

Sees with its AIPerception component (sight sense), picks a hostile target, leads it and makes the turret fire. When it loses the target it switches to another perceived hostile, or resets the turret after TrackingTimeout.

PropertyDefaultDescription
TrackingTimeout3.0Seconds without the target in sight before the turret resets
TrackPlayerTimerRate0.1Seconds between aim updates
ShootProjectileTimerRate0.7Seconds between shots
TrackingActivetrueTrack targets
ShootingActivetrueFire at targets
TrackedActorCurrent target (read only)
FunctionDescription
GetTeamAttitudeFriendly, Neutral or Hostile for an actor. Override to change who the turret attacks

Example children in Examples/Blueprints: B_TurretAIController_01, _02, _03 (different sight radii) and B_TurretAIController_AlwaysFriendly.

ATurretPlasmaProjectile​

A sphere (radius 60) with BlockAllDynamic collision and a projectile movement component without gravity. It attaches the turret's ProjectileEffect on spawn and destroys itself on impact. Not replicated: every machine spawns its own.

ATurretProjectile is its abstract base. Derive from it for a projectile with its own collision and movement components.

ATeamPlayerController​

A player controller with a TeamID that implements IGenericTeamAgentInterface. Use it, or B_TeamPlayerController, as your GameMode's Player Controller Class to give the player a team.

UTargetingLibrary​

FunctionDescription
CalculateFiringSolution(ShooterPosition, TargetPosition, TargetVelocity, ProjectileSpeed)Direction to fire so a projectile of that speed intercepts a target moving at constant velocity. Returns false when no interception is possible, for example when the target is faster than the projectile. Shown as Calculate Firing Solution (Predictive)

Example Blueprints​

BlueprintPurpose
B_TeamPadGives the player its team when stepped on and updates every turret's perception
B_TeamPlayerControllerChild of ATeamPlayerController
BP_ThirdPersonCharacterTemplate character with the demo keys (F, T)
BP_ThirdPersonGameModeUses B_TeamPlayerController and BP_ThirdPersonCharacter

Animation​

Turret/animations/ABP_Turret and ABP_Turret2 rotate the turret head from the pawn's TurretRotation.

How a shot happens​