I know how to use the line trace to send the interact message for first person and third person games, but my current project is using a fixed camera. I simply want the interaction to happen when the object is in range and the player presses E. Using the line trace wont work here so I’ve added sphere collision but neither the sphere trace or on component overlap will work. the sphere trace either interacts with everything or nothing, and the sphere collision is interacting with nothing
By “interacts with everything or nothing” do you mean it uses all interactables in the spheretrace simultaneously or every actor regardless of whether they should be usable? If you’re using a multisphere trace that’s just finding multiple things and want to filter out the closest one, you could use begin and end overlap events to add and remove actors from an array var called “potential interactions” or some such, then have the E key do a “find nearest actor” from the array and interact with result if valid.
this works but it works too well. no matter where in the level i press e the code still executes. I’ve tried making a float variable that controls this but it makes no difference.
all options can work, line trace, sphere collision etc, it sounds more like you have a collision issue.
i’d suggest creating a custom collision channel for interactables, OR you can just loop over all hits and check the first one that implements an interact interface
Sphere trace around the player on key press.