Skip to main content

AI Turret (C++ plugin)

AI-controlled turrets that detect, track and fire projectiles at enemies. The aim leads the target, so it accounts for the target's direction and velocity.

The targeting and tracking run in C++. Blueprint children carry the meshes, effects and settings, so you tune and extend the turrets without touching code.

AI Turret C++ Plugin

Key features​

  • AI perception targeting: turrets see enemies, track them and return to their base position when they lose them.
  • Lead angle calculation: shots intercept a moving target (UTargetingLibrary::CalculateFiringSolution).
  • Teams: friend/foe detection through Unreal's IGenericTeamAgentInterface, the interface the engine's AI and Lyra use.
  • Single and dual barrel: two ready-made turrets, plus a low-poly variant of the single-barrel mesh.
  • Multiplayer: the AI runs on the server, the aim replicates and shots show on every machine.
  • Ready to use: drop B_TurretPawn into a level and it works with the default values.

Which edition?​

The AI Turret comes in two editions. They are equal choices; pick the one that fits your project.

  • C++ plugin (this one): for large, performance-critical projects. Targeting and tracking run in native code.
  • Blueprint edition: for most projects. Pure Blueprint, easier to integrate: no code module, no plugin to enable.
C++ pluginBlueprint edition
Unreal Engine5.4 – 5.85.7 – 5.8
Ships asCode pluginAsset pack in Content/AITurret
Targeting and trackingC++Blueprint
Settings, meshes, effects, damage handlingBlueprint (children of the C++ classes)Blueprint
TeamsIGenericTeamAgentInterfaceBPI_TeamAgent
Turret health and destructionNot included; add your ownIncluded: health, damage states, debris
ProjectilesFly until they hitExpire after 5 seconds
Dual barrelsFire parallelConverge on the target

What's included​

  • Three turret skeletal meshes (one dual barrel, a single barrel in high and low poly) and two Animation Blueprints (ABP_Turret, ABP_Turret2) for procedural aiming
  • B_TurretPawn (dual barrel) and B_TurretPawn2 (single barrel), with their AI controller and projectile
  • Niagara effects for the muzzle flash and the projectile, plus sound effects
  • The example map TurretExample with team pads and turret variants
  • The C++ classes ATurretPawn, ATurretAIController, ATurretProjectile, ATurretPlasmaProjectile and ATeamPlayerController, plus the function library UTargetingLibrary

System requirements​

  • Unreal Engine: 5.4 – 5.8
  • Platforms: Win64, Mac, Linux, iOS, Android (the plugin module's platform list)
  • Dependencies: Niagara (optional, for the effects; enabled by default in new projects)

Get the plugin​

Next steps​

  1. Setup Guide: install, enable the plugin, place a turret.
  2. Example Map: what the demo shows and its controls.
  3. Customization: range, speed, fire rate, teams, damage, your own mesh.
  4. Blueprint Reference: every class, property and function.
  5. Lyra Integration: turrets that deal damage through Lyra's Gameplay Ability System.

Support​