Creating a simple game based on the Physics system
We have learned the concepts of Unity's Physics system and discussed how to use C# code to interact with the Physics system. Next, we will use the knowledge we have learned to create a simple physics-based ping-pong game in Unity.
First, let's perform the following steps to create a Plane object as a ping-pong table:
- Right-click on the Hierarchy window to open the menu.
- Select 3D Object > Plane to create a new Plane object in the editor.
- Rename the Plane object to
Table
. - Select Table to open its Inspector window, modify the Z value of Scale to
2
, and we can see that a Mesh Collider has been added to this object by default.
- Let's create four Cube objects as walls on the table by selecting 3D Object > Cube, which...