3D Pinball flipper collision problems with ball.

2 Problems I have currently when the ball made contact with the flippers:

  • Sometimes the ball goes right through the flippers when the flippers swing.

  • As the ball rolls down the ramp that is connected to flippers, when it made contact with any one of those flippers, it bounces when it’s not suppose to.

In further regards to #2, I have placed a rigidbody component to the flippers. I can enable Is Kinematic and the ball is able to roll down from ramp to flipper smoothly without bouncing; however, the player is unable to press the corresponding key to trigger torque rotation to the flipper.

So my questions are how do I ensure the ball rolls down the ramp smoothly without any bounce when in contact with any flipper and how to prevent the ball from passing through the swing of any flipper?

Here are the settings for the flippers:

and here’s a snippet of the flipper script:

    void FixedUpdate()
        {
            //Quaternion Accelerate = Quaternion.Euler(upAngle * Time.deltaTime);
            //Quaternion Decelerate = Quaternion.Euler(downAngle * Time.deltaTime);
   
            /* For 1P Left Flipper */
            if (flipper.name == "1P_LeftFlipper")
            {
                if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKey(KeyCode.LeftArrow)) flipper.AddTorque(Vector3.down * TorquePower, ForceMode.Acceleration);
                else flipper.AddTorque(Vector3.up * TorquePower, ForceMode.Acceleration);
            }
   
            /* For 1P Right Flipper */
            if (flipper.name == "1P_RightFlipper")
            {
                if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKey(KeyCode.RightArrow)) flipper.AddTorque(Vector3.up * TorquePower, ForceMode.Acceleration);
                else flipper.AddTorque(Vector3.down * TorquePower, ForceMode.Acceleration);
            }
    }

Just an update:

To tackle my own problem on problem #1, I have adjusted the physics system (edit → Project Settings → Physics), by setting the Default Contact Offset from 0.01 to 0.09 and Default Solver Iteration from 6 to 20.

In the time system (edit → Project Settings → time), I adjusted the Time Scale from 1 to 1.5.

I am uncertain if there’s anything else I need to adjust nor am I certain what I am doing but it seems to give me more accurate results.

Problem #2 still persists with the ball bouncing between the edge of the ramp and flipper. How do I fix this?

So no one knows how to solve problem #2?

It’s been awhile now; I’ve been searching answers in Unity’s Answers section and trying to talk to Unity’s IRC community with no luck finding any.

Does anyone recommend what websites I can go to post my inquires and get quick responses?

Seriously? no one is going to respond to my inquires?

Apply a physics material to both the flipper ball and the ramp, set the friction high and the bounciness to 0. See if that helps.

Okay so it seems I’ve solved the problem in regards to #2.

In Unity’s GUI under rigidbody, I enabled isKinematic.

Then in the flipper script within Awake function, I set isKinematic to true.

Then in the FixedUpdate function, when I push the corresponding button to activate a certain flipper, isKinematic is set to false until it reaches back to it’s original orientation isKinematic is set back to true.

Here’s a snippet of my flipper script after:

void Awake()
    {
        flippers = new Rigidbody[4];
        flippers[0] = GameObject.Find("1P_LeftFlipper").GetComponent<Rigidbody>();
        flippers[1] = GameObject.Find("1P_RightFlipper").GetComponent<Rigidbody>();
        for (int i = 0; i < 2; i++)
        {
            flippers[i].rotation = Quaternion.identity;
            flippers[i].maxAngularVelocity = AngularVelocity;
            flippers[i].isKinematic = true;
        }
        Physics.IgnoreCollision(GetComponent<MeshCollider>(), BluePart);
    }

    void FixedUpdate()
    {
        /* For 1P Left Flipper */
        if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKey(KeyCode.LeftArrow))
        {
            flippers[0].isKinematic = false; // If the corresponding button is pushed, disable isKinematic.
            flippers[0].AddTorque(Vector3.down * TorquePower, ForceMode.Acceleration);
        }
        else
        {
            flippers[0].AddTorque(Vector3.up * TorquePower, ForceMode.Acceleration);
            if (flippers[0].rotation == Quaternion.identity) flippers[0].isKinematic = true; // Upon button release if flipper returns to original position, enable isKinematic.
        }

        /* For 1P Right Flipper */
        if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKey(KeyCode.RightArrow))
        {
            flippers[1].isKinematic = false;
            flippers[1].AddTorque(Vector3.up * TorquePower, ForceMode.Acceleration);
        }
        else
        {
            flippers[1].AddTorque(Vector3.down * TorquePower, ForceMode.Acceleration);
            if (flippers[1].rotation == Quaternion.identity) flippers[1].isKinematic = true;
        }
}