Object stuck in a loop

hi everyone,

I’m building a simple 3Dpong game and im having an issue where the ball sometimes gets stuck in a loop bouncing from top wall to bottom wall. does it behave like this because the mass/friction or physics setup is incorrect or is it because you cant rely on physics alone and I need to use some logic in order to unstuck the object from the loop.
the ball has mass=0.0001, friction = 0 and collision detection set to continuous and a physics material with bounce=0,
153387-ezgif-1-de8d52a948f8.gif

thanks!

I feel like this is something that can happen naturally when the physics is set up - I’ve seen this happen on a real air hockey table, just not infinitely.

One approach to solving this would be to add a short timer (3ish seconds) every time the ball hits a paddle. Then when the timer elapsed, if it hasn’t hit the other paddle yet, to gradually apply a force to the ball pointing in the direction of the last paddle it hit.
You want that force to start very small and very slowly accelerate so that it doesn’t appear to suddenly change directions when the timer elapses, as that would make it hard to line up a shot. Instead, it would be as if the floor was slightly tilted toward the other paddle and gravity was causing it to slowly accelerate.

Another option would be to have code in OnCollisionEnter which uses ContactPoint.normal to check if the angle is too small (perhaps via Vector3.Dot(myRigidBody.velocity, myContactPoint.normal) > 0.95 or something) and in that case, apply a very small force in just that frame to snap it out.

Add some some mass and friction in the rigidbody to act realistically