Throw a ball!

Hi everyone,

I’m trying to write a blueprint to throw a ball.

I wish that by swiping my finger on the screen I could define the pitch and yaw of the thrown ball!

For now I got here but I miss understanding how to transform vectors into degrees to be communicated to the Yaew and Pitch pins.

Does anyone have any suggestions to help me understand which direction I am going to take?

Hi @Delemir78
The spawn actor from class, have only the trasnform rotation, it will not “launch the ball” only set the rotation of the ball at start.

to Throw the ball, you want “add an impulse” to the ball , and the ball must have physics activated.

As you can see the add impulse work with a vector3.
Using the touch will give you 2 axis, for the 3°value you need to fit in the direction of the throw?
Beware that in this setup.the values will change on every device!
Touching the screen in the corner left will fire a 0, 0, in the corner right a “max screensize” (smartphone 700, tablet 1600 ?)
you need to work with fractions or force a resolution for all.