Set Up The Scene¶
Pong features two paddles, a ball and walls that confine the ball. In this section, you will create them using FPhysics2D.
FPhysics2DManager¶
For your first step, you will create a FPhysics2DManager. Right-Click in the Hierarchy window and select SocketWeaver->FPhysics->2D->Physics Controller.

The FPhysics2DManager controls the FPhysics engine and manages rigidbodies in the scene.
Disable Auto Initialize and Auto Update because you will manually initialize the FPhysics engine and manually update it.

Rigidbodies¶
Next, you will create the following Rigidbodies.
| Name | Body Type | Description |
|---|---|---|
| Ball | Dynamic | Controlled by physics |
| Paddles | Kinematic | Controlled by players |
| Walls | Staic | Do not move |
Ball¶
- Select
SocketWeaver->FPhysics->2D->Circle. A circle should be created at (0, 0, 0). - Select the circle and name it
Ball. - Select the
FCircleColliderof theBalland setBouncinessto 1.
Paddles¶
- Select
SocketWeaver->FPhysics->2D->Box. A box should be created. - Select the box and name it
Paddle. - Move the
Paddleto (-10, 0, 0). - Set the
Scaleof thePaddleto (1, 3, 1). - Select the
FBoxCollider2Dof thePaddleand setBouncinessto 1. - Select the
FRigidbody2Dof thePaddleand setBodyTypetoKinematic. - Drag the
Paddleto the Project window to make it a prefab and make another Paddle at (10, 0, 0).
Walls¶
- Select
SocketWeaver->FPhysics->2D->Box. - Select the box and name it
Wall. - Move the
Wallto (0, 6, 0). - Set the Scale of
Wallto (21, 1, 1). - Select the
FRigidbody2Dof theWalland setBodyTypetoStatic. - Duplicate the
Walland place the duplicatedWall (1)at (0, -6, 0).
Final Touch¶
You can change the color of the sprite to your liking. The scene should look like.
