Book Image

Unity Virtual Reality Projects

By : Jonathan Linowes
Book Image

Unity Virtual Reality Projects

By: Jonathan Linowes

Overview of this book

What is consumer “virtual reality�? Wearing a head-mounted display you view stereoscopic 3D scenes. You can look around by moving your head, and walk around using hand controls or motion sensors. You are engaged in a fully immersive experience. On the other hand, Unity is a powerful game development engine that provides a rich set of features such as visual lighting, materials, physics, audio, special effects, and animation for creating 2D and 3D games. Unity 5 has become the leading platform for building virtual reality games, applications and experiences for this new generation of consumer VR devices. Using a practical and project-based approach, this book will educate you about the specifics of virtual reality development in Unity. You will learn how to use Unity to develop VR applications which can be experienced with devices such as the Oculus Rift or Google Cardboard. We will then learn how to engage with virtual worlds from a third person and first person character point of view. Furthermore, you will explore the technical considerations especially important and possibly unique to VR. The projects in the book will demonstrate how to build a variety of VR experiences. You will be diving into the Unity 3D game engine via the interactive Unity Editor as well as C-Sharp programming. By the end of the book, you will be equipped to develop rich, interactive virtual reality experiences using Unity. So, let's get to it!
Table of Contents (18 chapters)
Unity Virtual Reality Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
11
What's Next?
Index

Panoramas


What if the image was really wide, such as a panoramic photo that you can take with your phone? Let's try this and map it onto a cylinder.

I was in Los Angeles last year. I hiked to the top of the Hollywood sign, where I took two 180-degree panoramic images with my phone, and later I quickly stitched them together in Gimp. The Hollywood.png image is included with this book, or you can use your own panorama:

Putting it together, using the following steps:

  1. Move Sphere 2 out of the way and set its Position to (-3, 1.5, 0).

  2. Create a new cylinder by navigating to GameObject | 3D Object | Cylinder, set its Position to (0, 1.5, 0), and name it Cylinder 3.

  3. Set the Scale to (2, 0.5, 2).

  4. Disable its Capsule Collider component by unchecking the checkbox.

  5. Drag the Hollywood texture onto the cylinder.

  6. Ensure that the Cylinder 3 object is selected. On its Hollywood material component in Inspector, navigate to Shader | Custom | InwardShader.

A default cylinder in Unity is 2 units tall and 1 unit wide...