My game uses rigidbodies and there is a pinball component. Since rigidbodies work fine for all the other mechanics, I’d prefer to not implement my own physics system. But I’m having issues with the flippers interacting with the ball. If the flipper launches the ball at a certain distance from the rotation point, the ball takes a weird trajectory.
The flippers are hinge joints.
Both the ball and flippers have Continuous Dynamic collision detection (speculative on ball caused some weird interactions).
All parts (flipper, ball, wall, floors) have separate physics materials, but changing friction/bounciness didn’t solve the issue.
I set up a test scene with a debug script, dropping the ball from two separate position (red & yellow), which gives the ball different speed when it touches the flipper, and then launch the ball at different positions.
That was my idea as well, but as I mentioned in OP, changing friction/bounciness didn’t help noticeably. (It did change the trajectories of the ball, but the anomalies remained, just occurred at different points)
The speed of the ball is changed by having two different spawn points for red & yellow (can be seen in the video). The physics handle the rest. I just chose two semi-random spawn points.
Not an actual solution using Rigidbodies, just a workaround.
Basically, when I press the flipper, I store the ball’s velocity, enable isKinematic and parent the ball to the flipper. Then when the flipper reaches the end position, I unparent the ball from the flipper, disable isKinematic and calculate a force, using the stored velocity and the ball’s distance from the rotation point of the flipper, which I apply to the ball.
A bit messy, but works.
Thanks for the reply!
For me using a mesh collider for the flipper (instead of multiple primitive colliders), with interpolation and continues dynamic collision detections, seems to work.