I’m making a game that uses a flashlight and you have to shine it on things to keep them away, how could I detect if my flashlight is overlapping another object?
Simplest way would probably be to create a cone-shaped collider with the wide base of the cone way out to as far as the flashlight’s beam can attenuate to and still shine on anything.
Then set up a Timer event which checks a the GetOverlappingactors node on that cone component, does a line trace toeach one in a foreach loop, and for each on that it hits (doesnt hit a wall first), and is in range (distance is small enough that visibly they are considered to be shined on), it flips a variable or executes a function on that creature twlling it to run away.
I say timer because every tick would slow down the game, but make the timer loop less than a second because we dont want the monsters to seem to have slow reflexes.
PS the engine doesnt have a quick one-button way to make a cone shaped collider, so either build one in a third party software or you can try the less efficient/performant way of using the prefab static mesh cone and giving the asset a Use Complex As Simple collider setting.
Okay, Do you think you could post a picture of the blueprints for this?
Okay, do you think you could post a picture of the blueprints for it?
Probably not this weekend. Maybe someone else can whip up a picture for you using my instructions though
Okay, would I just make a forum post about it?