I’m very new to programming and i’m still learning my way through with this. I tried exhausting all sources of information before posting, but so far i haven’t been able to solve this seemingly simple yet horribly complicated task.
What am i doing wrong?
Is there anything i’m missing?
Are there any errors? If so, what are they? What does the current output look like? How do you want the output to be?
I see that you interact with the actor from the player, but we need more info to help you out.
Please note that we don’t really spend so much time analyzing it one by one, so make it compact, direct and easy for us to understand it.
That line trace probably isn’t hitting the actor. End location should be the forward vector multiplied by a float (to define how long the line should be) then added to the start location.
If it did hit, the toggle event on actor would never work because it can only set checked to true if it’s already true.
Likewise, the widget event would only set it to checked because the set node doesn’t have anything plugged in to tell it to do otherwise.
You need a Widget Interaction Component instead of line trace by channel.
Also, never use Get All Actors of Class unless you absoutely must do something to every actor at the same time. The apropriate actor referenece can be obtained from the OutHit struct of the Line Trace node.