Clickable mesh, but also can be clicked somewhere else?

It might be a little confuse. So there’s this actor I created called “Drink”, and what I want to do is Click the cup to DESTROY! and yeah, the blueprint was worked, here’s what is looks like

But here’s the problem. I found out that when I clicked somewhere else, it transfer me to the next level. I know there’s a thing called Enable/Disable input but I don’t know how it works. I just want to click at the drink only. Please help

I actually I don’t know about blueprints much, even tho I use UE4 for almost 4 years…

It’s because you’re relying on mouse click. You can click the mouse any time you like! :slight_smile:

Only allow the mouse click when the player is in a collision volume near the object

This will still mean that the mouse click works when the player is NEAR the drink. If you really want to nail it down, you have to adopt the classic method which is line trance and blueprint interfaces.

Or consider what was suggested in the other thread about cup clicking / drinking.

Are you making something about day-drinking? If so, I’m in.

It’s a rehab app.

1 Like

Can you show me the blueprint please, I don’t really get it.

I’ll try, and also it’s not about day-drinking.

The cup blueprint needs an collision volume. When the player clicks, you can check if they are in the volume of not.

Thank you for sharing your thoughts on this. This forum is very informational.

It’s easy for you to add the collision volume, but it has two problems:

  1. The player can still click just because they are near the item, they technically could be facing the other way.

  2. You have to put a collision box on everything interactable.

Like I say, line trace followed by blueprint interface is the way, because they have to actually click ON-THE-CUP, but there’s more to learn:

Line trace:

Blueprint interface:

The problem is your current setup destroys the cup even when you don’t click on it.
This setup works. Put this in either the player controller or character blueprint!:


Note: Since the hit result function is a pure function, it may run twice (since it’s accessed twice), so for performance reasons, you can set the hit result to a variable before using it so that the trace only happens once.