pull throw mechanics

Hello! I’m working on a game and the moves in the game are as follows; you create a swipe with your finger on the screen and the character moves to the opposite side of it.

This works correctly. What I don’t know is how to make an arrow to show my character’s movement direction and movement size according to my finger’s movement direction and pull size.

I DONT KNOW ABOUT TOUCH MECHANICS

BUT THERE IS GET CONTROL ROTATION THAT YOU CAN USE TO FIND THE FORWARD ROTATION OF YOUR PLAYER PAWN

Any ideas on making an arrow pointing in the direction it’s going?

Is there anyone who can help me with this?

Just to have a reference: Is this 2d like Angry Birds?

1 Like

Yes it’s like it

i can make this into a tutorial if you want.

i can call it like.

and i know you were going to do a mobile game i think? i dont know that i cant help you with taht thats really hard to me like impossible i dont even have an android phone to test

Slingshot
UE 5.2.1:
Slingshot.zip (68.1 KB)


Edit → Project settings → Engine → Input → Mouse properties: Use Mouse for touch.

2 Likes

Can you help me with this?

@Reis-6-1 There is a project attached in @pezzott1’s post. Download, open and take it apart.

2 Likes

I think I didn’t ask my question correctly. I have a system as you can see in the video below. Everything is correct so far. What I want is to make a dynamic arrow that shows the direction the character will fly while I’m pulling.

a

There’s quite a number of ways to make an arrow, start by using a debug arrow, like so:

Once you have it going, figure out how you want it to look.

  • a 2d / 3d widget
  • a stretched mesh
  • a spline mesh component
  • particles (ribbon, most likely)
  • something else?

All of these could work, depending on what’s needed. If you’re not sure what method to choose, perhaps you could provide a visual reference instead. For example, at a glance this looks like a 2d widget:

1 Like

Hello after a long time, I have reviewed and tried your message but unfortunately I could not adapt it to my project. My project is too late and I need help. Please find a way

Please find a way to do what? Read my my post above. Do you already have a correct behaviour that draws a debug arrow?

1 Like

Here I applied your post and the effect is as below. First of all, I would like to remind you that my camera is fixed, then as you can see, there is no movement in the opposite direction of the direction I shot and the arrow is not drawn properly. I will be very glad for your help.


kodad Preview NetMode_ Standalone (64-bit_Windows) 2023-08-13 11-15-57 (online-video-cutter.com)

No, I mean, how would you like the arrow to look? Please read my message with the bullet points.

Scripting a spline arrow would be very different from a 2d widget, for example.

1 Like

Wouldn’t the 2D widget be more useful, am I wrong?

Is there anyone who can help?

  • note how the overlay is aligned in the canvas:

This will allow you to rotate it around the pivot accurately. The arrow is made out of shaft and tip. You could make it out of a single element but then you’d need work with 9-slice margins to scale it appropriately and avoid distorted stretching.

  • when mouse / touch goes down, we record a couple of vectors and send them to the widget:

  • the widget converts 3d vectors into 2d + angle:

In short:

  • we place the widget where the actor is in Screen Space
  • we stretch the overlay Size Y based off the abovementioned pivot and distance
  • we derive the angle from the relative 2d vector


Be mindful of the details, for example - the Line Plane Intersection node in your pic is missing Plane Normal.

1 Like

Material, there’s probably a cool and efficient way of drawing it purely in material.

Wouldn’t the 2D widget be more useful, am I wrong?

Not wrong. But I’d personally gravitate towards Spline + Spline Mesh Component or a Niagara Ribbon. Both live in world space and may end up looking much better in this instance. Rotating widgets leads to ugly aliasing that only pushing through a retainer box can make look half decent.

But this is an artistic choice that is, ultimately, up to you.


And lastly, in the above example the math could be done in pure 2D - would be probably less finicky, but then you’d need to send a 3d vector to the physically simulated cube anyway. :person_shrugging:

1 Like