Blog Tutorial

Part 3 — Create the ball

In this part, we will add the first playable object: the ball.

By the end of this part, the ball will be visible in the Game view and moving under Lenga's 2D physics. The walls, paddle, and bricks arrive in later parts.

Open Level1

Open the Level1 scene in the editor.

A new scene already includes a camera, so you do not need to create one. If the Game view does not show the middle of the scene clearly, select the camera and adjust its position or size until the center of the play area is visible.

Use Ctrl+S on Windows or Linux, or Cmd+S on macOS, whenever you want to save your progress.

Add a Circle Primitive

In the Hierarchy panel, create a 2D circle primitive and rename it Ball.

Position it near the center of the scene. It should be easy to see in the Scene view and Game view.

A circle primitive gives us the visual shape of the ball. If the primitive does not already have a Circle Renderer, add one so the ball is visible when the game runs.

Add a Circle Collider

Select Ball and add a CircleCollider2D.

The renderer makes the ball visible. The collider gives it a physical shape. Without a collider, other physics objects will not have a surface to collide with.

Keep the collider as a normal collider, not a trigger.

Add a Rigidbody2D

Add a Rigidbody2D to Ball.

Set the body type to Dynamic. A dynamic body is controlled by the physics simulation: gravity can move it, forces can push it, and colliders can stop or redirect it.

Now press Play.

If gravity is enabled, the ball should fall. Stop the game and try changing Gravity Scale:

  • 1 lets gravity affect the ball.
  • 0 makes the ball ignore gravity.

For Breakout, set Gravity Scale to 0 after this test. We want the ball to move because we launch it, not because it falls like a platformer object.

Tip: This tiny experiment is worth doing. It makes the difference between a visual object, a collider, and a rigidbody feel concrete before we add more objects.

Set Collision Detection

For now, set the ball's collision detection to Discrete.

Later, when the ball is moving quickly, switch it to Continuous if it starts skipping through thin colliders. Discrete checks are cheaper and fine for slower objects. Continuous checks are safer for fast objects.

Checkpoint

At the end of this part, you should have:

  • an existing camera showing the scene
  • a Ball GameObject
  • a visible circle renderer
  • a CircleCollider2D
  • a Rigidbody2D set to Dynamic
  • gravity tested, then set back to 0

Next, we will add walls and colliders.