Introductory Leap Motion and Virtual Reality in Unity 3D

15
Introductory Leap Motion and VR in Unity 3d Dr James Birt

Transcript of Introductory Leap Motion and Virtual Reality in Unity 3D

Page 1: Introductory Leap Motion and Virtual Reality in Unity 3D

Introductory Leap Motion and VR in Unity

3dDr James Birt

Page 2: Introductory Leap Motion and Virtual Reality in Unity 3D

Requirements• Unity 5.3 or higher• Oculus runtime 0.8+ installed• Leap motion Orion Beta

Page 3: Introductory Leap Motion and Virtual Reality in Unity 3D

Download Unity 3D Leap Motion Core Assets

https://developer.leapmotion.com/unity

Page 4: Introductory Leap Motion and Virtual Reality in Unity 3D

Create new Project

Page 5: Introductory Leap Motion and Virtual Reality in Unity 3D

Enable VR Mode

Page 6: Introductory Leap Motion and Virtual Reality in Unity 3D

Import LeapMotion_CoreAsset_Orion_4.1.1

Page 7: Introductory Leap Motion and Virtual Reality in Unity 3D

Setup LeapMotion VR Scene• From LeapMotion>Prefabs drag a LMHeadMountedRig into your

scene Hierarchy and remove Main Camera

Page 8: Introductory Leap Motion and Virtual Reality in Unity 3D

Setup LeapMotion VR Scene• From LeapMotion>Prefabs>HandModelsNonhuman drag a

CapsuleHand_L and a CapsuleHand_R to your scene and make them children of the Leap Hand Controller

Page 9: Introductory Leap Motion and Virtual Reality in Unity 3D

Setup LeapMotion VR Scene• From LeapMotion>Prefabs>HandModelsPhysical drag a

RigidRoundHand_L and a RigidRoundHand_R to your scene and make them children of the Leap Hand Controller

Page 10: Introductory Leap Motion and Virtual Reality in Unity 3D

Setup LeapMotion VR Scene• Locate the HandPool component attached to the LeapHandController• Set Model Collection value to 2 – drag capsuleHands(L/R) and

RigidRoundHands(L/R) from Hierarchy to empty slots• Click Is Enabled and Can Duplicate on both Elements

Page 11: Introductory Leap Motion and Virtual Reality in Unity 3D

Setup LeapMotion VR Scene• Add a Directional Light source to your scene• Add a cube and plane to your scene• Adjust positions, scales and rotations relative to your camera• Press play – If everything is working you should see your cube and hands

when you bring them upto the leap motion camera

Page 12: Introductory Leap Motion and Virtual Reality in Unity 3D

Setup LeapMotion VR Scene• Select the Cube in the Hierarchy and Add a Rigidbody• Create a new contrasting material and add to your cube• Press play You can now hold the cube in your hand

using the inbuilt Unity Physics Engine

Page 13: Introductory Leap Motion and Virtual Reality in Unity 3D

Optimising for Framerates & Quality• Select Project Settings – Quality• Select Simple and change Anti

Aliasing to 4x Multi Sampling• Anti Aliasing is very important in

VR and where possible should be enabled

• Increase Default Render Scale from 1.0 to 1.5 which increases object sharpness – see next slide

• Avoid Dynamic Lighting where possible – best to bake lights

Page 14: Introductory Leap Motion and Virtual Reality in Unity 3D

How to Increase Render Scale• Create new C# file called RenderScale• Add the following code and attach script to the LeapSpace Object in your

Hierarchy• Code is from Unity Getting Started Tutorial - http://tinyurl.com/j2elrjt

Page 15: Introductory Leap Motion and Virtual Reality in Unity 3D

Final Scene

https://dl.dropboxusercontent.com/u/9011716/LEAPDEMO.zip