ive posted the same issue but its not really clear and I got very confusing node graph.
but I do appreciate that guy who took time responding, hes awesome! one day I’ll understand his answer xD
When you shoot your ray out into the world, you want to get the actor which it hits, then cast it to the light you have. If the cast succeeds, you can store a reference to that actor within your character object. If the cast fails, you just clear out the reference value.
When someone presses the “F” key, you want to place an “Is Valid” node which checks the reference. If its valid, you can call some sort of “interact” method on it. If its not valid, you do nothing.
Architecturally, I’d either create a base class/blueprint which all of your various light switch types inherit from and create a “Interact” method. Each blueprint which inherits from this base class should override the “interact” method and turn on/off any blueprint components (such as point lights).
Alternatively, you can use the blueprint interfaces (See: Content Examples, Level “Blueprint Communication”, Section 3.2) to do the same thing.
thanks for the response again. I’m already using blueprint interfaces that event node on the graph. Now you mention about clearing reference value Ive been looking on this in the ue4 docs and wiki. can you explain how to do this? and what node to use to clear reference?