How to move a mesh based on touch location?

Hi,

Anybody knows how to move mesh on x axisaccording to the touched location

Hello,

You might be able to reference the Blueprint Top Down template for your answer. Have a look at the MyController Blueprint, you’ll see the node Get Hit Result Under Finger by Channel attached to a Move to Hit Location function, these should give you an idea on how to proceed.

Let us know if you need more assistance!

-W

HI

that moves on all the axis i want to move only one x axis. But Touch function location details are different to how my mesh moves? So is there any way to get the location details in accordance to mesh?

Hello,

What if you try something like the following:

I used the Blueprint Side Scroller project and was able to move a mesh along the Z with the above Blueprint (but you could use it to move along the X as shown).

-W

Hi,

I am new to game development and Unreal Engine 4.

I have tried this blueprint but the problem is that its always setting sphere to location (0, 0, 0). Can you please help me how to set it to new location where I drag and release the object?

I know I should change break vector and make vector for setting it but I dont know how to do it. Can you please help me to solve this.

Thanks in advance!!!

This is the same issue that I’m getting. It’s setting my position to 0, 0, 0. Have you had any luck figuring this out purmo037?

I’m having the same problem. I’ve been moving objects along Z and Y, and they keep jumping back to 0,0,0 when I let go of them. It’s like the TouchEnd isn’t registering or something. I’d love to see a solution to this!

Same here’ I’d love to see a solution. My object will goto 0,0,0 as well. Not sure where it’s going wrong!

Hey guys, I managed to fix the ping back to 0,0,0 but It pings back to 0 on the axis I want my object to stay at upon releasing touch.

Just need to get it to stay at the desired location now! So close!

THE ULITIMATE ANSWER TO TAP AND DRAG!

Okay so you want to tap your object and move it along your desire axis and have it rest at the location when you take your finger off the screen?

Well…the fix is simple! Check this out:

It’s pretty much the same apart from i got a reference to the actor (in this case Self) and broke its vectors. Since i only want to use the Y axis, I plugged in Z and X into make vector so it will stay at the initial position of the actor before touch.

Plug that in to SetActorLocation.

To seal the deal…take the Released pin from the Input Touch event and plug it in to closed!

Here’s a screenshot for you all. Really hope it works for everyone else!

Hi,

I tried using your blueprint below to drag an object with the touch input but I get a weird problem where the object moves when clicking it and doesn’t drag correctly. It moves a bit with each click and when I attempt to drag it, it moves to 0,0,0.

Don’t suppose you had any similar issues when initially implementing it did you?

Thanks