Satisfy both BeginOverlap & Cursor Over to enable input

I’m trying to toggle a HUD icon when both the player has overlapped a collision box, and placed the cursor over the specified object.

This is in first person mode, so i’m not sure if the “OnBeginCursorOver” event is applicable. I suppose whatever the center pixel is placed over the object.

My blueprint below works as if the “OnBeginCursorOver” events don’t exist.

image?

In the PlayerController you need to enable mouse events,

When you link 2 execution wires (white lines) from events, it’s like saying “if either event fires execute xxxx”.

What you want to do instead is create bool variable and call it something like bOverlapping. Set it to true in the OnBeginOverlap and false in the OnEndOverlap, disconnect EnableInput node from this event.

Now, in the OnBeginCursorOver event check if the overlapping flag is set and only then enable input.


I’m on my phone at the moment so can’t show it to you on BP image, but if you’re still struggling with achieving the goal in couple of hours let me know and I’ll put a sample together. Good luck.

I can give you the step by step, but it sounds like you’re missing some Blueprints basics (like creating variables) that will catch up with you eventually. I strongly recommend you watch Epic’s official Blueprint tutorials on their youtube channel:

Introduction to Blueprints (v4.8)

Thanks Phoboz, but I can’t find the bool variable you’re talking about. None of them can connect to BeginOverlap. I might need a step by step.

Hi Phoboz, I went through the videos, so I hope I got this variable correct. But I don’t quite understand your instructions.
The BP doesn’t make sense to me, and it doesn’t work. What did I do wrong?

btw I enabled mouse events. So the icon does show up only if I stand in a certain area and pointing at a certain part of the object. Sometimes it even activates when pointing just outside the object.

The image doesn’t show, try editing the comment.

Here’s a sample of what I had in mind

Variable setup

And the events

Thanks Phoboz. Let me try attaching my image again.

If that doesn’t work: http://imgur.com/5Zx1ZDL

I think I understand now. I needed to create a get variable that references the set variable and plug it into a branch to combine the two events.
Also is the Set variable for the EndOverlap event redundent?

Now I have to figure out why the mouse over event only works on random areas of the object.

You need the set variable for EndOverlap to indicate you’re no longer overlapping (notice the variable is unchecked).

As for the random areas of the object, that might be dependent on the collision shape. Unreal is using a simple collision shapes by default and those, in most cases, don’t accurately match the object’s real shape.

Follow this link to instructions on how you can improve the collision accuracy.

Alternatively, you can use full complex collision. This will give you best results, but will also have the highest impact on the performance. You can do this by double clicking your mesh in the Content Browser and changing Collision Complexity property to Use Complex Collision As Simple.