I'm following this tutorial to create PONG in Unity 2d :-
http://unity.grogansoft.com/beginners-guide-create-pong-clone-in-unity-part-6/
And understand the code for the most part, but this section confuses me. I have highlighted the confusing part in bold. I can't see in any of the code examples where the name of the ball is being checked? What am I missing?
Code:
void OnCollisionExit2D(Collision2D other)
{
float adjust = 5 * direction;
other.rigidbody.velocity = new Vector2(other.rigidbody.velocity.x, other.rigidbody.velocity.y + adjust);
}
We make sure the item hitting the paddle is the ball by checking its name, then we apply a force to its rigidbody in the direction of the paddle’s movement. This also has the pleasant side effect of adding a little extra speed to the ball, making it faster and faster as the game goes on.