2023 Unity VR Basics– Continuous Movement
Summary
TLDRThis tutorial focuses on setting up continuous movement in XR development using Unity's XR Interaction Toolkit. The instructor starts by disabling hand tracking to conserve battery and simplifies the XR origin setup. They introduce the Locomotion System component to coordinate movement, explaining the Continuous Move Provider for smooth locomotion and the Dynamic Move Provider for varied directional control. Turning mechanics are covered with both Continuous and Snap Turn Providers, highlighting customization options. The necessity of a Character Controller for boundary setting and gravity application is emphasized, along with a new Character Controller Driver for seamless head movement tracking. The tutorial concludes with a functional movement and turning system, ready for further development.
Takeaways
- 🎮 The tutorial focuses on setting up movement in XR using the XR Interaction Toolkit.
- 🔋 The presenter turned off hand tracking on their Oculus Quest to conserve battery and also disabled the XR hands from the previous tutorial.
- 👐 The tutorial reverts to using left and right hand controllers with animations instead of the controller model from the previous session.
- 🚶♂️ A Locomotion System is introduced as the coordinator for movement between the XR origin and move providers.
- 🔄 The Continuous Move Provider is added to enable movement in the direction the user is looking, with options to enable strafing and flying.
- 🔧 The tutorial explains how to set up gravity application modes and forward source based on user preferences.
- 🎯 It's recommended to use either the left or right hand for movement to avoid conflicts, with the left hand being a common default in VR games.
- 🔄 The Dynamic Move Provider is introduced as an alternative to the Continuous Move Provider, allowing for different movement preferences for each hand.
- 🛑 The tutorial advises caution when using the Continuous Move Provider due to potential motion sickness and suggests the Snap Turn Provider for a more accessible alternative.
- 🏃♂️ A Character Controller is added to prevent the XR origin from passing through objects and to enable gravity effects.
- 🔄 The Character Controller Driver is used to synchronize the character controller's height with the user's head movements for a more natural experience.
Q & A
Why did the speaker turn off hand tracking on their Oculus Quest?
-The speaker turned off hand tracking on their Oculus Quest because it was draining the battery a lot.
What is the purpose of the Locomotion system in the XR interaction toolkit?
-The Locomotion system is responsible for coordinating between the XR origin and all the move providers to manage movement within the XR environment.
What is a Continuous Move Provider and how is it added in the script?
-A Continuous Move Provider is a component that allows for smooth movement in the XR environment. It is added by creating an empty object, naming it 'move', and then adding the Continuous Move Provider component.
What are the options for gravity application in the Continuous Move Provider?
-There are two modes for gravity application: 'Immediately' which applies gravity as soon as movement stops, and 'On Movement' which delays gravity until the user moves again.
Why might the speaker prefer using the left hand for movement in VR games?
-The speaker finds that the left hand has become the default for movement in VR games, which is why they prefer to use it with the Continuous Move Provider.
What is the function of the Character Controller and how is it added?
-The Character Controller provides a boundary to prevent the user from moving through objects and allows for the application of gravity. It is added by selecting the XR origin and adding the Character Controller component.
What is the Character Controller Driver and how does it solve the issue of the character controller not moving with the XR origin?
-The Character Controller Driver is a component that synchronizes the movement of the character controller with the XR origin. It is added to the XR origin and linked with the appropriate Locomotion provider.
What are the two types of turn providers mentioned in the script and how do they differ?
-The two types of turn providers are Continuous Turn Provider and Snap Turn Provider. The Continuous Turn Provider allows for smooth turning, while the Snap Turn Provider enables quick, discrete turns, which can help reduce motion sickness.
Why might the speaker recommend deactivating one of the move providers if using both is an option?
-The speaker recommends deactivating one of the move providers to avoid conflicts and ensure a smoother user experience, as having both active might cause unexpected behavior.
What is the significance of the Radius setting in the Character Controller and how does it affect the user experience?
-The Radius setting in the Character Controller determines the size of the collider, which affects how close the user can get to objects without clipping through them. Adjusting the radius can improve the user's interaction with the environment.
Outlines
🛠️ Setting Up the XR Interaction Toolkit
The paragraph discusses the setup process for the XR Interaction Toolkit, focusing on changes from previous tutorials. The speaker turns off hand tracking on their Oculus Quest to conserve battery and decides to disable the XR hands from the previous tutorial. They revert the controllers to the left and right hand configurations, ensuring the correct hand has the animator and controller components. The speaker then introduces the concept of a Locomotion system, which coordinates movement between the XR origin and move providers. They create an empty child object named 'Locomotion system' and add the Locomotion system component, linking it to the XR origin. The paragraph concludes with the addition of a continuous move provider, which is configured with options for strafing, flying, and gravity application. The forward source for movement is set to the main camera, and the left hand is chosen as the default for movement actions.
🕹️ Configuring Movement and Turning in VR
This paragraph delves into the specifics of configuring movement and turning in a VR environment. The speaker starts by setting up the dynamic move provider, which allows for different movement preferences for each hand. They experiment with head-relative and hand-relative movement directions for the left and right hands, respectively. After testing, the speaker decides to deactivate the dynamic move provider in favor of the continuous move provider for its simplicity. The paragraph then moves on to turning mechanics, introducing both continuous turn and snap turn providers. The speaker configures the continuous turn provider with the right hand for turning, adjusting the turn speed for a more comfortable experience. They also discuss the snap turn provider as an alternative to prevent motion sickness, setting up the snap turn with specific inputs for quick directional changes. The speaker emphasizes the importance of a character controller to prevent characters from passing through objects and to apply gravity correctly. They add a character controller to the XR origin, adjusting its radius and center to fit the character model and ensure it interacts properly with the environment.
🎬 Wrapping Up the Tutorial and Acknowledging Support
The final paragraph is a conclusion to the tutorial, where the speaker thanks the viewers for watching and encourages them to like and subscribe for more content. They express gratitude to their Patreon subscribers, emphasizing that their support is crucial for the continuation of their work. The speaker signs off with a friendly 'bye', indicating the end of the tutorial.
Mindmap
Keywords
💡XR Interaction Toolkit
💡Continuous Movement
💡Locomotion System
💡Move Providers
💡Dynamic Move Provider
💡Character Controller
💡Snap Turn Provider
💡Gravity Application
💡Hand Tracking
💡Oculus Quest
💡XR Origin
Highlights
Introduction to using the XR Interaction Toolkit for movement in VR.
Recommendation to disable hand tracking on Oculus Quest to save battery life.
Instructions to turn off XR hands from the previous tutorial for non-hand tracking games.
Switching controllers back to left and right hand configurations.
Explanation of the Locomotion system's role in coordinating movement in XR.
Adding a Locomotion system component to the XR origin.
Enabling strafe and fly options in the Continuous Move Provider for more movement freedom.
Setting gravity application modes for realistic movement.
Choosing the forward source for movement direction based on camera or controller orientation.
Selecting the left hand as the default for movement in VR games.
Demonstration of character movement using the left hand controller.
Discussion on the need for a Character Controller to handle collisions and apply gravity.
Adding a Character Controller component to the XR origin for boundary and gravity management.
Adjusting the Character Controller's radius to prevent clipping through objects.
Raising the Character Controller to avoid falling through the ground.
Introduction of the Character Controller Driver to synchronize head movement with the character.
Setting up the Continuous Turn Provider for smooth turning movements.
Customizing turn speed and adding snap turn functionality for quick direction changes.
Comparison between continuous and snap turn providers for accessibility and motion sickness considerations.
Completion of the tutorial with a fully functional movement and turning system in VR.
Transcripts
let's get moving using the XR
interaction toolkit and continuous
movement a few things have changed from
the previous tutorials so you should
definitely pay attention to this one
booting back into the scene you'll see
nothing's really changed here but
there's a few things I want to go over
and change from the previous tutorial
the first thing I'll mention is I did
turn off hand tracking on my Oculus
Quest I noticed it was draining my
battery a lot so if you're not using
that for your game I would advise you do
the same and since I've turned that off
for my XR origin I'm also just going to
turn off the XR hands that we did in the
previous tutorial the last thing I'm
going to change is I'm going to go over
to my controllers here and if you
remember from the previous tutorial I
changed this to the controller instead I
want it to go back to our left and right
hand that we had before and you'll see
we have two same named ones here but
one's just going to be a model the other
one is going to have the animator and
all the controllers and that's the one
we want so I'm going to select this I'm
going to select the one that had all the
animations and controllers and then do
the same for the right hand
all right and now we're ready to get
moving the first thing we'll need is a
Locomotion system and this is what's
going to be responsible for coordinating
between our Locomotion or moving our XR
origin and all the move providers and
that's how they've structured this so to
do that I'm going to collect this I'm
going to add an empty child I'm going to
name it Locomotion system
with that in place I'm going to add
component Locomotion system
and then it's asking for the XR origin
as simple as that there we go now we
can't move with just that we need
providers so as I said before this
coordinates with move providers and then
this determines what has control over
the XR origin so the first thing we'll
want to add is a continuous move
provider to add that I'm just going to
right click this create empty and I'm
going to name this move and then I'm
going to look up continuous move
provider and you're looking for the
action base now you'll see here we have
some fun things to fill out so first is
The Locomotion system I'll drag that
here next we can enable strafe so that
is being able to move left and right
diagonally but also forward we can
enable fly which is actually pretty cool
you can uh just kind of look around and
fly around use gravity is there and then
it has two modes for Gravity application
so it's either attempting to move so say
you're climbing a ladder and let go
until you move you won't apply gravity
so I find immediately to be more
realistic the forward Source this is
going to determine what is our forward
Source how it says oh you're going to
move forward in this direction when you
press the thumbstick and so I find the
main camera to make the most sense for
that next we have our left hand move
action and right hand move action so you
want to in my opinion pick one or the
other you don't necessarily want both
your thumb sticks to be able to move you
and I find that the left hand seems to
have become the default when it comes to
VR games and so to do that we're just
going to look up move left hand
Locomotion now again you could do this
for the right hand you would just add
this here if you wanted to be right hand
based
there we go and we could select that
there previously let me open this up
really quick you'll see here for our
locomotions and inputs they actually
used to not have anything for the right
hand they just just assumed that you
would use it for the left hand but now
they filled it out so you don't have to
stress about that anymore which is nice
again I said I don't really like the
right hand as the move for the
continuous move provider so I'm just
going to mark this off and if we boot it
up the scene you can see I can move with
my left hand and based on where I'm
looking and pressing forward it moves in
that direction so there you go now I
will say at this stage the gravity will
not work if I walked off the cliff it
didn't work because we do need a
character controller and I'm going to
add that a little later towards the end
of the video but for now I want to
continue on and talk about the dynamic
move provider so the dynamic mode
provider is just a different form of
continuous move provider and how it
works is you could actually do some
interesting things with this essentially
what this bad boy does is is it allows
you to determine what you want as a
preference for each hand you'll see down
here it has a left hand move Direction
and a right hand move Direction and so
we could have one be set to the Head
relative so like the continuous move
provider but then we could have the
other one be hand relative So based on
the right hand's orientation that's what
forward would be I mean it's it's
interesting I don't know what you would
use it for but here it is and this is
how you set it up so again a Locomotion
system you could put it here forward
Source we want it to be the main camera
and then you would add your references
head transform again would be the main
camera
and then you want the left and right
controller
and let's see yeah I'll have the left
hand be the head relative and then I'll
have the right hand be hand relative and
let's boot up and see what we got and
one thing I should do before I boot it
up is just make sure I turn this off so
it's not fighting between the two
scripts but right let me start it up now
you can see that when I start to move
with my left thumbstick I move in the
direction of my headset but when I use
my right thumbstick and press forward it
moves in the direction of where my right
hand is pointed and yeah that's how that
works now my personal preference is just
to use the continuous move provider so
I'm going to go ahead and deactivate the
dynamic move provider and I'm just gonna
go with the continuous move provider
next up we need to learn how to turn so
to do that we can do a continuous turn
provider or a snap turn provider to add
that in I'm just going to right click
here and I'm going to add an empty
object and I'm going to call it turn
starting off I'm going to go with the
continuous move provider
and then we are just going to drag in
The Locomotion system here oh my bad
that made the continuous move provider
so I did that before yeah just make sure
you don't do that it's very easy to do
all right there we go all right and then
next we need to add in the turn and I
found that if you're moving with the
left hand you want to turn with the
right hand and vice versa if we were
moving with our right hand it makes a
little more sense to turn with the left
hand so since I am moving with the left
hand I am going to go ahead and look up
turn here and you want the right hand
turn and so now if we boot up the scene
you'll see that I'm able to turn to my
right and my left coming back to the
editor if you thought that was turning a
little too slow you can change the turn
speed here and then one word of caution
when using the continuous move provider
it has been known to cause motion
sickness so the snap turn provider might
make your game a little more accessible
to others so I'm going to go ahead and
deactivate that and I'm going to add a
Content or snap turn provider again we
add our Locomotion system here you can
change the turn amount here this
debounce time just kind of allows for a
little wait time between each snap turn
so it just doesn't happen in quick
succession we also have a turnaround one
right here and that just allows for 180
so if your player pulled all the way
back on the thumbstick that would allow
them to do a 180 turn and then if we
were doing the reference again since I'm
using the left controller I want the
right snap turn here and this actually
does have its own input and so instead
of just turn you use the right hand
Locomotion snap turn in just like that
when I hit the right or left I'm able to
snap turn right and left just like that
boom so we are now able to turn and move
are we done no so the problem is we are
able to run through this table and also
gravity is not working and that's
because we don't have a character
controller so the character controller
is going to add a boundary for us so we
don't run in into things or through
things and then it will also allow us to
apply gravity to something so to add
that it's as easy as going to the XR
origin then we're going to add component
character controller and you'll see here
we have a few attributes we can play
with starting off we have the slope
limit so this if we were going up a
slanted Hill would determine how steep
of a slope we can go up now one big one
that we should change right here is
probably the radius so as you can see
here in the scene it's a pretty chunky
boy right there and so to reduce that
I'm going to change this radius to maybe
0.2 and feel free to experiment and see
what feels right in your game here and
so if we were able to start up the scene
now we should be able to run into this
table but before we do that we should
probably also raise this character
controller a little higher and I mean
you could do that by raising your XR
origin but I don't think that's too wise
I think it's a little better to move the
center here and so what that'll do is if
we did not move that up we would just
fall through the ground now as you can
see that I am running forward I am
running into this table and not going
through it but there is a bit of a
problem again so when I go to stand up
and move you'll see the character
controller is not moving with it
so let's fix that now luckily for us we
used to have to code this in ourselves
in the previous tutorial but Unity has
added something for us and it is the
character Controller driver so I'm just
going to add that and it's going to ask
for a Locomotion provider and this is
going to be based off of what your move
provider is so I'm just going to drag
that here and you'll remember I'm using
the continuous move provider instead of
the dynamic move provider so if you're
using the dynamic move provider I would
just get rid of this one just use one or
the other honestly and then it is asking
what our Min and Max height is so that
would determine the Min and Max height
of our character controller so let's
start up the scene and see what we're
working with now so
now when I move my head mounted display
I goes up it goes down left right it
doesn't matter where I move this will
now track and follow so that takes care
of a major issue for us and yeah that is
it that's continuous movement and
turning that'll do it oh
if you found this tutorial moving
consider liking and subscribing and to
my patreon subscribers I really can't do
this without you thank you so much hey
I'll see you all in the next one bye
foreign foreign
Weitere ähnliche Videos ansehen
5.0 / 5 (0 votes)