Presentation from Newry Software Meetup where I discuss the current landscape of virtual reality and delve into development of a VR pool simulation using Unity, Oculus SDK and VRTK
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
VR In Action - Creating a VR Pool Game with Unity, Oculus and VRTK
1. VR in Action
VR Landscape +
Making a VR Pool game with Unity, Oculus and VRTK
NIALL MCLOUGHLIN
@NEILLNIALL
1
Newry Software Meetup
2. Agenda
• WHAT IS VIRTUAL
REALITY?
• HISTORY
• DEVICES
• APPLICATIONS
• FIRST STEPS IN VR
• WHAT SKILLS ARE
BENEFICIAL?
• DEVELOPMENT
OPTIONS
• UNITY OVERVIEW
• OCULUS / VRTK
• VR POOL DESIGN
Niall McLoughlin 2
3. What is Virtual Reality?
VIRTUAL REALITY (VR) IS THE USE OF COMPUTER
TECHNOLOGY TO CREATE A DIGITALLY GENERATED
SIMULATED ENVIRONMENT.
UNLIKE TRADITIONAL USER INTERFACES, VR PLACES
THE USER INSIDE AN EXPERIENCE.
INSTEAD OF VIEWING A SCREEN IN FRONT OF THEM,
USERS ARE IMMERSED AND ABLE TO INTERACT WITH
3D WORLDS.
3
11. Non Gaming
Applications
Niall McLoughlin
11
DESIGN – Native 3D
SOCiAL
EXPERIENCES
CINEMA
HEALTHCARE
•Training and Treatment EDUCATION
SPORTS TRAINING –
US SKI TEAM
ARCHITECTURE MARKETING TRAVEL
SHOPPING DATA ANALYTICS CHARITY
16. New medium
– Different
Concerns
• Motion Sickness - Acceleration without
frame of reference can cause body to
interpret this as poisoning
Physiological
• Immersive experiences can cause
enhanced reactions – so upsetting
scenes may be more impactful in VR
Psychological
• Surrounding space could present
dangers
• Cables get tangled
Environmental
Niall McLoughlin
16
22. VR Pool - Goals
Have something
to demo in
Newry!
1
Gain experience
with VRTK API
2
Contrast VRTK vs
Oculus SDK
3
Develop a
working pool
simulation
4
Niall McLoughlin
22
23. Design Considerations for VR Pool
•Teleporting added initially to try to solve that problem
•Design evolved to rotate table to minimize need for teleporting
•Room remains in place to keep frame of reference
Minimize locomotion
•Without a surface to lean targeting during cueing was difficult – so trigger locks the cue movement to only one axis.Realistic Cueing Action
•Physics materials trialled to give more realistic collisions between balls, cue and cushionsDependable Collisions
Niall McLoughlin
23
24. What’s in the box?
Environment
Pool Table 3D Model
Unity Texturing – room, balls
Mechanics
VRTK Two Hand Grab Mechanic
VRTK Teleport
Oculus SDK Input Events – cueing / rotate table
VRTK Radial Menu – reset cue / reset game
Pool Game Logic
EventManager
Finite State Machine = reuse of Unity Animator
24
29. Game Logic
• Decouples GameObject when there may be a variable number of
dependent objects
EventManager / FSM
Yellow/Red/Black Deposit
• Cue Ball Respawn
• Wrong ball potted
• No ball touched
• Ball off table
• Two different balls potted
Foul Detection
Score Manager
Niall McLoughlin
29
30. Leveraging FSM
from Unity
Animator
30
Pool game rules implemented as part of a Unity Animator
Finite State Machine.
Important game events emitted as events that
GameManager sets as triggers/parameters in the FSM.
States can only transition if triggers/parameters are set
Example valid path:
Cue > White > Red> Potted Red
Example foul path:
Cue > White > Red > Yellow
StateMachineBehaviour subclasses associated to states in
some cases
Loose coupling vs Unity prefab relationships
32. Example Script
for Rotate
Table
This came as a necessity
really to reduce need for
moving around the
scene with teleport –
even with teleport the
orientation of the player
can be confusing
32
33. Evolution
Primitive Shapes – Cue/ Balls
VRTK Examples Analysis
• Grab Mechanic Trialled
• Radial Menu
• Teleporting
Pool Table Model
Oculus API used for finer control of
cueing mechanic
Physics Testing
• More Physics Testing
Event System
Scoreboard
Respawning
Foul Detection
Niall McLoughlin
33
38. Summary
Enjoyable proof of concept that has helped gain
familiarity with VRTK
VRTK makes it quite easy to implement a number of
common VR features
VRTK enables deployment to various storefronts by
abstracting the SDK
Fall back on traditional design/programming
techniques to solve problems
Unity is used for 50% of mobile games and many
consoles – so the added bonus that it is heavily
investing in VR helps to re-use skills for many
platforms
Developing directly alongside the VR headset is
important but desk gets a bit cluttered!
Niall McLoughlin 38