Paranormal Device That activates when looking at something

Good Morning!

Basically what im trying to do, is , the player is holdiong a device, and when they look in the direction of something ( in this case its whispers) the device lights up ( kind of like a paranormal thing, where the lights get more and more until you arrrive at the source of the sound)

I was just wondering if anyone had any ideas as to how to achieve this?

Thank you so much for your time! :slight_smile:

Hey @Nate1232

I have a project with something similar. I made the “IsOnScreen” code public here Is Actor On Screen posted by Grim | blueprintUE | PasteBin For Unreal Engine

You can modify that to get how close to the center of the source your camera is looking at and check the distance between your player and the source to modify lights intensity or whatever you need.

You can check periodically with an TimerByEvent by activating it when there’s something to be found and deactivating it when there’s nothing for the player to track, just to consider performance.

To allow for multiple object tracking, you need something to manage that (in case you want multiple sources at the same time). The way I do it is by creating an interface that I add to classes I want to track, and handling it with a manager class. In your case you could use the device itself if it’s a custom class and not just a mesh.

You can feed information from each trackable source to the device, such as “CenterOfScreenPercentage” and “DistanceToSource”, and then calculate in the device or manager the desired light intensity between all active sources.

1 Like

amazing, thanks so much dude! :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.