XY Physics - how would you approach this?

Hi guys,

i have a hard time figuring out how to solve this puzzle.

let me get you on the same page:

  • i use six dof mode to lock the z Position for all physical actors; so i only use x and y.
  • i got a player and a ball to shoot; the latter is currently shot with a radial force component placed in the player blueprint.
  • the shot strength is variable due to keydowntime and a multiplier.
  • how the player is moving his character does not really matter to me. at the Moment he is a ball using torque.

current Situation:
right now when you are shooting the ball no matter the method (Impulse, force, and so on) the result will be a straight line.

my goal:
i would like to store the players axis input in a variable (or use it on the fly) and use that value to “add an arc/curve” to the shot.

result should be something like this:
imagine you shoot the ball and turn your Gamepad stick sideways relative to the position where player and ball hit. the result should be a curved ball.
if youd shoot the ball and tilt the stick backwards relative to the hitpoint, the ball should go straight first and basically roll back to the position (and possibly beyond) where the shot took place.

do you think this is possible with physics? or do you think one should fake it… and how?

thank you so much for your ideas, hints and time!
daniel

If I understood you correctly, you want to make a curve, and not changing the ball’s linear movement angle, right?

For this approach, I would try simulating an extra fake rotator, that will change the balls rotation slightly depending on the intensity every frame.

Whenever you hit the ball, you inherit the player’s rotation accumulated the last ‘x’ frames/second (as you prefer) and manipulate the value as you which (invert the values, for instance).

The fake rotator will start rotating the ball slightly (every frame) towards its direction, and the catch here is that the ball will always move forward, but it is being rotated by an extra fake rotator, so it’s world relative rotation will change.

hello gbr,

thanks for your reply

i tried to use torque to quickly get results, but additional rotation does nothing for me?
i actually don’t know how to gradually rotate the ball over time.

Video: Screen capture - 7bb1183cc795310c576f82541299fae0 - Gyazo

Print: Screenshot - 24159fe59a4ff92778f000eff2656f41 - Gyazo

here is another Video example:

Edit:

the problem is the z position lock. but once i unlock it, the 2d game is not 2d anymore.