Okay, everyone! I've been promising new content and this is going to be the
section where we start it won't be the only new content we add but will be some
of the important stuff let's go back to here real quick this is our launcher and
this is the scene we usually see when we open our launcher make sure you're on
Unreal Engine 4.14 because that has all these new features that we're going to
be talking about you can update that by going to your library say adding
versions or just check for updates here once we launch it will bring up our
normal screen and it'll probably you'll probably see this where a collection of
all your projects I want to go to new project and here is the new feature that
we're going to talk about this is the virtual reality template which makes it
super easy for us to use Yui 4 with a headset in HMD as a column head mounted
display and you can use this specifically with oculus rift and HTC
vive which are both awesome project products I use the HTC vive I love it
it's really really cool if you haven't done it unfortunately I don't have one
hooked up to this computer but that's ok I can still explain to you how to do
everything that you need to do so let's create a new project by clicking on the
template go to desktop desktop console actually no sorry mobile okay and this
is kind of scaling everything down so that we don't have a bunch of junk in
there that we don't need because we want to optimize it when we're running in
virtual reality everything needs to run clean and smooth we do it by keeping any
unnecessary stuff out of there so set it to scalable 3d no starter content I'm
going to browse for a new place ok name it whatever you want obviously you know
spaces though ok create project ok when it comes up you'll see that this is a VR
template this one over here on the left is hmd plus gamepad optional that is the
template for the oculus rift this HMV plus motion controller this has the
hands as you'll see and these are used with the HTC vive okay so these have
motion controllers that you hold and that controls those hands it's really
cool I prefer this method and what you do is
you use these the motion controllers to warp from one place to another or you
can walk within this small box that is defined by the area that you're
physically standing in in the real world okay so you set that up you can walk
within that box and then you can warp to another area and you can use your hands
to grab things and interact with things so it's awesome with this one you use a
gamepad while you're wearing a headset or you can use your keyboard to control
yourself - I'm going to talk about the HTC 5 that's the one I'm used to using
so what we can do is just open level search for the right one virtual reality
BP maps and we'll go to the motion controller map to get to the other one
you would go there okay here we are in the motion control map you'll see that
everything is basically set up for us here these blocks are able to be picked
up which is awesome if you walk over to these or warp over to them you can use
the trigger to pick these up and they'll all interact with each other using
physics which is great this is our VR pond which you'll notice is at the
ground and that's because when you set up your VR headset you will be telling
the VR headset how tall you are basically when you calibrate it so it
will take that height into account so if you set this at the ground then the
camera will actually move when you start to your actual eye height so that's
exactly right right there okay so this is cool if you have a headset you can
just get right into this and start trying it out now let me talk about some
of the special features in here if you're not used to all this what you
what you will be seeing so if you hit T while you're in here you'll see the
green mesh up here over the top of your floor that is your navigation mesh okay
so we'll go out here and look at what all is going on here this here I believe
that's the post process volume let's see this one is the light Maps important
volume we know what those are already it's this one here this is a nav
modifier volume 12 okay so that is a nav modifier the way that this is created is
by using geometry box and you just use a box brush okay I'll
bring this in as an example this is a box brush and that's all this one is two
box brushes can be converted to anything basically and so that one's created into
a navigation mesh which tells your motion controllers on your that are
connected to your headset with your virtual reality where you are able to
navigate so you see around these boxes and stuff so you can't navigate right
into them can only navigate where it's green so when you're warping it won't
let you drop right here but it will let you drop right here so you back to this
box that I brought in you can set these boxes to do different things so you can
convert it to an actor which is a navmesh bound volume and that modifier
volume so you could do that where now it's no longer a mesh in your scene it
is just this box that makes it so you cannot walk through this particular part
of the theme so that's great of this one out here is actually telling it where
you can walk
so this one's been converted to a navmesh bound volume this one is created
as as you saw it converted into a nav mesh modifier which actually cuts out
from that thing so there's some of these in here for like these areas over here
you'll see that there's nav mesh modifier volumes underneath of it and
making it so you can't navigate to this place so the nav mesh is an important
part of VR that you'll need to pay attention to and these box pressures are
a great way to modify that you can make it so that this blocks a large area by
adjusting this and you'll see that now you cannot you cannot go over into that
area so if you are creating a building you'll want to make it so that the nav
mesh is inside the building but not out so you can't go outside and see all your
crappy modeling out there you don't want to do that okay so that's cool if you
want to make other objects in your scene able to be picked up you can oh there's
a couple different things you can do one of the easiest ways I found is to search
for this in the content browser this little pickup cube and you can just copy
this or duplicate it to new one call it pickup let's turn off caps lock pickup
object okay and double click on it and you'll see it has all this scripting
built in already the important part about this is that in the class settings
of this object there's this pickup actor interface enabled and you can do that on
any object by going here and saying add pickup well it's already there so it's
not going to show me but pickup actor interface the one you want to add and
that may that tells you before that this is a object that can be picked up and so
it will enable certain events and namely the event pickup and event drop okay so
once that's available then you can make scripting that applies to picking up
objects and then what you can do is just select all that hit control-c
and then go to another object that you've created like us here right and
you can turn that into a blueprint and we haven't talked about blueprints yet
we will a little bit later in the course but let's just create a blueprint with
this sphere here we can go into the event graph and like I said we can go to
class settings we can add the pickup interface at which point now we can in
the event graph here we can now paste ctrl V okay so there's there's that way
to do this and that's not everything you have to do you have to make sure a
couple other settings are right too the other way to do it is that duplicate
I made so find content browser here's our duplicate here pick up object you
can now edit this one and this is different than the one that's in the
scene already you see it's just this little box here but within this
blueprint you can change which static mesh it's talking about or it's
referencing I should say so let's say we have a different mesh in here what do we
got some fat cylinder that's just a default thing in there okay so now that
is the same exact blueprint but it's referencing this fat cylinder instead of
the box in compile and save that this is probably the easiest way to do it okay
now you have this little cylinder that you can pick up instead okay that's a
that's an object that can be picked up already now if you have objects already
in your scene you can do what I was showing before and copy and paste you do
have to make sure let's go into the sphere and just make sure there's some
other things that we need to do if we go to edit blueprint viewport if you turn
simulate physics on that will adjust some of these other things down here but
we don't actually want it on okay so
then if you start the scene it will just automatically start falling and that's
not exactly what we want we want to have physically enables when we pick it up
but not before we do okay so let's make sure it does all these things block all
dynamic fine make sure it's movable okay otherwise
you can't pick it up and I think that should have you set there might be a few
other things that you need to adjust go up to match them to these other objects
let's look in here and see what we've got going on just to make sure it's all
working properly and you'll want to match this so this is actually a physics
actor these are both checked physics is not turned on though you also need to
make sure that the object has a collision on it so this thing needs the
actual mess of this the sphere mesh let's search for that sphere mesh
remember this is just a reference we need to open this the sphere that's a
good way to do it right there by just clicking on it right here make sure this
has a collision on it so add simplified sphere collision okay so that needs a
collision on it it needs to be able to have that interface enabled you need to
copy and paste the script and then you need to make sure that it matches the
same kind of so this is actually a physics actor fine that works we can do
that too and that should work for you so there's a couple different ways to do it
you can do it with any object you want you can also just copy one of these and
replace it with any object you want like that any static mesh in your scene can
be replaced in there so you can just copy the blueprints I keep doing that
it's probably the easiest way that I found and those you'll be able to pick
up with your virtual reality hand motions okay one interesting thing that
I've found is that if you are copying all this stuff into your new scene it's
really hard to get it to work because all the different scripts and things
that are tied into this virtual reality it's actually easier if you bring your
meshes your building into here so the building that we've been using with the
class you could import all the geometry into here and you probably have better
luck but trying to create a navmesh and bring in all these scripts in you know
in the other direction one thing that is essential if you are
trying to set it up in another scene is this box brush here which is just a box
brush geometry box brush right it's just a big box and it is somehow essential to
creating this navmesh product properly so you have to have this box here you
have to have an a nav modifier volume that one that intersects with it
and then that will create with the P button again will show you your nav mesh
and then you can put your geometry around on top of this click I would
suggest putting your floor right above this box brush down here and then just
adding your geometry like I've showed throughout the course but not in the
first-person shooter but in this one and you can delete all the stuff you don't
need and then you'll just be able to walk around and navigate through your
scene using a VR headset which is pretty dang cool so hopefully that's helpful
for you there's a couple other housekeeping items you want to make sure
that if you go to edit plugins and go to VR make sure so if I'm using the HTC
vive which uses steam VR so make sure that's enabled make sure whatever heads
that you're using is enabled oculus rift is right there okay and then one other
thing when you package your project for at least I know for HTC vive package
project you just do it for Windows 64 bit like normal but you do need to go to
the level group blueprint similar to that exit command that we gave so we
need to set up a button like right click and click f1
that's not going to work for me one a gap will say feathers F one right there
F one okay we'll say when that's pressed in the level blueprint so anytime the
levels running we want to give it a console command execute console command
and we'll want to say stereo on okay so that's that's basically running a
console command telling the computer something to do and the command we're
giving it we're plugging into it is stereo on okay and what that does is
when you execute this file after it's been packaged and you're running on your
desktop you want you want to be able to turn stereo on which sends it to your
headset so you need a button to do that and that will be f1 and of course you'll
want to be able to escape too so you can do escape no I got to type it in
apparently to escape okay escape when that's pressed we can run another
console command which I showed you before and I believe that's exit okay so
that exits out of the software otherwise you'll just be stuck in it you'll have
no way out okay and we'll talk about blueprints and other instances as well
and in more depth which will be great because it adds interactivity to what
we're trying to do but this is to just run your your virtual reality stuff
you'll need a couple buttons that will help you out so if you are executing a
package project and it's not going to your headset and it's just showing on
your screen you'll need a button say f1 turn on stereo and that will just Boop
zap it right to your headset and then you'll be good to go so those are some
of the things I found working with VR which is awesome by the way I love
working with VR so so yeah hopefully that's helpful for you and getting up
and running with the template and like I said I would start with the template
delete what you don't need and then merge your project into here because
everything's running properly it's really hard to get everything running
properly if you're trying to go the other direction
because there's so many different little scripts in places you won't even realize
exist that are running all this stuff so this is the easiest way to do it okay
hopefully that's helped