How to mimic a pinball flipper using physics?

I’m trying to build a pinball flipper blueprint using 4.9 preview…

My first attempt was to set the rotation using a timeline animation that played and reversed on button press and release. Pressing the left mouse button played the timeline which extended the flipper, and releasing button would reverse the animation, putting the flipper back at it’s “resting” position. It’s very simple and visually it works fine but since the flipper rotation isn’t being swept through space it’s physical interaction with the ball is not acceptable.

So I realize that the flipper needs to be implemented and driven using physics components but I’m not sure how I should go about this.

My guess is to use a physics constraint “hinge” with limited arc of movement and apply some strong angular force to it when the button is pressed, with it having another weaker force to return to it’s resting state when the button is not pressed.

However I’m finding the the documentation a bit confusing and there are very few tutorials on UE4 physics constraints.

Anyone have any good ideas on a realistic physics based flipper blueprint implementation?

Have you found a solution for this? Trying similar, with exact same problematic.

Anyone have any good ideas on a realistic physics based flipper blueprint implementation?

I am not sure it is “good” per se, but it is an idea: Leave the flipper as it is to roll the ball on it and make a separate logic for hitting the ball:

  • Mark the area the flipper sweeps by creating some trigger volume;
  • Get all ball objects in the volume when you hit the corresponding flipper key;
  • Calculate the impact angle based on the balls position, size and the predicted position of the flipper when it hits it;
  • Calculate the hit force buy the length of the arc the impact point on the flipper sweeps after the simulated impact.
  • Add a force to the ball depending on the impact angle.
  • Be very careful not to move the flipper above or on the ball during the “hit”. (you might need to do some manual moving of the ball here)

Any other way I can think of will need a deep understanding of the physical engine and some mad C++ and math skills. :wink:

Happy coding :slight_smile:

Maybe you can make something like this:

It will add impulse to the ball instantly, but you have to play with the flipper angular velocity and the ball mass to make it look more or less realistic. You may tick Vel Change in Add Impulse and see how it will behave with and without it ticked.