I would like to use these lines to detect collision with the player for a stealth game. I would be open to any C++ solutions or even a way to re-create these lines as vectors or traces to detect collision with the environment and the player (As I do not want these to go through the floor either). These lines are being shown to me surely they exist somewhere, I just have to find them, right? Wishful thinking I know, but it’s impossible to accurately line up an invisible cone to the attenuation radius especially if the distances were to change. Each light in the game would have to be painstakingly adjusted on a per-light basis. I’m dying for a better solution to this problem. Easier light detection is definitely at the top of my wishlist for future unreal engine 4 features.
Is there anyway I can use the lines that project from a spotlight when adjusting the attenuation radius to detect collision?
This is only preview for light cone.
But you can add some specific collision primitive to detect player.
As an example you can check “Blueprints” project, and there you will find security camera actor that uses similar setup.
As redbox said, the blueprints demo has an example of a invisible mesh cone checking overlaps with the player. Its not
Since you said your open to c++, you could go take a look at the actual solution epic use for that cone. Id start in
Runtime/Engine/Classes/Components/SpotLightComponent.h. I imagine they are using the DrawDebugCone. Since its just a debug lines solution, its not very helpful as you wont be able to detect the player. You could get the light forward vector a a dot product check against yourself. Theres a tonne of tuts on that for AI cone of vision, try googling AI dot product