I’m very new to unity and I wanted to test some of the functionality out so I started by trying to create a brickbreaker game. I correctly have edge bounds set up and a paddle. The ball bounces off all the walls fine and seems to only want to bounce off of the paddle 3-4 times and then it goes through it. Is there something I’m missing?
I assume the ball increases speed after every bounce? What happens is that it gets too fast – one frame it’s in front of the paddle, the next frame it’s behind the paddle, no collision is detected.
What I like to do for fast objects is, every frame, raycast from the new position of the ball to the position of the ball last frame and check collisions that way.
Hey TroubledMind! Welcome to the forum!So, you are trying to create a 3D version of a 2D game? Here are some guesses as to what might be wrong: For one, if the ball is traveling to fast, the physics engine could “slip up” and the ball would go on through. I don’t think that is the case here because if it were going that fast, the game would be unplayable. Another more likely problem is that (this being a 2D type of game) the ball is bouncing on the paddle properly, but it is not actually going through the paddle, but behind it. There are 3 dimensions in unity. One of these could be the problem, then again maybe not. If you post a screenshot of your game an add some more details it would help tremendously.
I think CgRobot is right, but if not, maybe try putting collision dectection on the rigidbody on your ball (assuming you have one) to continuous dynamic
Thank you I feel like such a klutz right now. For some reason it was drifting backwards in the Z direction. I was doing a reflect around the normal of the contact and though because I didn’t set any values to move in the Z direction (not initial velocity or anything) that it wouldn’t drift backwards. I fixed it and made sure the Z position was set to 0 each time. Thank you everyone for being so helpful.