How to: when you look at something you get action?

Hi! I am looking for a way to get the point where I am focusing, in first person (anyway, with/without croshair, with/without character…). My goal is, when you look at a box (for example, it’s a blueprint object) you get an action, for example, print text: hello!. What is the best way to get this?

Thank you.

  1. you need a raycast. if you want to check always you should use it inside the event tick.
  2. it should start in your face, get the forward vector, multiply it by lets say 2000 and then add it to your position. this is the end of the ray cast and the start is as said your face. (get a socket on the face or calculate it. I think there is an eye height variable inside of the char)
  3. if the raycast hits an object you check whether this object is the one that you desire. so you make something like “cast to “boxname”” and if the cast succeeds you can launch the function inside of the box by dragging a nod from the cast.
    so every bp you want to interact with needs a function called something like “interaction”

the best would be if all items you want to interact with have one parent. so you only have to cast to the parent and execute his function and you can specify what should happen in that function for each child individually

Ok, thank you. :slight_smile: but is it possible to do without even tick? I mean, it works only when hits the objects I desire.

if you want to test permanently whether something is in front of you then it has to be an event tick or timer. if you only want it to be checked when pressing a button you obv can put that logic to a button input event

A single line trace going out on tick to check the object it hits is not a big deal. You then just put a gate there once it hits 1 of the desired objects before progressing further and it shouldn’t have any problems