Advertisement

Touch screen drag and drop issue

Started by May 27, 2018 02:31 PM
35 comments, last by davejones 6 years, 3 months ago
2 minutes ago, Scouting Ninja said:

Doesn't look like this is the problem.

The first problem I see is your "Payload" = Selected Asset. In http://api.unrealengine.com/INT/BlueprintAPI/UserInterface/CreateDrag_DropOperation/index.html we can see that the "Payload" needs to be the object we want to drop. The pivot is for the point where you are dragging from.

 

So what you need is two "create drag and drop operation" one for the handle and a relative one for the blade. This means you need some way to find the blade. When I get home I will make an example for you.

For now try to make two drag and drop functions one for the handle and one for the blade.

Ok thanks for the reply. I will do this now. 

Hi so I checked the oficial tutorial on drag and drop: https://docs.unrealengine.com/en-us/Engine/UMG/HowTo/DragAndDrop

So your code can work with two small tweaks. Make 2 widgets to drag, when one is dragged, drag both. When "On drop" is called, check if the sword blade widget is the one at the target. Should be really easy to do.

Advertisement
14 hours ago, Scouting Ninja said:

Hi so I checked the oficial tutorial on drag and drop: https://docs.unrealengine.com/en-us/Engine/UMG/HowTo/DragAndDrop

So your code can work with two small tweaks. Make 2 widgets to drag, when one is dragged, drag both. When "On drop" is called, check if the sword blade widget is the one at the target. Should be really easy to do.

When you say make 2 widgets is this 2 separate widget blueprints? Or one widget blueprint with 2 images? 

4 hours ago, davejones said:

When you say make 2 widgets is this 2 separate widget blueprints? Or one widget blueprint with 2 images?

Two separate widget blueprints if you want to use the code you already have.

The way it works is you create a temp widget when you start to drag, this temp widget will hold all the widgets you are dragging and send it to a Unreal blueprint made for dragging. This Blueprint gives you the collisions etc.

Then when you drop the HUD deletes the dragged object making a new HUD object at the point. Your HUD OnDrop function is where you check if it is the blade or handle that is dropped.

 

 

After doing the official tutorial yesterday I realize there is a infinite amount of ways the drag and drop can be used. So instead of making my own code for it, can you link images showing your:

OnMouseButtonDown  override.

OnDragDetected override.

 

Then from your Hud show me the OnDrop override.

 

If you link images if these 3 I can use your own code to make your idea work. Or if you want I can link my own overrides, but I don't know if you will understand it.

 

32 minutes ago, Scouting Ninja said:

Two separate widget blueprints if you want to use the code you already have.

The way it works is you create a temp widget when you start to drag, this temp widget will hold all the widgets you are dragging and send it to a Unreal blueprint made for dragging. This Blueprint gives you the collisions etc.

Then when you drop the HUD deletes the dragged object making a new HUD object at the point. Your HUD OnDrop function is where you check if it is the blade or handle that is dropped.

 

 

After doing the official tutorial yesterday I realize there is a infinite amount of ways the drag and drop can be used. So instead of making my own code for it, can you link images showing your:

OnMouseButtonDown  override.

OnDragDetected override.

 

Then from your Hud show me the OnDrop override.

 

If you link images if these 3 I can use your own code to make your idea work. Or if you want I can link my own overrides, but I don't know if you will understand it.

 

I will have a go at this and show you images of my overrides. If possible you could also link your own overrides to compare them with mine.  

57 minutes ago, Scouting Ninja said:

Two separate widget blueprints if you want to use the code you already have.

The way it works is you create a temp widget when you start to drag, this temp widget will hold all the widgets you are dragging and send it to a Unreal blueprint made for dragging. This Blueprint gives you the collisions etc.

Then when you drop the HUD deletes the dragged object making a new HUD object at the point. Your HUD OnDrop function is where you check if it is the blade or handle that is dropped.

 

 

After doing the official tutorial yesterday I realize there is a infinite amount of ways the drag and drop can be used. So instead of making my own code for it, can you link images showing your:

OnMouseButtonDown  override.

OnDragDetected override.

 

Then from your Hud show me the OnDrop override.

 

If you link images if these 3 I can use your own code to make your idea work. Or if you want I can link my own overrides, but I don't know if you will understand it.

 

 

onmousedownoveride.PNG

ondragdetectedoverride.PNG

ondropovveride.PNG

Advertisement

Thanks, I will get to it as soon as I can.

I see a few things that will have to change, like you are moving the UI around in your OnDragDetected, moving the UI could lead to a lot of problems so I will change that.

Your "Create drag operation" part uses the null class, this is why you have problems; you needed to make your own version for your code.

 

I will make a example of how to do it and then explain what each part does for you.

7 minutes ago, Scouting Ninja said:

Thanks, I will get to it as soon as I can.

I see a few things that will have to change, like you are moving the UI around in your OnDragDetected, moving the UI could lead to a lot of problems so I will change that.

Your "Create drag operation" part uses the null class, this is why you have problems; you needed to make your own version for your code.

 

I will make a example of how to do it and then explain what each part does for you.

Ok thanks for your reply. I am learning how to create my own versions of classes. How could moving the UI in the OnDragDetected lead to a lot of problems?  

3 hours ago, davejones said:

How could moving the UI in the OnDragDetected lead to a lot of problems?  

Moving the UI forces the UI to update, this forces all the anchors to update. In short it can be very slow.

Normally in a game the UI only updates at around 12 times per second. So this is what most UI code is expecting. Forcing it to update because you are moving stuff could result in other strange behaviour, like time displays, not the actual time, updating more than they should.

This is just two from my own experiences but there are lots of other reasons you don't want to move the actual widgets around.

 

23 hours ago, Scouting Ninja said:

Thanks, I will get to it as soon as I can.

I see a few things that will have to change, like you are moving the UI around in your OnDragDetected, moving the UI could lead to a lot of problems so I will change that.

Your "Create drag operation" part uses the null class, this is why you have problems; you needed to make your own version for your code.

 

I will make a example of how to do it and then explain what each part does for you.

Hi, have you had a chance to make the example? 

This topic is closed to new replies.

Advertisement