Problem with Mouse_Interaction blueprint

Hi all,

I’ve only just started with UE4 and so excuse me if I’m asking any stupid questions, but I’ve noticed there is an issue with the Mouse_Intersection BP example. It works reasonably well, but on occasions, when the leftMouse button is held down on a sphere and I move the mouse, the drag function will suddenly stop working even though I haven’t released the mouse button. (note: I’m not moving the dragged sphere over another sphere either, which does cause another problem with too, but one that kind of makes sense.)

In the debug flow I can see that just before the drag function stops working, both the OnBeginCursorOver and OnEndCursorOver events are fired at exactly the same time. I’m not sure why this would happen but has anyone else experienced this?

Anyway, I thought that one way of fixing it would be disable mouse over events for all the objects while a mouse button is held down. I’m just not sure how I would do this. Programmatically, I would add something like a static bool to the class and use it to control when mouseOver events are fired. Anything like this in blueprints?

Thanks
6

I’ve seen this as well. I’m messing with dragging stuff myself, and will see if in code it makes a difference.

Thanks Dejan. I only started looking at Blueprints last night and thought the Mouse functions would be a good place to start as they should have been easy :eek:.

I think understanding and using BP’s is going to require quite a different mindset to what I use for plain old coding! Still, it’s early days yet and I’m sure I’ll come to love it.

I’ve implemented code to handle dragging a selection handle with the mouse, and I am not seeing the jumpiness in the example, it’s very smooth. Well, I did see jumpiness in my early version, but because of a logic error on my part and not ensuring that variables only change when they are supposed to. This leads me to believe it’s either a problem with how the dragging logic was designed in the blueprint, or there’s an actual bug in the blueprint implementation.

Yes, I suspect there is a bug in the mouse events somewhere as I can see that OnBeginCursorOver and OnEndCursorOver get fired and random times while an object is being dragged. A possible workaround is to add some kind of logic immediately after these particular events to first check if the OnReleased event has been called. If it has then continue as normal, else do nothing and continue dragging.

One thought is that these events might be fired from objects that are not currently being dragged. You could look at AHUD::ReceiveHitBoxClick to “select” the object (save it in a variable) and set an IsDragging variable, then move it around until you get any release event (AHUD::ReceiveHitBoxRelease and/or bind a mouse release event, see this post).

I know we are in the blueprint forum, and this is code, but maybe this can help figure out a better design logic for the blueprint.

Hi all I’m just learning UE4 and came across this issue too. I found that the problem comes from the fact that “Get Hit Result Under Cursor By Channel” doesn’t always return the sphere actor as you would expect, sometimes it’ll return the demoroom and things go wacky from there.