Download

Should I use tracing or not?

Hey all,
So first let me start with what I’m tracing to achieve. Basically I’m creating a mechanic similar to one used in most Zelda games:
When the player camera looks at interactable object (like a switch or button) visual feedback will pop up that tells the player it can be interacted with.

My first thought was achieving this though line tracing on a timer, which would be expensive. Alternatively I thought about attaching an actor to my player character with the AI Perception component, but I don’t know if that will work. I also have a few targetting systems that were on the free for the month list, but I haven’t had time to really dig into them.

If anyone has made a system similar to Zelda’s and can give me some tips I’d appreciate it. I know that doing the trace will work, but I want something more efficient.

I have a similar system in my project where I use a line trace on a timer so the player has to look directly at the object in order to interact with it. I display a pop up when hovering over an object from information contained in a struct for that object/actor. I don’t have it running every frame, my timer trace runs every 0.1. Even on every frame, it’s not expensive at all. I haven’t noticed any performance issues unless i’m running like 100+ traces together on event tick constantly. But a single one for interaction has no performance impact what so ever, atleast in my case, and it allows for the exact type of interaction i need in my project.