playMaker

Author Topic: Pinball flipper problem [SOLVED]  (Read 890 times)

3D Lunatic

  • Playmaker Newbie
  • *
  • Posts: 17
Pinball flipper problem [SOLVED]
« on: October 10, 2019, 02:34:18 PM »
I set up an FSM to control flippers in my pinball game. They work fine.
I'm rotating the flippers kinetically, using the DO Tween Rigidbody Rotate action, as I installed the DOTween PlayMaker actions. This allows me to rotate the flipper 30 degrees in 0.1 seconds, which looks right. I tried 0.2 seconds but it looked too slow.

The problem is when the flipper hits the ball, it flies way too far. I tried different methods to slow it down, but nothing seems to work well. When I put a lot of drag on the ball, it just looks sluggish. When I slow down the rotation speed of the flipper, it also looks slo-mo. I tried increasing the mass of the ball, but that makes no difference. In kinematic mode, the flipper has infinite mass and force, so the mass of the ball is irrelevant. I tried reducing the bounciness of the physics material on the flipper and the ball, but it doesn't affect how high the flipper hits it.

Is there anything I can do to reduce the energy of the flipper hitting the ball, or to limit the ball speed? Is there another action I should use instead of DO Tween Rigidbody Rotate? If I change the flipper to Dynamic, I can use the Hinge component to drive the flipper, and I can specify the maximum force. The problem is firstly that this is more costly in terms of processing than driving the flippers kinematically, and secondly it results in some undesirable behavior. I think the flippers should be kinematic. But how to limit the force with which they hit the ball?

Thanks in advance for constructive replies.
« Last Edit: October 14, 2019, 02:51:33 AM by 3D Lunatic »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Pinball flipper problem
« Reply #1 on: October 11, 2019, 02:22:36 AM »
Hi,

 For this, you need to constraint its velocity for the next 2 seconds after it 's been hit to the max velocity you want.

use Vector3ClampMagnitude for this. Get the velocity, clamp it, reassign the velocity back. do that every frame for 1 or 2 seconds and then let it go.

Bye,

 Jean