Hi! What I’m trying to do should be quite simple: I have a line trace that is called every frame, and when the line trace hit my interactable object it should highlight, indicating to the player that he can grab that object. I have a custom channel for that, and all I need is to get the Hit component in the BreakHit node, and set the custom render depth to true or false, depending if the line is hitting something or not.
It’s a bit of a fiddle, actually. How I did it, was to make a parent class ‘interactive object’, and the player sends highlight messages to it using a blueprint interface. The interactive object has a timer, and if the player isn’t sending ‘highlight’ messages anymore, it un-highlights itself.
Just setting and unsetting the highlighted object doesn’t work, because you don’t know another object will be highlighted until it’s too late. Then you don’t have the reference anymore…
you need to check the hit is valid before setting an object to a hit actor
on the line trace by channel, there is a boolean value below called “Return value”
Branch check that first before set mag object, connect the true to set mag object and false to nothing unless you want to do something if not but that would happen ALOT as its on tick
I’ve tried using blueprint interfaces and event dispatchers, but the plan is to have like a hundred of this objects for the player to interact (It will be metal parts that he can throw to do damage or defend himself) and when I highlight one, it highlights all objects in the scene, so I’m trying to set the custom render while is being hitted to avoid this problem.
you are trying to grab the data from a set node that hasnt been initiated as you hit a false trace. Try dragging a get node of LookingMagObject into the target pin on the bottom render depth node. might not make any difference but try?
Tho blueprint actor is a much cleaner choice as @ClockworkOcean suggested