Bouncing ball loop - preventing loops

I actually just used the gravity settings and the velocity settings on physics material to fix a lot of the ball loop issues. Since my blocks are all breakable (to varying degrees) I don’t get the same types of issues that those who completely followed this course seem to get. Instead I found a few of my own issues that I’ve been trying to fix.

The biggest issues I feel are interactions between the paddle and ball (or whatever projectile you’re using) and velocity vectors (changes in speed and direction based on collisions between paddle and ball).
An example is when the projectile moves too fast to interact with the paddle’s collider and phases through. In my game’s case it’s a partial phasing, that drops the momentum.

At the moment I’ll probably keep those quirks in, since they don’t diminish gameplay too much, but it’s good to note for any updates I would like to do or other games I’d like to make.

You may want to look at tinkering around with the Rigidbody components of your ball to try and address the phasing that you are describing.

I observed the same early into the course before we locked Y axis for our paddle and was just violently shimmying it around the play space :smile:
There was also a scenario plaguing me where the ball would squeeze between the colliders of two blocks when it should never have fit.

The below did the trick for me:

Ball\Rigidbody 2D\

  • Collision Detection: Continuous
  • Interpolate: Interpolate
1 Like

The phasing issue is just a matter of the colliders not registering a high velocity object. There’s a few ways to go around that, one being to limit velocity (and velocity build-up) as much as possible. I’m already pretty far into this course (and some others too), so I have learned of some other tricks to reduce these sorts of issues. I think Ben stated it best in one of the wrap up sessions - ‘use the in-built Unity tools like the physics engine to tweak things.’ I agree, since tweaking in the editor is far easier then trying to muscle through via pure code.

Privacy & Terms