x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.22
Tags:
more ▼

asked Apr 03 '19 at 01:17 PM in Blueprint Scripting

avatar image

codity
1 1 1

avatar image Everynone Apr 03 '19 at 07:22 PM

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.

avatar image codity Apr 03 '19 at 08:31 PM

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 :)alt text

question.png (30.6 kB)
avatar image Everynone Apr 03 '19 at 08:51 PM

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 :)

avatar image codity Apr 03 '19 at 08:57 PM

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? ;)

avatar image codity Apr 03 '19 at 08:58 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question