Automated targeting

I’m working on a top-down spaceflight game, where the player might fly anything from a smaller fighter to a proper space battlecruiser. When flying the latter, I want to feature automated turrets-these have fixed arcs. The trouble is, I want to figure out how to best handle target acquisition. Would it work to have a circle collider on the turret to scan for targets and then just check if they’re within the arc, or is there a better/faster/more efficient way of doing it that I’m not thinking of?

Physics have an overlap function to check what colliders are withing an area. You could call that when acquiring new target and set it at a rate like once a second. This could be an alternative to having a trigger collider holding a list of colliders in the trigger collider.

Not sure what you mean by arc but there might be something similar in the physics functions.

Testing for performance shouldn’t be complicated.

by Arc, I mean the turrets can’t aim 360 degrees. The ship has a turret on the nose which can aim 90 degrees left or right, for example. I wasn’t sure if there was an easy way to get targets in a cone or if I just have to check all against Vector3.Angle() or a similar check.

I had to make something similar for my game recently. I would recommend using the overlap function like what nttLIVE suggested.
For each target found with the overlap function, you could calculate the angle between the forward facing vector of the turret and the direction vector of turret to target. Then based on how big that angle is you can determine if that target is actually within the range of the turret.