Click to drag actor not working correctly

So I am trying to make it so I can click an actor and hold to be able to drag it around the level. The problem I am having with it now is that when I start to drag it will seem to send the actor to 0,0,0 location in the level. I cant seem to figure out why this is happening.

You’re not checking if your HIT is actually returning TRUE. Odds are it’s not detecting the object being touched.

I’ve never used/seen the Get hit Result Under Cursor node but make sure it’s actually hitting. You could also use get cursor position and translate that to world space (it returns screen space). Don’t have my editor in front of me but that should get you started.

It is hitting what it should be hitting I just checked. I will try the get cursor position way right now and see if that will work better.

You could try using Impact Point as well, but either should return something other than 0,0,0. How are you sure it’s hitting the actor? Instead of using a reference of the actor within SetWorldLocation you could use the Hit Actor value from the hit to be sure it’s hitting the right actor.

With what you’re doing now you might as well not even call a trace. You could just get screen location of mouse (which works with touch) and convert then move to that location.

That’s because the returned value is a snippet of actual world space. Try this:

The Make Transform can be left out in your situation.

You can read the full post here: [SOLVED] Mouse location to world space - Blueprint - Unreal Engine Forums

Ok so this does work but the only thing is now is that the object isn’t directly underneath the mouse cursor. Is there anyway to fix that?

This works perfectly thank you! :smiley: So my goal is to make an angry birds type game and this works perfect for the pull back but it doesn’t seem to be adding the force when I release from the pull back.

I recommend setting an initial point variable, and an end point variable once touch is released. Then call a new custom event and use those variables. It will make your blueprints MUCH easier to follow and you’ll be glad you did as you progress.

I think you want to use Get Length Vector 3 but I don’t have my engine up in front of me. Then you can add a multiplier onto the result.

If that doesn’t work start a new question and post the link to it here. That will help others with similar problems in finding a solution.

If anyone wants to know how to apply force with the above question I started another question here