Adding Additional Balls | VR Unity Developer

Derek Anderson
2 min readDec 1, 2023

--

The only grab interactables in event number 2 are the basketballs, which bounce on the court and don’t weigh as heavily as bowling balls. How about we skip making the easy joke and add some different objects to our event?

With this project, there are some additional prefabs that can be added to the scene. From Filebase, download the Sports Pack 01 and import it into Unity. We aren’t going to need 4 basketballs, so delete 3 of them. In their place, drag a tennis ball, football, and a beach ball into the scene. Position them on the table so they aren’t sticking inside the surface of the table. Don’t forget to prefab these objects.

These are all different physically, but they will have the same components added to them, and we have a basketball to compare them with. Each one of these will need:

  1. Collider

2. Rigidbody (Adjust mass and drag)

3. Physic Material (Adjust friction and bounciness)

4. XR Grab Interactable (Adjust throw velocity)

5. Basketball Script

The basketball script might sound confusing. Why would a basketball script be attached to a tennis ball? Let’s take a look at the basketball script included in our project.

The main purpose of this script is to return the ball to it’s starting location after it hits the ground. Once the ball hits the ground, a timer starts. Once the timer hits zero (2 seconds in this case), the ball will be placed back onto the table. Adding this script component onto the different balls on the table is straightforward, so add the script onto the tennis ball, football, and beach ball.

Next time, we’ll cover the rest of the components and the appropriate settings for each ball, starting with the tennis ball.

--

--

No responses yet