2023 Unity VR Basics - Teleportation
Summary
TLDRThis video script offers a comprehensive guide to implementing teleportation in VR using Unity's XR Interaction Toolkit. It covers setting up a teleportation provider, interactor, and anchor or area. The tutorial explains how to customize teleportation with delay times, interaction layers, and reticle colors. It also details configuring the XR controller for input actions, managing interaction groups to avoid conflicts, and enabling smooth or snap turns for user comfort. The script concludes with a fully functional teleportation system that complements continuous movement and object interaction.
Takeaways
- ๐ The script discusses implementing teleportation in VR, focusing on the components needed for a functional teleportation system.
- ๐ ๏ธ A 'teleportation provider' is essential for setting up teleportation, which can be added to a Locomotion system.
- โฑ๏ธ The teleportation provider includes a 'delay time' feature to add a delay before teleportation, enhancing user comfort.
- ๐ญ The 'teleportation interactor' is responsible for the interaction with the environment, shooting out a ray to indicate the teleportation target.
- ๐ฏ The 'teleportation anchor' or 'teleportation area' are destinations where users can teleport to within the VR environment.
- ๐จ Customization options are available for the teleportation interactor, including colors for valid and invalid targets, and the reticle design.
- ๐ง The script guides on how to fix issues like setting the correct interaction layer for teleportation in the XR Interaction Manager.
- ๐งฉ The importance of adding an XR controller to the interactor for independent control over select actions is highlighted.
- ๐ The script explains how to set up a teleportation area to allow for area-based teleportation, rather than just point-to-point.
- ๐ฎ The process of customizing input actions for the right hand controller to control teleportation is detailed, including the use of thumbsticks.
- ๐ The video concludes with a demonstration of a fully functional teleportation system integrated with continuous movement and object interaction.
Q & A
What are the main components required to implement teleportation in VR?
-The main components required for teleportation in VR include a teleportation provider, a teleportation interactor, and a teleportation area or anchor.
How does the teleportation provider work in the VR system?
-The teleportation provider is added to the Locomotion system and handles the logic for when and how teleportation is activated, including a delay time before teleportation occurs.
What is the purpose of the delay time in the teleportation provider?
-The delay time in the teleportation provider is used to add a brief wait period after teleportation is activated, which can be used to add visual effects like a vignette for user comfort.
How is the teleportation interactor different from other interactors?
-The teleportation interactor is responsible for interacting with the world to perform the teleport action, typically using a ray that shoots out from the controller to select the teleportation target.
Why is the interaction layer mask important for the teleportation interactor?
-The interaction layer mask, specifically set to 'teleport', is crucial for the teleportation interactor to correctly identify valid targets for teleportation within the VR environment.
What is a teleportation anchor and how does it differ from a teleportation area?
-A teleportation anchor is a specific point in the VR environment that users can teleport to, whereas a teleportation area allows users to teleport anywhere within a defined space.
How can users customize the orientation upon teleporting to a location?
-Users can customize the orientation upon teleporting by adjusting the 'Match Orientation' setting on the teleportation anchor, which determines the facing direction based on the anchor's axis.
What is the role of the XR controller in the teleportation interactor?
-The XR controller on the teleportation interactor is used to capture input data from the user's VR controller, allowing for actions like selecting a teleportation target.
How can the teleportation interactor be customized to use different input actions?
-The teleportation interactor can be customized to use different input actions by assigning specific actions like 'teleport select' to the select action and select action value fields within the XR controller component.
What is the purpose of the XR interaction group in the context of teleportation?
-The XR interaction group is used to manage and prioritize different interaction types, such as teleportation, direct interaction, and poking, ensuring that they do not conflict with each other.
How does the action-based controller manager tie together the teleportation system?
-The action-based controller manager ties together the teleportation system by assigning specific actions to the right hand controller, allowing for smooth transitions between different locomotion modes like continuous movement, teleportation, and snap turns.
Outlines
๐ Setting Up Teleportation in VR
The paragraph discusses the process of implementing teleportation in a VR project, highlighting the need for a teleportation provider, interactor, and an area to teleport to, such as a teleportation anchor or area. The teleportation provider is added to the Locomotion system, and a delay time can be adjusted for comfort. The interactor, which shoots a ray for interaction, is set up using a prefab from the XR Interaction Toolkit. The paragraph also covers the creation of a teleport layer in the XR Interaction Manager and the customization of the teleportation interactor, including the reticle and colors for valid and invalid targets.
๐ ๏ธ Customizing Teleportation Controls and Area
This section delves into enhancing the teleportation controls by modifying the select action and adding an XR controller to the interactor. It details the process of setting up the teleportation area, ensuring it's on the correct layer and can be customized for orientation matching. The paragraph also addresses the removal of unnecessary model prefabs and the setup of an XR interaction group for the right hand controller to manage interactions without overlap. Finally, it explains the addition of an action-based controller manager to tie all components together, allowing for smooth teleportation and rotation using the thumbstick.
๐ฎ Finalizing Teleportation and Locomotion Integration
The final paragraph covers the activation of both continuous and snap turn providers in the Locomotion system, enabling smooth and snap turning options. It also discusses the setup of the turn system to allow for either smooth or snap turns, with a preference for snap turns as demonstrated. The video concludes with a demonstration of the fully functional teleportation system, where the user can snap turn, rotate the reticle with the thumbstick, and teleport to the selected location. The paragraph ends with an acknowledgment of Patreon subscribers and a sign-off, promising more content in the future.
Mindmap
Keywords
๐กTeleportation
๐กLocomotion System
๐กTeleportation Provider
๐กTeleportation Interactor
๐กTeleportation Anchor
๐กTeleportation Area
๐กInteraction Layer Mask
๐กXR Interaction Manager
๐กReticle
๐กXR Controller
๐กXR Interaction Group
Highlights
Introduction to teleportation as a method of movement in VR.
Requirement of a teleportation provider, interactor, and an area for teleportation.
Adding a teleportation provider to the Locomotion system.
Explanation of delay time in teleportation for comfort.
Selection of the right hand for the teleportation interactor.
Use of a prefab for the teleport interactor.
Customization of the interaction layer mask for teleportation.
Fixing the interaction layer in project settings for teleportation.
Customization options for teleportation colors and reticle.
Introduction of the teleportation area and its setup.
Customizing the teleportation area to match user orientation.
Testing the teleportation system in the scene.
Improving controls by changing select action for teleportation.
Adding an XR controller to the interactor for better input handling.
Setting up the XR interaction group for the right hand controller.
Adding an action-based controller manager to tie all interactions together.
Enabling smooth motion or snap turn options for user preference.
Final testing and demonstration of the complete teleportation system.
Acknowledgment of Patreon subscribers for their support.
Transcripts
besides continuous movement the only
other real way to move in VR is
teleportation well I guess there's grab
move but we're not talking about that
today today we're talking about how to
teleport so let's get in it now to get
teleportation to work out our project
we're going to need a few things we're
going to need a teleportation provider a
teleportation interactor and then
finally an area that we can teleport to
such as the teleportation anchor or well
teleportation area which would be like
this plane so let's kick things off and
get a teleportation provider in to do
that I'm going to throw it on our
Locomotion system here and if you
remember this is where I put the move
continuous move provider and then we
also have the turn or snap turn
providers here and so I'm just going to
add a component or actually I'm going to
create an empty child and I'm going to
name this teleportation provider
and then we just add component
and of course it's asking for a
Locomotion system which I can just drag
that here and then we also have this
delay time and you can play with this if
you want this will just add a delay once
teleportation is activated essentially
if you activate your teleportation it'll
wait a second or two before it actually
teleports you and you can use that to
add in a vignette for Comfort but eh I
think it's fine without it now next up
is going to be our teleportation inner
actor and so this is what's going to
interact with the world and teleport
it's going to be that Ray that shoots
out so if we expand out here I think
it's more natural to have it on the
right hand and so we could customize
this Ray that we already have in the
scene I actually found out that there is
a prefab that we can use so if we go
into samples XR interaction toolkit and
then go to prefabs and interactors you
can find this teleport interactor so we
just drag that onto the right hand
controller and it should be set up for
us for the most part one goofy thing
that's not done here is if you look here
it should work on an interaction layer
mask called teleport but we don't have
that and it's kind of funny because you
think that they would just add that in
considering well we're doing the XR
interaction toolkit it should just add
that layer but regardless I'm going to
go ahead and drag in the XR interaction
manager here
let me show you what I'm talking about
when I talk about the teleport layer
needs to be there so if we go to Project
settings and come to project validation
this is where you can find errors pop up
and it's saying right here that the
interaction layer 31 should be set to
teleport for teleportation Locomotion
why they don't add this in because
teleportation is pretty common I don't
know so I'm just going to click fix and
then if we came over here went to add
layer you can see here it added user
layer 31 teleport so I'm going to come
back here and you can see it's already
set itself to that so there you go now
if you wanted to you can also customize
colors and stuff here so this is the
color for when we have a valid Target
invalid Target or something's blocked
you can also change the reticle here so
that's going to be the little thing on
the ground so if I double click this
this is going to appear on the ground
when we have at the very end of our
array and then you can see what it looks
like they also have a blocked one and
it'll look like that and I'll have a
little X now before we can do anything
interesting with this Ray interact
director and the provider we need a
place to teleport to First otherwise
we're just not going to be really able
to interact with anything first let's
start off with the teleportation area
and again you can find a prefab for this
under the xri interaction toolkit so
samples XI interaction toolkit and then
we're going to go into teleport and you
can see here we have a Teleport anchor
and teleport area so I'm going to drop
this anchor into the scene and if I
select it here we can see what we have
we have a teleportation area and that's
about it it's set to the teleport layer
so that's good and then if you wanted to
you can customize how this teleportation
configuration works so match orientation
so based on what we choose here it will
determine how we're going to face when
we teleport to this so right now it's
set to Target up and forward and so it
will use the y axis of this anchor and
then it will use the Z access to
consider what is forward and so when we
teleport to it no matter if we were
teleporting it from this side or this
side once we teleport to this spot it's
always going to be up and forward and
that can be really good if you want to
make sure that your users are going to
maybe have a specific spot and you only
want them to face a certain area and
interact with things let's boot up the
scene and see what we have and yeah now
you can see that I hover over the anchor
and if I press the grip button it'll
teleport me to it so they go it works
there we have it the teleport anchor but
you know we're not really after the
teleport anchor sir you can use it for a
few clutch cases but really you're more
interested in the teleport area in which
we can make this whole area teleportable
and so to do that I'm just going to
select This Plane I'm going to add
component and find teleport area and
since we're not using the prefab here
which well we could but you know I don't
know I like having a custom teleport
area but if we come back to the teleport
area here that's on the plane we just
need to make sure we set this to
teleport and turn off the default there
and now it should be ready now you can
see that when I'm looking around I'm
able to teleport anywhere on the
teleportation area but I can't really
rotate how I teleport and also I still
have to use the grip button which kind
of sucks so let's fix that now in order
to improve our controls we're going to
have to change how the teleport
interactor considers the select action
taking place so currently right now if
we choose this you'll see that it should
be using an XR controller for getting
input data which you can find on the
parent the right hand controller right
here so it's using this and it's saying
oh yeah the select action value is going
to be well the select input which is the
grip button so that's how it's choosing
that but if we want it to have its own
way of doing that then we're going to
have to put an XR controller on the
interactor itself so if we go to add
component XR controller
and you'll see we've put one here and
you know what I do want it to be mostly
based off the right hand controller so I
am going to come back over here I'm
going to select up here and the right
controller default and then we'll just
customize some things so again how this
normally works is it will just go to the
default parent Whoever has the XR
controller but since this has one
directly on it now it's going to default
to this one now the things we need to
customize here we aren't really using
any position rotation anything we're not
really using any of these so we're gonna
go ahead and Mark these off and then for
this the select action and select action
value what we need is the teleport
action and so this is going to be right
here teleport select so I'm going to
choose that for that and then also I'm
going to also choose the same teleport
select and make sure it's the right hand
teleport select and if I double click
this you can see this in the input
actions what this is I'm going to expand
this out and you can see right here for
the teleport select it takes a value and
then coming over here it's using the
primary 2D axis so it is just kind of
using that thumbstick that's how we
select is once we push forward and
release we have selected now another
problem that you'll find here is when
since we've added an XR controller for
some reason by default it loves throwing
in a model prefab here which we don't
need we're going to go ahead and get rid
of that otherwise it's just going to
double spawn some controllers on us and
we also want to change our teleportation
area and make sure that it's going to
match the orientation so if we check
that then we'll be able to use the
thumbstick to rotate the reticle left or
right and so we'll face a certain
direction once we teleport and if you
watched my previous video on XR
interaction groups I added one to our
left hand but we're going to have to add
one to the right hand now since we have
all these different interactors and we
need to decide who is going to be in
charge so they're not overlapping each
other and you can see the one for from
the left hand that I have here but
that's not important we're not playing
with that that was last video this one
we need to add it to our right hand
controller so we're going to start by
adding an XR interaction group
okay and then I'm going to hit the plus
sign a few times and let's see here
right now I only have three active ones
I do have the rate interactor but I
don't want to play with that and have
that inner switch with the teleport I'm
okay with just the teleport active right
now and then I'm going to drag these in
and you want to put these in the
priority that you want them to override
the other ones so teleportation is
pretty important I want that first and
then let's see I want direct and then
poke
now another way you could actually
organize this so you don't have to worry
about which location these are in you
could just dictate who overrides who
here but since I already have these in
the order that I want I'm just going to
leave them like that and then we also
need to get the XR interaction manager
which I have mine up here and then
finally for the group name this is going
to be for the right hand so you just
type in right we are almost done but
we're not quite there yet we still need
to add an action based controller
manager and so this is what's going to
tie it all together and you'll see
there's a bunch of empty slots here and
they're pretty self-explanatory so you
know the manipulation interaction group
is going to be the one that's already
attached here then we have the direct
interactor and I'm just going to fill
these out really quick
now we don't have a ray interactor so
I'm just going to leave that as none
finally we have teleport mode activate
cancel turn snap turn move and UI scroll
and since these are all based on the
right hand when we click this we're
going to be looking for the right hand
so let me look up activate
teleport mode to activate and then I'm
just going to zoom right through all of
these
and so now that I've zoomed through all
these you can see this is all just right
hand Locomotion teleport mode activate
teleport mode cancel turn snap turn move
and UI scroll but we can also turn on
smooth motion enabled or we can also
turn on smooth turn enabled so instead
of doing snap turn that's how you do
that but we do have to activate one more
thing and so if we come over to our turn
under our Locomotion system now I have
it set to continuous turn provider but
now that we have this other thing here
that can regulate that for us we can
actually turn both of these on so with
continuous move providers activated but
I can turn on the snap turn at the same
time and then this script right here
depending on if I choose to have smooth
turned on or off will allow us to do
that no personally myself I like Snap
turns so I'm gonna just leave this as
off and let's boot up and see what we're
working with now all right and as you
can see I can snap turn to my left and
right and then I can also rotate the
reticle with my thumbstick and when I
let go I teleport and they have it we
have a functioning teleporter and with
my left hand I'm able to continuously
move and I can still grab objects so now
we can teleport big shout out to my
patreon subscribers thank you for
keeping me afloat sorry it's taken so
long but I'm happy to be back and I'll
see you in the next one bye
[Music]
5.0 / 5 (0 votes)