Hah fair enough. The big picture:
When the player has the mouse cursor over an actor with the tags “enemy” or “target”, they should have complete freedom to aim wherever they want in XYZ, as long as it’s over this actor. this is great for different kinds of damage depending on where you hit, great for a laser sight trail effect / pointer decal, hit decals and emitters, etc.
When the cursor is over an actor tagged “friendly”, it’ll disable the line tracing, and so aiming entirely. character will even stop the ironsight animation and keep its weapon low.
Those two are basically covered with your previous code.
Now, when the player is just walking around randomly, with the mouse cursor pointing at different parts of the scenery, I don’t want to just shoot the gun at an horizontal plane. this would keep bullet hit decals on walls in a line, even randomizing accuracy a bit. I also don’t want the player to have complete aim freedom while roaming, otherwise it would be almost always looking down to the ground.
So that’s where the cone idea comes in, in fact a cone isn’t a very good description, it would look more like a vertical wedge in a circle around the player, something like this:
This would be great in a situation where let’s say the player is far away from a wall. Within that limited angle, he can hit the entire wall without looking too much up or down. But as he gets closer and closer to it, he won’t be able to aim very low or high and risk having the aim offset too weird looking at his feet or the ceiling, which doesn’t look so great in a top down game.
My original idea was to just disable the player from aiming at actors tagged “floor”, so when the mouse cursor was over a floor object, the aim would be straight. But that would still make it shoot mostly in a horizontal line at the walls, and when cursor is actually over a wall, player would still be able to look way up or down if he was close to it.
In my mind at least this wedge thing would work great lol