BP Communication - how to turn on/off text when pointed at

I’m working in the VR template and I’m trying to make a system where when I point at an object, there is text that floats above the object that turns on. Then when the pointer goes elsewhere, the text turns off.

I have a Line Trace by Channel shooting from the MotionController that gives a hit result. The hit result is checked if it implements the correct Interface, if true then Cast to it, then run a ForEachLoop with GetComponentsbyClass of Text Render to Set Visibility of each one to true.

This part work fine and I can point at an object and the text will turn on. I can’t figure out how to then send a negative message to turn them back off. What would be the best way to do this?

Thanks for any help,
Colin

Add an actor reference of type “PickupActorInterface” in your MotionController.
Every tick, check if the hit actor of the line trace has/is a “PickupActorInterface”.
If it is, compare the hit result actor of your line trace with your saved PickupActorInterface reference.

If the hit result actor is the same as your saved reference, do nothing. No need to turn any text on or off if we still point at the same object as in the last frame.

If its different, then we need to turn the text of the old object off and turn on the text for the new object, aswell as assign the hit result actor to our reference variable: Get the old saved reference, turn the text off, then overrride the saved reference with the new hit object and turn the text of that new object on.
The order is important : First turn the text of the old PickupActorInterface reference off, only THEN override the reference with the new PickupActorInterface actor.

To turn the text off, just get the component like you did in your picture, but in SetVisibility leave “New Visibility” unchecked, aka “false”.

Something like that should work.