Ball collision with Paddle not working!

When I push play I go to the “Win” Screen after one scene. (I push the pause button and try to test the game but the game goes to the win scene right away.) I want the ball to stop on the paddle. Using Unity ver 4.7 .2f1.


image
Pause/Start
First Scene(win scene)

Hi,

You haven’t said whether the ball is moving or not so I will assume it is, I’m guessing it gets to the paddle then you “win”.

To debug, in your LoseCollider script, try outputting the name of the GameObject which is triggering the collision.

In your OnTriggerEnter2D method, add the following after your existing print statement.

Debug.Log("The object was : " + trigger.gameObject.name);

What is output?

I get “The object was : ball”

Hi James,

So, the ball falls, hits the paddle, but is also making contact with your LoseCollider.

I note that you have a radius on the ball of 10, from memory, I think the ball sprite was about 12px wide wasn’t it? It might be worth checking the Circle Collider 2D.

Also, if you edit your scene and place the ball just above the paddle, so that there is still a little distance for the ball to fall towards the paddle, does this issue still occur? Or does it only occur if the ball falls from a greater height and has a greater velocity?

Can you also pop a screenshot up of your scene, in Scene View, with the Lose Collider GameObject selected in the Hierarchy.

Thanks I think I fix the problem, I change the collider to .37 Radius. Now, the ball stops on the paddle.

1 Like

Great, glad to hear you’ve got it sorted and can move forwards again :slight_smile: