Turret Settings
Get familiar with all settings on the BP_InterceptionTurret actor.
Introduction
This page will explain all settings that can be found on the BP_InterceptionTurret.
It is important to note that some of these settings only affect events and functions found on the AC_InterceptionComponent, which is attached to the turret actor.
The component reads all relevant data from the turret actor on Begin Play. These variables were created on the turret as well as on the component so that all settings can be adjusted from one single place (in this case, the details panel of the turret actor).
Important Note: The turret will only fire when an interception is mathematically possible. Limiting values such as the projectile speed, maximum turn speed,maximum time to intercept, or minimum/maximum pitch can lead to the turret not firing.
Main Settings
Initial Target
Define any actor to be targeted by the turret.
Setting an initial target is optional. The turret can also automatically target actors within its range (see "Target Class" setting below).
Interception Method
Define which mathematical algorithm will be used by the AC_InterceptionComponent to calculate an interception velocity:
Line of Sight: Simply fire at the target's current location. No movement prediction will be used. The turret will also not check if an interception is mathematically possible - it will fire anyways.
Quadratic Formula: Factor in the target's speed to calculate an interception point.
Newtons Method: Factor in the target's speed and acceleration to approximate an interception point.
It is recommended to pick an interception algorithm based on your specific needs:
Is the target stationary? -> Line of Sight
the target moving? -> Quadratic Formula
the target moving and accelerating? -> Newtons Method
Note: Only linear speed and acceleration can be factored in when calculating an interception path. Since no guided ammunition is used, the turret can only hit targets that maintain a constant speed or acceleration.
Fire Rate
Define the fire rate of the turret in shots per second.
-> A value of 20 means that the turret will fire 20 bullets per second.
Degree Fire Limit
Defines how accurately the turret must be aligned with its target rotation in degrees before it can fire.
When set to a low value, the turret will only shoot when it is almost at the exact rotation it needs to be in to hit the target. When set to a higher value, the turret can start shooting even before the target rotation is reached.
Anything between 0.1 - 10 degrees can be a good value.
If this value is set too high, then the turret might start shooting even though it is still facing into a completely wrong direction.
Setting this value to 0 should be fine in most cases. However, when using a low maximum turn rate, the turret can end up not firing as it cannot always exactly align itself with the target rotation. In this case, it might be better to fire even when offset by a few degrees or less (instead of not firing at all).
Maximum Turn Speed
Defines the maximum turn rate of the turret in degrees per second.
This setting can limit how fast the bearings of the turret can rotate to any desired rotation.
Setting this value to 0 gives the turret infinite turning speed.
-> A turn rate of 90 means that the turret can turn by 90 degrees on each of its axis (pitch and yaw) each second.
Cheat Barrels
By default, the turret only uses the average fire location to calculate an interception path. This means that each barrel misses by the distance between the barrel tip and the average fire location (as the barrels cannot be individually rotated).
However, if you want every shot to perfectly hit the center of the target, you can enable the "Cheat Barrels" option.
When enabled, an interception velocity will be calculated for each individual barrel. This results in a higher accuracy but lower realism. Especially if the target is close to the turret, projectiles can leave the barrel at an angle.
Enabling this setting will also slightly increase the cost on performance (although this should be negligible, especially when using a low/normal fire rate).
Trace Mode
This setting can be used to check if the line of sight / fire is clear before firing.
Disabled: Turret will always try to shoot at the target.
Line of Sight: Turret will not fire if the line of sight is blocked (A line drawn from the turret to the Target).
Calculated Path: Turret will not fire when the calculated bullet path is blocked (A line drawn over the calculated bullet trajectory).
Use the 'Calculated Path' option with care - this call is significantly more expensive as it simulates the entire trajectory flight path (can be a parabola). It is not a problem to use this option, just be aware that multiple turret or turrets with a high fire rate can draw more system resources when using this mode.
Moving Turret Mode
When enabled, all projectiles fired by the turret will inherit the turret's velocity. Consider using this setting if your turret is attached to a fast-moving object.
Imagine throwing a ball out of a car's window. The ball should also inherit the current velocity of the car (on top of the velocity added by the throw).
The rotation of the projectiles will also be updated: Instead of aligning their rotation to their velocity, they will now align with their own velocity minus the turret's velocity. The bullets will also use the new, sprite-based tracer (the ribbon-based tracer cannot be rotated).
If your turret is stationary, enabling this setting does nothing.
Note: The turret is perfectly capable of hitting its targets while it is moving even if this setting is disabled.
Target Acquisition
Target Class
Define any actor class that the turret should automatically target.
Any actor that enters the rotation range of the turret will be targeted. The turret will keep aiming at the same target while it stays within the shooting range. If the current target is out of the turret's shooting range, it will try to find a closer target.
Target Update Frequency
Defines how often (per second) the turret will try to find a new target. It will only try to find a new target if no target is set, or if the current target is out of the turret's shooting range.
Finding a new target can be expensive (especially when the turret has unlimited range). Therefore, consider keeping this setting at a lower value.
Note that the turret will also immediately try to find a new target when its current target is destroyed.
Projectile
Projectile Speed
Defines the speed of the turret's projectiles.
Note that setting this value too low can lead to an interception being mathematically impossible. If that is the case, the turret will not shoot .
Projectile Gravity Scale
Define the gravity scale of the turret's projectiles.
A value of 1 means that normal gravity (1G) is applied to the projectile.
The turret is capable of compensating the gravity scale of the projectile. However, it is very important to note that the turret will increase the projectile's speed in order to compensate for the given gravity scale.
-> Setting a high gravity scale can lead to the projectile speed increasing.
Ammunition Type
There are 3 available ammunition types:
Kinetic: Normal bullets, must directly hit the target.
Explosive Cone: Bullets that explode in a cone.
Explosive Sphere: Bullets that explode in a sphere.
Both explosive modes are set to detonate at the impact point or on collision.
The impact point can be offset using the 'Target Offset' value.
Target Offset
This setting can be used to aim above/behind the target. For example, when using explosive rounds, the turret can aim above targets that hide behind cover. This way, the round flies past the cover before exploding above the target.
The offset is always in the local space, with a vector drawn from the turret to the impact point defining the coordinate system.
Positive X: Aim behind the target*.
Positive Y: Aim to the right of the target*.
Positive Z: Aim above the target*.
*from the turret's perspective when looking at the predicted impact point.
Example values: Kinetic
Ammunition: (0, 0, 0) Explosive_Cone: (-100, 0, 0) - Explode 1m in front of target
Explosive_Sphere: (0, 0, 100) - Aim up to avoid cover, then explode 1m above the target.
Projectile Class
Select the projectile class that is used by the turret.
The specified class must be a child of BP_InterceptionProjectile.
You might want to create different projectile versions, for example an explosive variant.
Limitations
Rotation Range
Defines a radius around the turret. The turret will only rotate towards the target while it is within this range.
The turret will return to its default rotation while the target is outside of the turrets rotation range.
Setting this value to 0 gives the turret infinite rotation range.
Shooting Range
Defines a radius around the turret. The turret will only fire at the target while it is withing this range.
Setting this value to 0 gives the turret infinite shooting range.
Turret Inaccuracy
Defines a random inaccuracy of the turret in degrees.
-> E.g., when set to 5, all shots can be offset by up to 5 degrees.
Maximum Time to Intercept
Defines the maximum time a shot can take to hit its target.
The interception algorithms can calculate how many seconds the bullet will travel before hitting their target.
If the interception is expected to take longer than the "Maximum Time to Intercept", it will be marked as invalid and the turret will not shoot.
Projectiles will also de-spawn after the "Maximum Time to Intercept" passed.
-> E.g., Maximum Time to Intercept = 5s. The lifetime of all fired projectiles will be set to 5s. If the interception is expected to take more than 5s, the turret will not shoot.
Barrel Minimum Pitch
Sets the minimum pitch of the barrel. This can be used to prevent the barrel mesh from clipping through the turret model.
You only need to update this value when using a custom turret mesh.
Barrel Maximum Pitch
Sets the maximum pitch of the barrel. This can be used to prevent the barrel mesh from clipping through the turret model.
You only need to update this value when using a custom turret mesh.
Other
Follow Rotation
The turret will only rotate towards its target as long as this value is set to true.
Shoot at Target
The turret will only shoot at its target as long as this value is set to true.
Anti Jitter Mode
Enable this setting when experiencing jitter.
Jitter can occur if the target is constantly changing their speed and acceleration (e.g., when flying in a circle). Then, the turret will try to move in a non-linear motion which can cause jitter.
Newtons Method is the most susceptible for jitter, while the Line of Sight method will not lead to jitter.
Lowering the turret's maximum turn speed can also help decrease jitter.
Debug
Draw Debug Spheres
Enable this setting to visualize the turret's shooting and rotation range (on Begin Play) using debug spheres.
The shooting range is indicated in red, while the rotation range is blue.
Last updated