Reader small image

You're reading from  Unity Virtual Reality Projects

Product typeBook
Published inSep 2015
Reading LevelIntermediate
PublisherPackt
ISBN-139781783988556
Edition1st Edition
Languages
Right arrow
Author (1)
Jonathan Linowes
Jonathan Linowes
author image
Jonathan Linowes

Jonathan Linowes is a VR/AR enthusiast, Unity, and full stack developer, entrepreneur, certified Unity instructor, and the owner of Parkerhill XR Studio, an immersive media, applications, and game developer. Jonathan has a bachelor of fine arts degree from Syracuse University, a master of science degree from the MIT Media Lab, and has held technical leadership positions at Autodesk and other companies. He has authored multiple books on VR and AR published by Packt Publishing.
Read more about Jonathan Linowes

Right arrow

Trampoline and brick


A trampoline differs from a bouncy ball because the former makes things that collide with it bounce instead of itself bouncing. Unity doesn't do this automatically for us, So, we need to use scripting.

Feature: When a brick drops from mid-air onto a trampoline, it bounces up, diminished by gravity.

Build the scene and turn the target into a trampoline, as follows:

  1. Navigate to File | Save Scene As and name it BrickTrampoline.

  2. Delete the BallGame script component from GameController using gear icon | Remove Component. We won't need it.

  3. Rename the Target object to Trampoline.

  4. Set its Position to (0, 0.2, 0).

  5. To create the brick, navigate to GameObject | 3D Object | Cube and rename it to Brick.

  6. Set its Scale to (0.25, 0.5, 1) and Position to (0, 5, 0).

  7. Drag the Red material onto it.

  8. Add a Rigidbody by navigating to Add Component | Physics | Rigidbody.

When you play now, the brick drops to a dead stop. Make a new script on trampoline, as follows:

  1. With Trampoline selected in Hierarchy...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity Virtual Reality Projects
Published in: Sep 2015Publisher: PacktISBN-13: 9781783988556

Author (1)

author image
Jonathan Linowes

Jonathan Linowes is a VR/AR enthusiast, Unity, and full stack developer, entrepreneur, certified Unity instructor, and the owner of Parkerhill XR Studio, an immersive media, applications, and game developer. Jonathan has a bachelor of fine arts degree from Syracuse University, a master of science degree from the MIT Media Lab, and has held technical leadership positions at Autodesk and other companies. He has authored multiple books on VR and AR published by Packt Publishing.
Read more about Jonathan Linowes