How To Make Game Objects Bounce In Unity?

Learn how to make your Game Objects bounce on hitting a wall or the floor in Unity for Games, Applications, and AR/VR Experiences.

What are you going to learn?

This is what you will learn

In this article, I will show you how you can make your Game Objects bounce. This is useful when you need to make a ball bounce off the floor, the walls, or the ceiling. Let’s see how we can achieve this in Unity.

The key step here is to use a Physics material and change the properties of it so that it behaves like a bouncy object. It is easier than you think.

Here are the steps —

Step 1: Add a plane and a sphere to an empty scene.

The plane represents the floor and the sphere will be the ball that bounces on that floor.

Position the floor and the sphere so that the sphere is on top of the plane

I also added a blue color to the floor. If you don’t know how to do that, you can check out my article - “How To Apply Color To A Game Object In Unity?

Step 2: Add the Rigidbody component to the Ball

Since we need our ball to obey the laws of physics, we will have to attach the Rigidbody component to it. Make sure the Use Gravity box is checked. We don’t want the ball to float in space.

Select the Sphere > Add Component > Rigid Body > Keep “Use Gravity” box checked

Step 3: Create a “Bouncy” material

Right-click in the assets panel > Create > Physic Material > Name it “Bouncy”

Step 4: Change the properties of the Bouncy material

Select the Bouncy Material > You should be able to view the properties of this material on the right-hand side i.e the Inspector panel. Now change the properties.

Set Friction to 0 and Bounciness to 1
Set Friction to 0 and Bounciness to 1
Set Friction to 0 and Bounciness to 1

Step 5: Apply the material to the sphere

Now apply this material to the sphere(i.e the ball) in our scene.

Drag and drop the Bouncy Material into the Sphere

That’s it. This step confirms that the sphere will bounce on our floor.

Step 6: Hit the play button

Our ball is bouncing now. Yayyy!
Our ball is bouncing now. Yayyy!
Our ball is bouncing now. Yayyy!

Bonus: You can also control the number of times the ball bounces. Try experimenting with different properties of the “Bouncy” material.

Set the value of Bounce Combine to Maximum and our ball won’t stop bouncing at all

Great! 👏

Hopefully, you didn’t face any problems in any of the steps above. In case you did, comment below and I will help you out.😉