Trigger event when to items are pointed at same location.

I want to build a horror game that reacts based on the players actions. One thing I am trying to set up is a trigger that activates when the player is both looking at and has a flashlight pointed at the same object. What would be the best way to set this up?

-I am very new to this. Please lay it out like you would for a child. Thank you for any responses.

I don’t got time for a detailed description, but this should get you started:

  • On tick trace forward from camera location. Store a reference to the hit actor.
  • Also trace from the flashlight. If the hit actor is the same as your stored reference, you know both view and light is on the same actor.
  • A good way to trigger an event based on this is to create an interface, implement it on any actor that should do something on gaze+light and call a function from that interface on the actor your traces has indicated.

I know this may sound complicated, but start by reading up on “trace” and “interface” and it should start to make sense.