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++ class | Blueprint child | Folder |
|---|---|---|
ATurretPawn | B_TurretPawn, B_TurretPawn2 | Turret |
ATurretAIController | B_TurretAIController | Turret |
ATurretPlasmaProjectile | B_TurretProjectile | Turret |
ATeamPlayerController | B_TeamPlayerController | Examples/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.
| Property | Display name | Default | Description |
|---|---|---|---|
TeamID | Team ID | 255 (no team) | Team of the turret |
VelocityScale | Projectile Velocity | 1000 | Projectile speed in cm/s |
bDualBarrel | Dual Barrel | false | Fire from both barrels |
DualBarrelShootDelay | Dual Barrel Shoot Delay | 0.2 | Seconds before the second barrel fires |
ProjectileClass | Projectile Class | ATurretPlasmaProjectile | Projectile to spawn |
Name_SocketMuzzle | Muzzle Socket | muzzle | Muzzle of a single-barrel turret |
Name_SocketMuzzleLeft, Name_SocketMuzzleRight | Left / Right Muzzle Socket | muzzle_left, muzzle_right | Muzzles of a dual-barrel turret |
ShootSound, ResetTurretSound | Sounds for a shot and for the reset | ||
MuzzleFlashEffect, ProjectileEffect | Niagara systems for the muzzle flash and the projectile trail | ||
TurretRotation | Aim 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 event | Description |
|---|---|
OnProjectileImpact | Event: one of this turret's projectiles hit something. Not implemented by default: implement it to deal damage |
SpawnShootFX | Shot sound and muzzle flash. Override for custom effects |
ResetTurret | Called by the controller when it gives up its target. Turns the head back and plays the reset sound |
GetSocketLocationFromMesh | World location of a socket on the mesh. Override for meshes without sockets |
GetMuzzleLocation, GetMuzzleLocationLeft, GetMuzzleLocationRight | World 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.
| Property | Default | Description |
|---|---|---|
TrackingTimeout | 3.0 | Seconds without the target in sight before the turret resets |
TrackPlayerTimerRate | 0.1 | Seconds between aim updates |
ShootProjectileTimerRate | 0.7 | Seconds between shots |
TrackingActive | true | Track targets |
ShootingActive | true | Fire at targets |
TrackedActor | Current target (read only) |
| Function | Description |
|---|---|
GetTeamAttitude | Friendly, 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
| Function | Description |
|---|---|
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
| Blueprint | Purpose |
|---|---|
B_TeamPad | Gives the player its team when stepped on and updates every turret's perception |
B_TeamPlayerController | Child of ATeamPlayerController |
BP_ThirdPersonCharacter | Template character with the demo keys (F, T) |
BP_ThirdPersonGameMode | Uses B_TeamPlayerController and BP_ThirdPersonCharacter |
Animation
Turret/animations/ABP_Turret and ABP_Turret2 rotate the turret head from the pawn's TurretRotation.