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

Jumping


When we created the trampoline, I mentioned that our implementation doesn't require you to jump to start bouncing. However, jumping is a fun idea, whether on a trampoline or not. Some games use the keyboard spacebar or a controller button to make your avatar jump. We'll now implement a simple jump gesture from the VR headset, which applies a vertical velocity to our movement.

Note

Note that this will not work with headsets that lack positional tracking, such as Google Cardboard and GearVR.

Feature: When I jump, my character in VR jumps.

To implement a jump gesture, we'll look for a rapid change in the Y position of the headset, which is very similar to the head nod gesture that we did in Chapter 5, World Space UI, (which checked for a rapid change in the x-axis angle). When a jump gesture is detected, we'll apply a vertical force to the first-person , as follows:

  1. With MeMyselfEye selected in Hierarchy, create the script by navigating to Add Component | New Script.

  2. Name it JumpGesture...

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