Search Unity

Impossible physics situation happening

Discussion in 'Physics' started by alexxjaz, Oct 18, 2019.

  1. alexxjaz

    alexxjaz

    Joined:
    Sep 18, 2018
    Posts:
    45
    Hello, so Im making an arkanoid and I have a little problem.
    In X situation, i dont know when or why yet this problem will happen (video). Now it happened at the bottom and would not be a problem since he would lose, but it can happen in the top too.

    In theory that would be impossible, since it will check its direction with a Vector3.Refrect.

    Code (CSharp):
    1.     void OnCollisionEnter(Collision col)
    2.     {
    3.         ContactPoint cp = col.contacts[0];
    4.         rb.velocity = Vector3.Reflect(lastVelocity, cp.normal);
    5.  
    6.         GameCallbacks.instance.cbBallCollider(col.gameObject);
    7.     }


    I dont see nothing wrong in the code, so I think its a physics problem and I dont think its the scale of the project since it has 10m height.
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    Try this:
    • Ensure the physics material in the ball is configured so the resulting bouncing value is 1 (e.g. Bounciness = 1, Bounce Combine = Maximum).
    • Configure Bounce Threshold = 0 in Edit > Project Settings > Physics
     
  3. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Start logging collision data like angle & velocity, draw rays along normals and reflection vector, see what happens that causes it to jump like that.