Download

OnBeginCursorOver only fires when I'm clicking

So i’m trying to have target health frames pop up when I’m hovering over an enemy, and also outlining the character mesh in red when it’s hovered. The problem is that it only works when I’m clicking. I thought OnBeginCursorOver was supposed to work when hovering, not when clicking, or am I wrong?

  • I have mouseover events enabled in my controller
  • Set the collision visibility and camera to block
  • widgets are set to Self Hit Test Invisible
  • in the controller I have set “Default click trace channel” to Pawn

But these are to make sure the events are working, but they work already, but only when clicking on the enemy, not when just hovering over it :frowning:

Any ideas what might be blocking the OnBeginCursorOver from triggering when i’m not clicking on it?

28d9208e43e3b4238cfcb11bcf9ef33a1ff3bc2b.png

Im not sure, but after creating widget as first step try to “focus” on widget or “set input mode game and ui only” (or ui only), it may help

Thanks but it didn’t work either :frowning:

Anyone else got an idea that’s worth trying out? I’ve been stuck with this bug for 3 months now. It would make my game so much more polished if this would work :smiley:

So instead of doing it with my MobBase class which is derived from CharacterBase which is derived from Character I now made a plain test character that derives directly from Character, and the same problem occurs. So it seems there is something wrong with the Character class, is there any way I can view this class?

Edit: When I hide my entire HUD widget the problem is gone, so there must be something in my HUD that is not on self hit test invisible. Something in my HUD is blocking the mouseover events

You can just setup your own mosuehover code (that identifies only in game objects) by using the convertMouseLocationToWorldspace node coupled with line tracing boind to event tick.

This code is also adaptable to A LOT of other applications so it should be worth learning anyways

Thanks, good idea, i decided to try it, but i’m kinda stuck. I have no idea what I’m doing :smiley:

Could you maybe provide a screenshot of an example how you would use the line trace and ConvertMouseLocationToWorldSpace to make hover effect?

Here’s what I tried to set up in my tick event:

9c0843c173203a57b88a013f5431b74211b98ed3.png

Basicly, my ShowTarget function is working, i’m seeing my health frames for the correct monster. but i have 2 problems:

  • my target frame is not hiding after i hover away from the mob, neither is the red outline from the Set Render Custom Depth
  • There seems to be a delay on the hover, it is not happening right away when hovering over an enemy, i have to hover over it a couple of times for it to show :frowning:

Your line trace is setup so that it will only ever hit the character the player controller is possesing.

The convertMouseLocationToWorldSpace node’s output pins are a little weird so i guess a bit of explanation is in order. The WorldLocation output pin is actually returning the location in world space of where your mouse would be if it was right in font of your camera (meaning a few units infront of the “screen”).

The worldDirection output pin returns a normalized vector (meaning a vector with a lenght of 1) in the direction towards what is right under the mouse as seen from the camera.

To make something useable with these two outputs, you take worldLocation (where your mouse is) and project forwards from there (worldDirection), basically drawing a line forwards from where your mouse is hitting whatever is underneath it. To set this up, make the trace start from worldLocation, then the trace end at (worldLocation + (worldDirection * distanceX)) with distance X being a the lenght in number of units that you want the trace to be

Thanks it’s working a bit better now :slight_smile:

Now I only need to find a way to handle hovering away from the enemy, currently my target frames and my outline stay active when i hover away from the enemy.

Any suggestions? :smiley:

Edit: Nevermind, i found it, it’s working like a charm now :smiley: Thanks again so much

Have it 5ictivk every frame (or at least as frequently as you deem is needed for your purposes) and then just check if hitActor is a pawn or something. Another option is checking of hitActor is implementing a blueprint interface you apply to all “highlightable” objects.