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"

Dragging from button to world

I'm trying to drag from a button to the world to spawn an actor.

I already have working logic for touching (everything uses a touches because the target device is mobile) on the actors and dragging them toil move them in the world. This works by setting the actor's location to the X and Y location of a broken hit (get hit result under finger by channel)

My plan was to use the UI button's on pressed event to spawn the new actor and set the dragging bool to be true, and then my other logic would take over and the new actor would follow under the finger until released.

The problem is that after pressing and dragging from the button, I don't get any "hits" under the finger so the newly spawned object never moves. However, if I keep my finger down and drag the cursor out of the play in editor window onto the editor's UI, then BACK into the play in editor window, all without lifting the mouse button (mouse simulating touch) then the newly spawned object will snap to the cursor and move in the desired way.

So I'm thinking it is some kind of focusing issue since everything starts with touching on a button instead of the world... Is there any way I can start getting world space location under the cursor in the middle of a touch event that originated over a HUD widget? Or is there a better way to implement this functionality?

Product Version: Not Selected
Tags:
more ▼

asked Dec 26 '15 at 11:18 PM in Blueprint Scripting

avatar image

USMC1812
26 5 12 9

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

1 answer: sort voted first

Just following up for anyone else that is running into the same sort of problem:

Turns out the primary remedy to my problem was to set the button's click and touch methods to precise click and precise tap. That sort of worked with my previous implementation, but it would cause the editor to crash constantly when testing it, I'm not really sure why.

I ended up implementing drag and drop functionality on the buttons, and on the drop function in the HUD, I then call the create function in my player controller which then does a quick hit scan under the finger or cursor and then places the actor at that location.

The only thing that doesn't work this way is having the actor stuck to the cursor while dragging, I need to use a UI widget for the drag visual.

more ▼

answered Dec 31 '15 at 05:33 AM

avatar image

USMC1812
26 5 12 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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