Right-click in the hierarchy window > 3D object > Cube, name it "Platform", in the inspector window:
- Click Add Component > Rigidbody
- In the Rigidbody component:
- Change "Mass" to 10000 (Changing the mass of the platform to 10000 will make the platform unaffected by the momentum of the ball.)
- Change Angular Drag to 0
- Uncheck "Use Gravity"
- Change "Collison Detection" to Continuous
- Under Constraints; check Freeze Position Y and Z
- Under Constraints; check Freeze Rotation X, Y, and Z (to stop the ball from rolling)
In the Project window, right click on Assets> Create > Folder, name it "Material"
In the Material folder, right-click > Create > Material, name it "Dirt" > in the Inspector window:
- In color container, change it to brown
Drag the Dirt material onto the Platform gameobject
Right click on Platform > 3D object > Cube // need some description of child: term are important to learn
Right-click on the Cube > Rename > name it "Grass"
Click on the Grass > in the inspector window:
- Remove the "Box Collider" component by clicking on the 3 dots > Remove Component
- Change Position Y to 0.5
- Change Scale X to 1.01, Scale Y to 0.05, Scale Z to 1.01 (increasing the X and Z scale by 0.01 will help the engine to render grass over dirt)
Right-click again in the material folder > Create > Material
Name the material "Grass" > in the color container, change it to green
Drag the Grass material onto the Grass gameobject
Click on Assets in Project window > right-click > Create > Folder, name it "Prefabs" (Prefab stands for prefabricated building and it is useful for replicating a GameObject with similar component content)
Drag the platform to the folder
Click on Assets in Project window > right-click > Create > Folder, name it "Physics Material"
Right-click inside the folder > Create > Physics Material
Name it "NoFriction". In the inspector window:
- Change Dynamic and Static Friction to 0
- Change Friction Combine and Bounce Combine to Minimum
(physics material "NoFriction" is added to that platform prefab so that the ball can move on the platform without any friction)
Select the Platform prefab in the Prefab folder. In the inspector window:
- From the Physics Material folder just created, drag "NoFriction" to the Physics Material placeholder under Box Collider.
Right-click on the hierarchy window > 3D object > Sphere, name it "Ball", in the inspector window:
- Change Position X to 0, Position Y to 6, Position Z to 0
- Change Scale X to 0.5, Scale Y to 0.5, Scale Z to 0.5
- Add a Rigidbody component
- Change Drag to 2 (slow the fall of the ball)
- Change Angular Drag to 0
- Make sure Use Gravity is checked
- Check Freeze Rotation X, Y, and Z (stop the ball from rolling)
In the material folder, right-click > Create > Material, name it "Gold", in the Inspector window:
- Change the color to gold
- Change the smoothness to 1
Drag the Gold material to the Ball gameobject
Drag the Ball to the Prefab folder
Click File > Save