How to use touch to drag a cube

I’m sure this has been asked a million times but I’m just starting out on blueprints and thought this would be quite simple.

I’ve basically started with a cube primitive in my level which I’m trying to drag from it’s starting location while touched (along x, y) and then dropped at it’s release location. The final part of this puzzle for me is to allow this to “snap” into a final location (probably with some kind of tolerance).

The current issue I’m seeing is that the touch input operates (obviously) in 3d space where the behaviour I’m trying to achieve will allow a cube to be moved along x & y, so presumably I need a component which gives the viewport location rather than the 3d space location of a finger.

The current issue I’m seeing is that
the touch input operates (obviously)
in 3d space where the behaviour I’m
trying to achieve will allow a cube to
be moved along x & y

Isn’t this the other way round? Player input is screen space and you want to move your object in world space.

You can Deproject screen to world to achieve the above.

so presumably I need a component which
gives the viewport location rather
than the 3d space location of a finger

Can you elaborate on how are you’re getting a 3d space location of a finger??

I feel you got it all backwards hence no answers.

This is confusing. In 2d you have XY. In 3d, in Unreal X if forward, Z is up.

I am assuming you want to translate 2d screen position into world position, right.

Something like this?

Image from Gyazo

Are we getting close or not at all :slight_smile:

Admittedly I’m probably not explaining myself very well. Here’s a diagram of what (I think) is happening and what I’m trying to achieve :slight_smile:

Aha I probably have my coords wrong then. In essence it’s puzzle game so there’s no player involved. The intent is that it’s a “2.5d” setup allowing the player to move blocks around. So the player will pickup blocks (on mobile) and move them left right - up down but not forward and backwards.

The component I’m using (again probably incorrect) seems to give me coords in the distance at the top of the viewport (quite rightly in a 3d game) but what I want is for forward-backwards to be irrelevant and only up-down / left-right.

Am I confusing matters more? :wink:

The camera is also fixed - so it’s face on to the play area.