Skip to main content

Blueprint Reference

Detailed reference for all the blueprints and components included in the AI Turret plugin.

Core Blueprints

B_TurretPawn

Extends: TurretPawn (C++ class)

The main turret blueprint that contains the skeletal mesh and core turret functionality.

Key Properties

PropertyTypeDescription
Muzzle SocketStringSocket name of center of the muzzle (used for traces to detect player movement)
Left Muzzle SocketStringSocket name where the projectiles are emitted from the left barrel
Right Muzzle SocketStringSocket name where the projectiles are emitted from the right barrel
Turret VelocityFloatVelocity of projectiles
Dual BarrelBooleanIf checked, the turret has two barrels and shoots two projectiles at once
Dual Barrel Shoot DelayFloatDelay in seconds for the second barrel when dual barrel is enabled
Team IDIntegerGeneric identifier to which team the turret belongs (friend/foe detection)
Projectile ClassClass ReferenceThe projectile class to spawn when the turret fires

Effects Properties

PropertyTypeDescription
Muzzle Flash EffectNiagara SystemVisual effect played at muzzle when firing
Fire SoundSound BaseAudio effect played when turret fires
Projectile Impact SoundSound BaseAudio effect played when projectile hits something

Events

OnProjectileImpact

  • Description: Fired whenever a projectile hits something
  • Parameters: Hit result, hit actor
  • Use Case: Apply damage to hit characters, trigger effects, etc.

B_TurretAIController

Extends: TurretAIController (C++ class)

Controls the AI behavior of the turret, including perception, targeting, and firing logic.

Key Properties

PropertyTypeDescription
Tracking TimeoutFloatTimeout in seconds when AI perception can't see the player anymore before returning to base position
Track Player Timer RateFloatTimer rate in seconds to send out traces to track a perceived player (default: 0.1s)
Shoot Projectile Timer RateFloatTimer rate in seconds to shoot projectiles (default: 0.7s)

AI Perception Settings

Access these through the AI Perception Component:

PropertyTypeDescription
Sight RadiusFloatMaximum distance the turret can detect enemies (e.g., 2500.0 cm)
Lose Sight RadiusFloatDistance at which turret loses sight of enemy (should be higher than Sight Radius)
Peripheral Vision Half AngleFloatField of view angle (90° = 180° total FOV, 180° = full circle)

Key Functions

GetTeamAttitude

  • Description: Determines whether a perceived character is friend or foe
  • Parameters: Actor to evaluate
  • Returns: Team attitude (Friendly, Neutral, Hostile)
  • Override: Can be overridden in Blueprint for custom friend/foe logic

B_TurretProjectile

Extends: TurretPlasmaProjectile (C++ class)

The projectile fired by turrets with zero weight physics for consistent trajectory.

Key Properties

PropertyTypeDescription
Initial SpeedFloatStarting velocity of the projectile
Max SpeedFloatMaximum velocity the projectile can reach
Projectile Gravity ScaleFloatSet to 0 for no gravity drop
Collision ComponentSphere CollisionHandles collision detection
Niagara ComponentNiagara SystemVisual effect for the projectile

ABP_Turret

Type: Animation Blueprint

Handles the animation of the turret's skeletal mesh, including rotation and tracking movements.

Key Features

  • Turret Rotation Interpolation: Smoothly rotates turret parts to track targets
  • TrackTarget Animation Layer: Transforms individual bones for precise aiming
  • Base Position Return: Animates return to neutral position when no target

Animation Layers

LayerPurpose
Base LayerDefault turret pose and idle animations
TrackTargetTarget tracking rotations for turret components

Utility Blueprints

B_TurretAIController_XX (Variants)

Pre-configured AI controllers with different sight radius settings:

  • B_TurretAIController_Short: Close-range detection
  • B_TurretAIController_Medium: Medium-range detection
  • B_TurretAIController_Long: Long-range detection
  • B_TurretAIController_AlwaysFriendly: Never attacks (for testing)

Example Blueprints

B_TeamPad

  • Purpose: Changes the team ID of the player when stepped on
  • Use Case: Testing friend/foe detection, team-based gameplay

B_TeamPlayerController

  • Extends: TeamPlayerController (C++ class)
  • Purpose: Provides team-based player controller for friend/foe detection

C++ Classes Reference

TurretPawn

  • Purpose: Base C++ class for turret functionality
  • Key Features: Socket management, projectile spawning, team interface

TurretAIController

  • Purpose: Base C++ class for AI behavior
  • Key Features: AI perception, trajectory calculation, targeting logic

TurretPlasmaProjectile

  • Purpose: Base C++ class for projectiles
  • Key Features: Physics simulation, collision handling

TeamPlayerController

  • Purpose: Player controller with team support
  • Key Features: Implements IGenericTeamAgentInterface for friend/foe detection

Blueprint Communication

Events Flow

Team System Integration

The plugin uses Unreal's IGenericTeamAgentInterface for friend/foe detection:

  1. TurretPawn implements the team interface
  2. TeamPlayerController provides team ID for players
  3. GetTeamAttitude function determines relationships
  4. Team IDs: 0 = Neutral, 1+ = Team numbers

Customization Points

Easy Customization

  • Modify properties in Blueprint details panel
  • Override GetTeamAttitude for custom friend/foe logic
  • Replace projectile class for different projectile types
  • Adjust AI perception settings for different detection ranges

Advanced Customization

  • Create new blueprints extending the C++ base classes
  • Implement custom animation blueprints
  • Add new projectile types with different physics
  • Create custom AI controllers with different behaviors

Need help with blueprint customization? Check out our Customization Guide or join our Discord!