I am creating a target system where if you click a clickable actor (in my case any child of a base NPC I have created) it will display a target frame in the HUD containing the information that has been bound to it (HP, level, name etc).
Now I’m trying to make it so that when I click anywhere else that isn’t a clickable actor, the target frame is removed.
Note I have two ways of implementing this;
Event Actor OnClicked and a Blueprint Interface function ‘IsClicked’.
Think like World of Warcraft - that is the mouse and movement system I am trying to recreate (ish).
I’ve tried for a few days and think I’m close but my knowledge is reached. I feel there is something to do with how my mouse is set up in the project settings and how it traces etc etc…
GetHitResultUnderCursorForObjects is probably what you need. When a click event is received, check to see if it hits your character or not. If it does, draw your UI, if none is returned, clear your UI.
Thanks so much. You pointed me in the right direction and several hours later I have it working to how I want.
I ran the GetHitResultUnderCursorForObjects on my Level Blueprint from a Left Mouse Button node. took the Return Value at the bottom and Branch in to two Print Strings:
True - Yes
False - No
and this gave me the tool to debug my logic behind troubleshooting later on having a Print String with all the logic applied for both Left and Right mouse clicks with Attack, Interact, No Target etc based on variables predetermined.
Glad you got it sorted.
Just as a tip, it is not good practice to handle input events inside the level blueprint. Character and PlayerControllers are the ideal classes for handling user input.
Hey could you please post screenshots of your blueprints? I am also trying to do a wow like UI and when i raycast i cant seem to get the other players name to come up i can only get mine thanks!