Reader small image

You're reading from  Enhancing Virtual Reality Experiences with Unity 2022

Product typeBook
Published inNov 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781804619537
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Steven Antonio Christian
Steven Antonio Christian
author image
Steven Antonio Christian

Steven Christian is an Augmented Reality Developer, Animator, and Medical Student Student. He's also the Owner of Iltopia Studios where he creates comics and cartoons that explore the Black experience in America. He is Unity Certified 3D Artist and Instructor and his goal is to improve equity in arts and technology through content creation and community-focused education.
Read more about Steven Antonio Christian

Right arrow

Enhancing Virtual Reality Rigs

The focus of this chapter is to start bringing everything we’ve covered so far in this entire book together. We’ve already created our virtual environment and learned a variety of skills, from animation to C# coding to the Unity Input System. Now, we’ll use all of these skills to create experiences that allow us to explore a variety of VR interactions.

In this chapter, we will be building on all the knowledge you’ve gathered throughout this book. We will be adding new layers of interactivity to our VR rig, refining our VR development skills, and discovering new possibilities within the VR universe. Key enhancements will include introducing animated hands to our VR rig for a more realistic and immersive user experience. We’ll also be incorporating the ability to switch between our indirect interactor and direct interactor components, offering a versatile and dynamic interactive experience. We’re going to add...

Adding animated hands to the VR rig

Animated hands are a key component of VR experiences. They provide a layer of immersion, allowing users to interact with the virtual world in a more natural and intuitive way. They also provide feedback, expression, and personality to the experience, enhancing the overall engagement and enjoyment of the user. As VR technology continues to evolve, animated hands will continue to play an important role in creating more immersive and interactive experiences.

To set up rigged animated hands, follow these steps:

  1. Go to this link to download the Hands asset: https://drive.google.com/file/d/10b39IekUdpBHlcTslZ-BlNRyH5uqPUe1.
  2. Import the hands into your project (Figure 15.1).
Figure 15.1 – Import Assets list for the Oculus Hands Unity package

Figure 15.1 – Import Assets list for the Oculus Hands Unity package

You will find the assets in the subfolder called Oculus Hands.

  1. Open a new scene.
  2. Drag your VRPhysicsAndHandSound variant prefab VR rig into the scene...

Adding and toggling between the ray interactor and the direct interactor

A ray interactor allows the user to interact with objects in the virtual environment using a laser-like pointer, which is useful for selecting or pointing at objects from a distance. On the other hand, a direct interactor allows the user to interact with objects in the virtual environment using their hand or a controller, which is useful for grabbing, pushing, or manipulating objects up close.

Adding interactors

By having both a ray interactor and a direct interactor on the same hand controller, the user has more options and flexibility in how they interact with the virtual environment. They can use the ray interactor to select objects from a distance and the direct interactor to manipulate or grab objects up close, providing a more intuitive and immersive experience.

To add ray interactors to both hands, follow these steps:

  1. Create a new empty GO and name it Right Hand Ray.
  2. Go to the RightHand...

Making the VR rig run

Being able to make your VR rig run or increase speed to sprint is crucial in Unity VR experiences because it provides a more immersive and engaging experience for the user. In VR, movement is a critical component of the experience, and the ability to move quickly and fluidly can greatly enhance the sense of presence and realism.

By increasing the speed of the VR rig, you can simulate running or sprinting, which can be especially useful in games that involve exploration or fast-paced action. For example, in a VR game where the player is running away from enemies or racing against other players, being able to sprint can add a new level of excitement and challenge to the game.

Moreover, the ability to adjust the speed of the VR rig can also help to reduce motion sickness and enhance comfort for the user. If the VR rig is moving too slowly or too quickly, it can cause discomfort or disorientation for the user. Therefore, having control over the speed of the...

Making our VR rig jump

Being able to make your VR rig jump in Unity VR experiences can greatly enhance the level of immersion and interactivity for the user.

Jumping is a basic and instinctive human movement that we use in our daily lives, and incorporating it into VR experiences can make the user feel more connected to the virtual environment.

By allowing the VR rig to jump, users can explore and navigate the virtual environment in a more natural and intuitive way, as they would in the real world. This can make the VR experience feel more realistic and engaging and can help to reduce motion sickness, which some users may experience in VR.

In addition, incorporating jumping into VR experiences can provide opportunities for gameplay mechanics and puzzles that are unique to VR. For example, users may need to jump over obstacles or onto platforms to progress through the game or solve puzzles.

To make our VR rig jump with a button press, follow these steps:

  1. Create a...

Making the VR rig crouch

Being able to make your VR rig crouch is great in Unity VR experiences because it adds a new level of immersion and interactivity for the user.

Crouching is a natural movement for humans, and when a user can physically crouch down in a VR experience, it creates a more realistic and engaging experience. For example, if you’re playing a first-person shooter game in VR and need to hide behind a wall or object to avoid enemy fire, crouching down in real life to do so will make the experience feel more authentic and immersive.

In addition to adding realism to the experience, crouching in VR also allows for more dynamic gameplay mechanics. For example, in a puzzle game, crouching down may be necessary to see a hidden object or solve a puzzle.

To add a crouching action to our VR rig, follow these steps:

  1. Create a new C# script called CrouchingAction.
  2. Open the script and apply the following namespaces to the code:
    using System.Collections...

Summary

In this chapter, we enriched the user experience by adding animated hands and unique functionalities such as running, jumping, and crouching. This is just the start of the possibilities for interaction and movement within your virtual worlds. We’ve also developed an interactive environment by adding functions to toggle between the ray interactors and direct interactors. This opens up a world of actions and reactions within our VR universe. These additions set the groundwork for you to explore and implement even more complex interactions at your own pace. In the next chapter, we’ll explore various ways to interact with elements within our virtual world, from triggering animations to play to teleporting from one area of the VR world to another.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Enhancing Virtual Reality Experiences with Unity 2022
Published in: Nov 2023Publisher: PacktISBN-13: 9781804619537
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Steven Antonio Christian

Steven Christian is an Augmented Reality Developer, Animator, and Medical Student Student. He's also the Owner of Iltopia Studios where he creates comics and cartoons that explore the Black experience in America. He is Unity Certified 3D Artist and Instructor and his goal is to improve equity in arts and technology through content creation and community-focused education.
Read more about Steven Antonio Christian