0
\$\begingroup\$

I have two spheres on a plane.
I'm applying AddForce to the first ball after which it collides with the second one. The weird thing is that the impulse is not passing from the first ball to the second ball as good as it should after the collision. In the real world (say in a pool game) when you hit the cue ball (with stun) and it collides with another ball, the impulse is passing from the first ball to the second ball and the cue ball almost stops rolling, but in my game, the cue ball still is rolling with HIGHER velocity than the second ball.
Is it physics engine bug or am I doing something wrong?
How can fix this?

My setups:

The physics material of the plane:

enter image description here

The physics material of the ball: enter image description here

The ball properties: enter image description here

The code:

public class Ball : MonoBehaviour {

    Rigidbody rb;

    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody>();
        rb.maxAngularVelocity = 400;    
    }

    // Update is called once per framf
    bool isHitting = false;
    void Update () {
        if (!isHitting) {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                hit();
            }   
        }
    }

    void hit() {
        isHitting = true;    
        var force = 1f;
        rb.AddForce(force * transform.forward.normalized, ForceMode.Impulse);
        //rb.AddTorque(-transform.right.normalized * force, ForceMode.Impulse);
    }    
}

Demo video: https://youtu.be/9joBQpgPjxc

\$\endgroup\$
  • \$\begingroup\$ You should probably set the bounciness setting in your physics material to 0 \$\endgroup\$ – Gabriele Vierti Jan 10 at 8:57

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.