Get hit results sometimes returns invalid object

Hi,
I have put together simple scene. When you click and hold on the box you can dragg it around till you release the button. Problem is that while i’m dragging box around, get hit results sometimes returns invalid object even if the cursor is clearly over the box. Project attached, thanks for any advice

Hello,

I have had a look at your project, and have made a few alterations to your NewActor blueprint that allowed me to get smooth click-and-drag movement.

Instead of touching only that component, I just used Begin and End Input Touch nodes to open and close the gate. Also, instead of using the hit location to move the object, which caused it to cease to work if you moved the mouse too quickly off of the object, I have altered the setup to follow the mouse, or touch, position instead. Finally, I’ve added a variable, Distance from Screen, which you can set the default value of to your liking. This variable determines how far away the object that you are dragging will remain from the camera. Hopefully this setup will work for you, and feel free to ask any further questions.

Thanks a lot! Is there a way how to count default screen distance from actor? I was trying to count camera distance from actor but it doesn’t work as expected.

Could you clarify what you mean by count default screen distance from actor? Are you referring to the variable that I created called Distance from Screen?

I would like to achieve kind of pseudo 2D, box would move only in two axes, left to right, up to down but it’s let’s call it depth distance wouldn’t change. In your example is depth distance represented by variable Distance from Screen. Is this possible?

Distance from Screen controls how far from the camera the object is, which would be the same as what you are referring to as depth. If you create this variable in your blueprint, you can set the default value to be however far you’d like the object to be from the screen.