I want to know if there is non complex math to check if gun can aim at certain point.
Imagine this problem as gun in turret, it can rotate around and move gun up/down.

If bullet is spawned from the middle of the turret (inside), the range can be determined quite easily, it’s the area around excluding red cones, that means even simple dot product could be enough to find out if certain point is inside or outside that area.

The problem is that bullet might be spawned with offset (consider second turret, or imagine man with a gun in the right hand). The excluded area is a bit different and the hard part is that it cannot be determined from any position - what I mean is that in the first example it does not matter what is the current rotation of turret/gun, as the spawn point is still in the same position and area can be determined, however in the second one if gun was in the green point, then the zone would be calculated wrong as gun cannot shot this way, it would need to be rotated to the other side.

Do you have a working turret that is constrained in the manner you’re describing?
(not working in that it calculates this specific scenario, but working in that it exists in your project and can rotate and pivot with constraints)

Do you have aiming logic that drives the turret?
Meaning you can calculate the orientation of the turret that would face the target.

Then could you not reverse just then see if that target orientation is within the constraints? If you have to rotate N degrees around axis A, and the constraint say you can only rotate N-K degrees… then thusly it’s unreachable.

…

Alternatively are you just trying to solve this generically independent of your project?

Or alternatively alternatively, you only have 1 of the previously mentioned presuppositions resolved. And this is your attempt at solving one of those steps above I presupposed.

In general I have stuff working, but I want to implement this “correctly” if possible.
I can just ignore that small offset and call it a day and hope it works 99% of time.

If you don’t know how to find that point, you find it by getting the tangent line of the target point to the circle of the cylinder on the XZ plane; i.e. the line from the target point to either side of the circle that the gun rotates on.