Download

Drag & Drop spawn

Hi! I want to make a game similar to clash royale, but i cant make that the actor will spawn under the drag result. I drag the card to somewhere, stop, and i need that actor will spawn where i drop the card. Please, tell me how i can do this.

I dont know how you made your card system, but you should just get the location where the card is in the “real” world and spawn an actor from class.

Sorry, i tried to think about it, but i dont get it

Cards is whidgets.

I try to explain it further. If you still need help just reply again :slight_smile:.
So. You need to get the ground point under the widget so we can spawn our blueprint.
See the image below for BP instuctions:

1 Like

Thank you! But i have a question. What do i need to plug into the screen position?

where on the screen the object is being created. like where the card widget is on the canvas or whatever.

theres also these nodes that do roughly the same thing

note the mouse cursor one will be fine to just call right before spawning, but if you use the touch on mobile, your going to need to record the location as you move the card. so you would be better of doing Probezeit’s way (getting the screen position of the widget).

But if card whidget position is updating, how do i update the variable? From Tick?

no, you just need the last location so when ever it is dropped/released. thats when you would do the line trace and feed the hit result into the transform of the thing you want to spawn in.

1 Like

No, you dont get it. What am i need to do with variable Card Pos? Can you please show me on screenshot what i need to do?
изображение_2021-12-28_172323

You should get a child that is in the middle of the playing card. I would recommend you to add any type of a widget child (button, image etc.) in the middle of your card. Then make it collapsed. Then the parent should be your canvas panel. If not add one and make it the parent of your widget child. Then you need to plug the node Slot as Canvas Slot. Then get the location and you are good to go.

I get this.

Yes, perfect. This is position X0 Y0. Now you only need to get the position of your card like I explained above.

And you need to change something else, as you aren’t looking from top as I can see. Wait a minute I need to start my pc.

I dont get how i can set the parent

This is how you can set your parent.


And you need to change that in order to get the correct position.

Now basically nothing works at all.

It works. Put a card in the middle of your screen. So the Line Trace hits the floor.