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
Property | Type | Description |
---|---|---|
Muzzle Socket | String | Socket name of center of the muzzle (used for traces to detect player movement) |
Left Muzzle Socket | String | Socket name where the projectiles are emitted from the left barrel |
Right Muzzle Socket | String | Socket name where the projectiles are emitted from the right barrel |
Turret Velocity | Float | Velocity of projectiles |
Dual Barrel | Boolean | If checked, the turret has two barrels and shoots two projectiles at once |
Dual Barrel Shoot Delay | Float | Delay in seconds for the second barrel when dual barrel is enabled |
Team ID | Integer | Generic identifier to which team the turret belongs (friend/foe detection) |
Projectile Class | Class Reference | The projectile class to spawn when the turret fires |
Effects Properties
Property | Type | Description |
---|---|---|
Muzzle Flash Effect | Niagara System | Visual effect played at muzzle when firing |
Fire Sound | Sound Base | Audio effect played when turret fires |
Projectile Impact Sound | Sound Base | Audio 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
Property | Type | Description |
---|---|---|
Tracking Timeout | Float | Timeout in seconds when AI perception can't see the player anymore before returning to base position |
Track Player Timer Rate | Float | Timer rate in seconds to send out traces to track a perceived player (default: 0.1s) |
Shoot Projectile Timer Rate | Float | Timer rate in seconds to shoot projectiles (default: 0.7s) |
AI Perception Settings
Access these through the AI Perception Component:
Property | Type | Description |
---|---|---|
Sight Radius | Float | Maximum distance the turret can detect enemies (e.g., 2500.0 cm) |
Lose Sight Radius | Float | Distance at which turret loses sight of enemy (should be higher than Sight Radius) |
Peripheral Vision Half Angle | Float | Field 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
Property | Type | Description |
---|---|---|
Initial Speed | Float | Starting velocity of the projectile |
Max Speed | Float | Maximum velocity the projectile can reach |
Projectile Gravity Scale | Float | Set to 0 for no gravity drop |
Collision Component | Sphere Collision | Handles collision detection |
Niagara Component | Niagara System | Visual 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
Layer | Purpose |
---|---|
Base Layer | Default turret pose and idle animations |
TrackTarget | Target 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:
- TurretPawn implements the team interface
- TeamPlayerController provides team ID for players
- GetTeamAttitude function determines relationships
- 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!