How would I detect what my thumbstick is currently pointing at?

I’m making a game loosely based on the 3rd person template and I currently have attacks, hit reaction, a basic lock-on system with orientation lock, and a moving camera that doesn’t rotate but I’ve hit a wall. I want the ability to hold toward an enemy to do different attacks but if I point toward other objects in the environment do different actions based on what I’m pointing at (ie point at a wall to do a wall run attack). I was thinking like a sphere trace that triggers if the stick is being held when the button’s pressed but I’m not sure if there’s a more efficient method, any ideas? P.S. I’m really new to this so any extra detail you can give is greatly appreciated.