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"

Using Widget Button to rotate/move a physichandle

I need to move/rotate an physics handle holding and object by pressing widget buttons. Until now i can do this by holding down keyboard inputs. I cannot achieve the same results by holding down widget buttons.

I though it would be something simple to do, but Im not finding a solution. I need this to work because end-user will be interacting thru touch devices, no keyboards or other controller. Keys will appear on screen/viewport

Any advice? https://www.dropbox.com/s/bey2sjap565x9nl/Screenshot_move_by_widget_button.jpg?dl=0

Thanks in advance

Product Version: UE 4.21
more ▼

asked Feb 23 '19 at 04:12 PM in Blueprint Scripting

avatar image

Lord Pol
35 8 8 14

avatar image Elou44 Feb 23 '19 at 05:05 PM

You need to better explain where you are stuck at. Is it a communication problem between the widget blueprint hosting the buttons and the blueprint of the physic handle?

avatar image Lord Pol Feb 23 '19 at 05:11 PM

Right. The problem is that Widget Button do not behaves as keyboard button input. I can control perfectly control the physics handle movement and rotation with keyboard. In this case with Y for up and U for down.

But i don´t know how use a widget button as keyboard input axis. If it´s possible.

avatar image Elou44 Feb 23 '19 at 05:32 PM

Ok, so if I understand correctly, your system works with the InputAxis node because this node is called every frames. Now you want to do the same with two widget buttons : one that you hold to move the handle down and the other one that you hold to move the handle up. Is that correct?

avatar image Lord Pol Feb 23 '19 at 05:35 PM

Exactly that!

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

1 answer: sort voted first

A grown up approach here is to extend a button, wrap it in a widget and override its OnKeyDown.

A quick and dirty hackaround would look like this instead:

alt text

Pick your poison.

edit: And yet another alternative is to have a Player Controller input call a custom event inside the widget.

hackaround.png (154.4 kB)
more ▼

answered Feb 23 '19 at 05:42 PM

avatar image

15.3k 77 26 62

avatar image Lord Pol Feb 23 '19 at 06:21 PM

Could you explain a little bit the last alternative ? You mean to communicate an input from Player Controller to a Widget BUTTON?....

avatar image Everynone Feb 23 '19 at 06:58 PM

Sure, providing you've extended the button - it then becomes a standalone widget anything can talk to. You can have a Custom Event feed data to an overriden onKeyDown or a Tick solution. It's probably over the top, kind of depends on what you're doing. For something simple go for the hackaround.

And yet another alternative is to use an Event Dispatcher from the widget to the Player Controller - this can be useful:

  • you generally want as much functionality outside of the widgets as possible

  • you may have stuff set up in the Player Controller already

  • no need to create direct references and no expensive casting

  • no more Accessed None errors if you lose your widget for any reason

edit: to clarify the Event Dispatcher thing:

In the widget:

alt text

in the Player Controller:

alt text

This allows you to hook up the buttons to the already existing setup you may have anywhere else. Also, becomes pretty much an indispensable way of sending a bunch of data once your interface becomes somewhat complicated.

wigdgetwithed.png (150.0 kB)
pc.png (206.7 kB)
avatar image Lord Pol Feb 23 '19 at 07:06 PM

Ok, yes. I need to keep all functionality inside my Player controller, so I go for your last alternative. Thanks you very much, man. I promise I´ll come back to mark it as solved : )

avatar image Everynone Feb 23 '19 at 07:13 PM

Do tell if you get it to work the way you need!

avatar image Lord Pol Feb 25 '19 at 02:12 PM

Sir, you are a master. Worked! I don´t understand the logic of EventDispatcher very well, i´m still learning but... is working!. Thank you very much!!

(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