GCAP 2016: Getting Started with VR in Unreal Engine 4 - Chris Murphy

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay hello everyone my name is Chris Murphy I'm an evangelist for Epic Games and today I'm going to be running you through an introductory section session to virtual reality in Unreal Engine 4 now before I begin can I get a quick show of hands of who here has worked with you a four before these two jokers at the back okay so it seems like the majority of people have kind of like touched it at some stage that's good and of those of everyone else who has worked with VR before in a development capacity I mean yeah I can see some people like well you know I slipped and fell and it ended up on my head and then you've done the early stuff so what I'm going to show you today is a quick run-through on where to begin and how everything is kind of setup and also the reasons behind why it's set up this way and how you can kind of use this to build whatever it is that you really want to build because it's kind of a short session I've kind of taken the liberty of excuse me I'm fast-forwarding just a little bit this on screen at the moment is Unreal Engine and this is the screen that you would get if you were to open it up and click new project and then select a VR project based out of blueprint ok so this would be the default template everything is stock I haven't put in any additional bells and/or whistles this is just us kind of getting it all set up now what I'm going to do from here is I'm going to quickly run through the first two things you can see so what we have are two options for where we would actually use this template from and a lot of the time you you know people would sit there and they'll be like well VR you know you're wearing a headset but there are two important like templates that you can use to develop from now the first one is hmd plus gamepad so the first one is the one of the left that represents if you were to do a VR project that was purely based out of a head-mounted display where would you go with that you know where would you begin etc etc now because that is something that people are becoming more and more familiar with it's really just controlling the camera that kind of discussion is best had with just generalize best practices if you know what I mean you don't need to be told so much how to set that one up in unreal it automatically grabs your default camera and just sets your head to allow tracking for it as long as the checkbox is enabled so for handling that I'm actually not going to go into that today instead I'll kind of go over the fun stuff and we'll actually look at full room motion control and how that's set up and how you can develop from that now the one on the right is that so what we're looking at here is hm D plus motion controllers now for today I've should use the word recruited but I kind of just told him he was doing this we're going to be using Jaden as a demonstrator who's going to be up here and hopefully I don't screw up anything too badly or you know the front the front row end up as the the soak seats so we'll see how we go but I'm going to initially load up this first level and to do that I'm getting a file open level and I'm going to open up the one that is motion controller map okay so we launched into this and you're greeted by this jadyn - can't you mind doing the honors cool okay so within this world you can see that we have a very very very basic level now from here we have just some basic cubes as well as over here you can see that there are these blue cubes ground breaking stuff so what we'll get into is going to fire into this and when we first begin we're going to launch from where this camera is on the ground I'm going to hit play now if you want to launch into VR you just click on this arrow and there's a little button that says VR preview okay and upon doing so it will it will launch you straight into it now I've already selected it once before so the default play style for this is now set to a VR camera so whenever I hit play now it will immediately launch into stereo so I'm going to click that and you can now see what Jayden sees on screen now these are the default controls that we have within the template so any project that you're developing immediately has the ability to leverage off of these with how they're functioning so do you mind heading over towards the blue cubes for me thank you now you can see that the chaperone is automatically detected can you hold down teleport but not release to the two right so does everyone see how the there's a rectangle being projected onto the ground now this refers to one of the states of locomotion that we can use now when it comes to locomotion within within VR there are a couple of different ways you can do it people are still kind of working out what the best way to do it really is in this situation we just have the ability to teleport to any location that is held within the navmesh so I'll show you what that is in just a second I'll try not to bust out too many tech terms without people being familiar with them but you can see that this rectangle is kind of a weird thing for a teleport to have around but what this rectangle actually represents is the room so ahead of time I traced out where the region would be for this room and then upon pressing the button they can see where they would end up relative to the room itself do you what I mean I can see some people nodding a couple of people go cross-eyed what's wrong so if he goes around and looks back at the cubes behind him I'm making hand gestures that he can't see if this like oh cool and you can use the triggers to pick up any of these boxes so by default we can just go out and grab and grab another one and if you want you can attempt to juggle we can test his coordination failed but from here we've got our basic props all set up so is able to interact with it you can see that the hands have some basic motions as well so that they're gripping whenever the triggers are pulled and he can use this to do all sorts of things for instance he can pick up one of those boxes and put it on top of another box that he's holding to kind of stack them up a bit because they all just respond as E they all just respond as physics objects okay so the unreal physics engines just kind of kicking in and handling the load now if I was to make a game that was straight up like gone home for instance and I wanted an interactive world this is an entire grounding that you would need that you would kind of start to develop those things with you go one coming from you starting to have too much fun so I'm going to pull them out of VR and we'll look at how this is actually set up okay what I'm going to do is this over here is the player and I'm going to right-click on it and I'm going to hit edit motion controller porn now I could access from a couple of different locations it's also stored inside of the blueprints folder I have a tendency to access things out of references in the world either way it's going to launch the same screen which in this case just loads up all of the code associated with the object on screen now this is blueprint I can I get a quick show of hands of people that have used blueprint before that's really good okay so for anyone that's unfamiliar with blueprint blueprint is essentially a node at node based coding language so typically within within Unreal Engine 3 so the previous version development used to be done through two things used to be C++ if you were a licensee and then you would have Unreal script now with Unreal Engine 4 everyone has C++ access but on top of that we use what is called blueprint and blueprint is essentially epics attempt at making a very user-friendly interface because it's basically developed to enable anyone within a development team to contribute in areas that they typically wouldn't be able to actually work with a good example of this is anyone in here a game designer or artist that doesn't typically program a couple of people the hands are going up so imagine you've had these these issues before where have you ever had a conversation with your programmer we're like this will be a rad idea and the programmer is like yeah maybe but I got too much going on or maybe they just think it's a bad idea so they don't want to test it at which point you like well I guess my feature is never going in this video game blueprint is great because it's made to be as accessible as possible so what ends up happening is artists can kind of jump in there and start to tinker and work with things and just try out stuff if you think that a camera shake is a good idea to have on landing and the program it disagrees and doesn't want to put the camera shake in you can just do it and this is really really useful because you can put in some pretty advanced behaviors in the process so game designers can just experiment without having to go through their programming team and in addition to that you know in this argument but I'm having with myself I'm making the programmer seem the bad guys but the other thing here is that it enables the programmers to kind of focus on developing the stuff that matters you know you want your programmers focusing on core systems and you don't want them having to go in and add the mesh to thirty different weapons that are being brought into the game and configure the values you know if your artists or your game developers game designers are able to immediately jump in and tinker with those things it frees up your programmers to kind of do what they want to do and what they really need to do so with that said let's have a quick look at how blueprint functions and then I'll run through the rest of this from there so essentially we have an event-driven system see these red nodes here the screen reasonably clear for everyone these red nodes represent events so when an event is triggered in this case begin play so when the game first begins this comes off and immediately just starts up a sequence that says find out if they're using an oculus steamvr or psvr set it to the correct tracking origin that you would typically need to use one of these things so does anyone understand how these white nodes represent execution flow so it's just one instruction to the next instruction to the next instruction there's no header information you're not dealing with weird complicated referencing and dereferencing of pointers you're just kind of dealing with a conceptual level of I need to do this and then I need to do this so we run through these steps so this initially just sets it up for whichever form of VI you're using so this demo is theoretically usable with either a touch setup or with psvr still keep going to call that Morpheus so and from here we can then see that it goes ahead and does two other things and this is very important it creates a beeping motion controller and then it creates another motion controller it attaches them to my body and it sets one of them up to be left and one of them up to be right now the reason I bring this up is pretty important is your body in this situation and in the VR demo doesn't actually have hands until this point the hands get kind of added to it and they themselves have separate information that's being passed around okay so what that means is that your body can send basic put information through to your hands but your hands can actually be separately programmed to be set up in whatever you where you want so if you don't want hands and you want to have gun hands for instance you could replace this reference and spawn in something else that would be that thing okay so if you didn't want to have just standard pickup work you could have your right hand able to pick stuff up and your left hand is a someone give me a thing that's not a hand sword yeah so you know you can set this up in however you want and from here I'm gonna have a quick look at how these mushroom controllers work and I'll go into some of this functionality and then we'll extend on it and we'll go from there so I'm going to open up the motion controller which is the thing that we create and it's got a bit of functionality that's in there but for the most part you don't really need to touch this unless you really really want to the functionality that is in there by default is rumbling whenever you're able to move to a location so your hand gives you a nice subtle hint that something is possible there's hand teleportation that's built in there so again that's the teleport function that we showed you before including the creation of a chaperone so you can see where you're going to be relative to your space we also have basic hand animation information is being held in there that's a very simple blend that just tells the hand if it's open or closed and Unreal animation system automatically blends between an open and closed State but for the most part nothing here is particularly particularly difficult the thing that is most important for us to really look at is that when you use this it's going ahead and it finds the nearest actor near your hand and when you hit grip the grip goes off and grabs the object suddenly not seeing the function grabbing there we go you can see that we have this function called grab actor okay now within before I showed you events and events are things that when they trigger it goes off in outlines certain code that gets called in this situation a function is similar to an event with two big differences an event can have like a delay in it if you want to so I can say run this and two milliseconds later run this as well whereas a function what's called a return value so a function could be run to give information to something else so the function might be check if my hand is near something and it returns a value saying yes my hand is near something does that make sense to everyone wonderful so in this situation it gets the nearest acting me the hand and it uses what we call an interface and this is the real strength of this system and this is the reason I'm kind of like running through these bits is it looks for what's called a pickup interface and then it runs that now essentially essentially when you're normally developing things how you would typically handle it is you would have for instance a bass actor that everything else that has those kind of instructions would be built from so I might have typically in a standard game you might have a thing that was like my bass pickup actor and everything else would extend from that bass pickup actor so the ability to be picked up would be passed on to all of those things instead what this does is it uses an interface so that any object in the game can be given a special function that in blueprint automatically says hey what should I do when someone tries to pick me up what should I do when someone tries to release me and I'll show you that on the prop itself so I'm going to open this prop there one of these cubes in the world which is this and you can see that this prop itself has some events for event pickup it omit all it says is when I'm trying to get picked up turn off my physics and attach it to the hand so you can see that the attach to is the thing that gets right in from the hand that I showed you before so when a hand goes to pick something up it says to a prop hey this is me I'm trying to pick you up and the prop goes okay here's how that happens now what that means is and again for the for the drop function all it's doing is it says stop simulating physics on this object and detach it from the actor now what this means is if I wanted to create something else for instance that when I grab it it gives me different functionality I could do that without any issue so it doesn't actually need to be something that could be picked up on grab I might create a cable that is permanently attached to the wall that is following my hand around the room as I try and plug the other end of the cable into things I might use the grab functionality as a way of when I click on something I'm actually activating it instead do you know them in like I could put this functionality and all sorts of weird wonderful ways but we can also extend on this further so what I'm going to do is at the moment these events pick up and drop get read in from these input within the controller pawn when grab left is called it just passes the information to the hand to try and pick it up and see what happens when released on your hand is called it does that now by default this is using the triggers to pick things up okay so when I aim at something I pull the trigger to pick something up now does anyone anyone think of what the issue is if you're using triggers as your way of picking things up so yeah yeah look that's one thing but one of the other big things here is that in a lot of games when I pick something up I probably want to do something with it so when I pick up a gun for instance I want to fire it when I pick up a flashlight which probably would've been the friendlier example to have used I want the light to have turned on and to turn off whenever I do it okay so typically input can be kind of a pain whenever you're working with a project to zero in here at these kind of issues when you're setting up inputs and things are going around this is kind of one of the another strong suit of unreal what I'm going to do is I'm going to go edit project settings and I'm going to go ahead and I'm going to change this controller system around so that we are instead using the left and right grips as ways to pick things up and triggers are instead going to call an activate function on them okay so I'm just going to extend this code just a little bit so you can see how to do that and how we would go about adding additional functionality to again okay so the quickest way to do this have gone project settings I'm then going to go down to this little section called input okay and under input we have these two sections called action mappings and access mappings and if I click on these you can see that a bunch of these have already been set up because these are by default in the template and these are essentially just you bind a generalized function that is grabbed left and within here I would actually say grab left is motion controller left trigger and I could say grab right is motion controller right trigger everyone see how that works the fun part of this is you can add additional bindings such as spacebar when they're not looking so that the next person time someone's like testing it I can pick things up and they don't know why their hands are failing them yes so how it works from here is all of those bindings yeah all of the bindings can be set straight up I mean so at the moment epic is developing a rubber wrinkle so that is explicitly made for the oculus touch so any of the functionality you see in that is just is in unreal engine a lot of the improvements as well are coming into the next version which is currently in preview but should be out in I want to say a few weeks no not sure the date yep few weeks November 11th Thanks so from here what we're going to look at was we've got grab left and grab right and they're currently set to the trigger what I'm going to go ahead and do is I'm going to rebind these two motion controller I can see that I have grip and I'm just going to bind it now so that we've got our grips set up as the things that grab so I'm just going to select again our grip 1 so we've got left grip and right grip are now set up so I've just quickly set that up jadynn you mine drop it in and these should now allow your pliers to cool and now if it was to use the grips and untangle himself I gave one of these presentations once and unfortunately the cable got ripped out so this entire time he's doing it I'm like it sweaty palms going on she's ready to dive and grab it so you can see that now instead of pressing the triggers he's able to press the grips and we get that functionality being pushed through instead okay not exactly groundbreaking but let's actually push that a bit further and now add functionality to the objects that are in our hands okay so I'm going to go ahead and I'm going to say we have you know what you might as well just leave it on this won't be too long plus this way everyone can look at you judge your idle behavior okay so I'm going to go ahead and I'm going to make anything that is called activate left and activate right okay I'm going to bind it to the appropriate controls it's also old contextual so anytime I want to add one of these you can see that it's filtering the results until it finds what I want to use cool so we've now added two functions here that I just activate left to activate right and what I'm going to do is I'm going to quickly look at the motion controller point and you can see here that essentially how this works is a calls grab actor on the Left controller and it calls release actor on the Left controller whenever these are called if I was to open up that function you can see the the motion controller itself just runs some quick code so what I'm going to do is I'm going to add functionality to my hands because my body says to my hands grab my hands say to the object that they're trying to grab how do I grab you but in this case what we're going to do instead is my body is going to say to my hands pull the trigger and my hands are going to say to the object hey they're trying to activate you okay so there's a couple of different ways we can do this but the quickest and most efficient is for me to just quickly create some new events in blueprint that are going to be input actions so input what did I call it activate you can see that those things that I created in the project settings activate left and activate right are just immediately there and they automatically give me the options of released as well as pressed so I've got my activate left and I've got my activate right and I'm going to grab this reference to my left controller which is stored here as a variable again I know this is going to be the deep end for some people that have just new to this but I feel like it's more important to show you that you can do it then exactly how to do it so you can come back and ask me questions and feel free to email me if you want to know how to you further so I've got activate I've got a reference to my left controller and I've got a reference to my right controller I'm just really quickly going to go ahead and add some functionality to these cubes so that on activate let's just make some on activate let's make more cubes that's the quickest and easiest way for us to do this so in my cube I'm just going to say a new event actually I want to put this in my interface now that I think about it so before remember how I said that any object can be picked up and dropped because it has a simple interface that's being added to it activate is probably something I would want to include in that interface because I would imagine that any object that can be picked up or dropped I probably want to have a stub to have the functionality that says can be activated so it's a rather generic function call that makes sense to people cool I'm kind of focusing on like two or three people that are like always nodding at me and I'm like yes so I'm going to go here and quickly just look at the interface you can see that anything that into anything any blueprint that has been added that is told to have this interface gets pick up and drop I'm just going to quickly add a new one called activate compile save and you can see here now that if I was to click here I can now see that event activate is a thing that exists in this cube because it has that interface enabled okay and upon activating let's do this I'm just going to spawn a new object so the second that the activate is called on a cube it's going to go ahead and just create another cube okay let's go pick up Q and the location that it's created at is going to be the same as the current cube which means it will be spawning it inside of itself but in theory the collision handling is going to sort that out and move it above so now that we've added the functionality to the cube itself let's quickly add that functionality to the hands and then pass that message back to our body that makes sense in fact we could probably skip the hands entirely and tell the body to look at the hands and reference it that way in fact now that I think about it that might be a little bit quicker for us to show you so to do that I'm going to open up the pawn and activate left on call is going to call which you can say get the attached actor to the hand and if that is valid so is valid means check if this actually whoops I'd ever collected by accident where was I wasn't valid actually checks that there's an object in the hand itself and if that is valid what we're going to go ahead and do is call activate on it okay so I'm going to do is just very quickly with just one hand so an Jaden's I think Amell do these left or right unfortunately because five controllers are identical you don't actually know which the left or right is until but the advantage of how we're doing this at the moment with the left with the motion controllers being a separate object means that the second you had functionality to one of those hands it'll add the functionality to the other one of those hands does that make sense to everyone because it's like an identical object so actually might as well just rig this up for both a pawn so I'm going to grab you but instead of doing that code on the left hand I'll just quickly tell it to do it on the right hand unfortunately while the hands themselves are agnostic the body still needs to be told if it's doing something with the left or right hand so in origin going to hit play and in theory if it picks up an objects close the trigger it's a very small cube and if he was to like reach over and pick up one of those things called smallest cube it can create even smaller cubes the reason for this is they all have a scale that's relative so but does everyone see how the functionality and one thing can be immediately added to the next to the next to the next to the next and you're again you're having too much fun but everyone can see how there's like simple set up you're out okay so thanks man so you can see how that simple activate function is now in there and if we wanted to we could make any object that we add to the game do that an example would be is let's say I wanted to create something slightly cooler than a cube and let's say for some strange reason I couldn't inherit from my pickup cube so I had to create a new actor what I'm going to do here is I'm going to go ahead and I'm going to create a sword so I saw it's gonna have different functionality to a cube and essentially what we're going to do is we're going to set one of these actors up from the ground up so I'll show you how you would set this up which functions you would go through and how we could add some additional behavior to that object okay but there's our understand at the moment like how that a simple activate function we could extend to any of those objects without drama excellent so I'm going to right click I'm going to create a new blueprint Jaden you could probably sit down for a second without too much drama so I'm going to create a new actor just right click to hit new blueprint I'm going to create a new actor I'm going to call this sword and my autosave is going to kick in halfway tapping it so it there we go so I've typed in sword and when I open this up it's just this there's nothing in it there's no 3d mesh there's nothing like that but I'm going to go ahead and go to my class settings and I'm just going to tell you to implement an interface and it is the pickup actor interface okay if I go to my banker off in this I can now see that if houses have been events I can see that event pickup is now a thing that is there as well as event drop and event activate so it's out of that functionality to this completely new object the next thing I want to do is because we want to sword let's actually add a mesh that looks vaguely reminiscent of a sword typically with these presentations I usually actually pull down some of the free assets that epic give away online from the marketplace I don't have internet access on this laptop right now so we're not going to get a cool infinity blade sword and instead have a rectangle sorry it's less flashy this will be sluggish and I'm going to quickly set this up to be that let's kind of make this look a little bit more sort like really quickly so I'm going to rescale it there you go look at that what a sword Excalibur here's your world it will be the next king of England okay so we've added this here as our sword I'm also going to add a little mini handle so we can remember which way is forward on the sword Oh now we can get without a handle so we've got a quick 3d mesh here and if I was to hit play and get Jaden to pick this up at the moment so I'm going to drag my sword into the world he's going to be quite disappointed the reason for that so you can see the sword just chillin over there nothing's going to happen now the reason few type grips and the reason for this is we still need to add the grab functionality okay so even though when we add an interface to something it adds the stubs of logic it doesn't carry across that logic so we to actually add that ourselves if we're not inheriting from something that actually had a logic in it okay so a good example of when we would use interfaces is at the moment I'm working on a project with Dinosaurs you would use an interface on a gun in the game so I can shoot the gun but a gun and a tiny dinosaur that I want to pick up and throw across the room is not going to have like a common parent that we really can kind of get back to do you know what I mean so I would add an interface to my little Compsognathus and now I can give it a very bad day because I can just add that functionality that would have there so you go I'm coming from without the common base being involved right so within the sword I'm now going to quickly I'm just going to copy and paste these functions here they're reasonably straightforward so because everyone understands how it's just saying enable physics I don't enable physics so I'm going to go ahead and drop them in in fact I could theoretically copy with those entire events and they should copy okay now we have to okay cool so all I'm going to be doing here is at the moment this is trying to reference static mesh component which was an object that was in the previous thing instead of the static mesh component we're now just going to get a reference ourselves I'm sorry I'm going to reference the sword mesh as the thing and as the thing compiled everything works so I told her to just make sure that the sword is the thing that's simulating physics and now when I hit play and he goes over to the sword we can now have the ability to work with this object should unknown okay so that's not particularly impressive because our sword is lacking one key feature of a sword in that it's not being a sword so let's go ahead and quickly add some extra functionality that we could tie into this object to make it cooler so I'm going to go to my sword mesh and there's this nice little function here called simulation generates hit events okay now when two objects that generate hit events have this triggered when they touch one another they get told that they hit one another and they trigger an event called hit does that make sense great so I'm going to turn on hit events and now when my sword hits something I'm going to cut it this is going to be the world's most basic implementation of a sword but it'll work so at the moment Oh your hands going up are you yawning okay yeah when it's like released from the object you could there's a couple of ways you could do that if you're trying to find out when it leaves an object it's kind of a really pure such like it's a situational thing there about what constitutes leaving the the hit I would probably set that up as overlaps instead of hits so that on end overlap so I'd set up a tiny region that was like it goes off when something goes and touches another thing and then the second it leaves that volume that now no longer constitutes a hit did you know them in so on end overlap I would call the functionality you can do this in a bunch of ways yeah in this in a bunch of ways I might actually know that you bring that up maybe overlaps actually a better way for us to do this so I'm going to do is we go back to my viewport sword should only cut one way okay so I'm actually going to go ahead and I'm going to add a little piece of functionality to the front of this sword that is going to represent the side that is sharp so I'm going to add component I'm going to add box collision and I'm just going to stick this here I'm going to quickly make it thin and only on one side I'm not going to tell Jaden which is the cutting side so this will get a little confusing I might make an error component so we can see which side is the Cutty bit there we go look at that thing so now when we look at that in the world this is our new Excalibur great so let's quickly add this functionality now there's a feature that was brought into Unreal Engine in 4.13 that allows you to dynamically slice meshes okay so what I'm going to go ahead and do is I'm going to grab a table that is part of the engine content so if you see this table in the world this table is basically my favorite thing to destroy half of my games that I make in prototypes involve tables coming out too aggressively so I'm going to use this table as my reference now the new functionality that was brought into unreal uses what's called a procedural mesh tool so it's got some functionality that's in there that allows you to slice anything that is considered a procedural mesh the procedural mesh is a mesh that is generated in whatever way you choose to do so but what we're going to do is I was going to give you a quick outline of what I'm going to do before I do it is we're going to create a chopper ball mesh that chopper will mesh is going to have a procedural mesh in it which is going to copy all of its information from the table and then I'm going to cut it up okay this will make a little bit more sense in just a second so I'm going to go back to my blueprints folder that I was working out of before and I'm going to create a new blueprint so again this is a new thing that we're creating this is going to be a chopper ball mesh okay my chopper will mesh is going to have I'm going to add a static mesh component which is going to be called a static mesh and I'm also going to add a procedural mesh component now this is one slight drawback to this system is a procedural mesh can't be told by default what it's pulling all of its information from so like by default a procedural mesh is kind of like something that is ready to be molded but you can't just tell it by default that it's you're going to look exactly like this does that make sense like it's not told that you will be a table in some sort of simple Dropbox instead what we do is this I'm going to do in a construction script so before we're looking at the event graph the event graph works by having when someone clicks on site when someone does something in the game it triggers an event the construction strips are super powerful because a construction script is essentially something that runs before the game actually begins what it's instead it's when you place an object in the world it runs a little piece of logic that determines what it should or shouldn't do that make sense so a good example is I could make a construction script that when I dropped in a fence post it automatically built a fence to the nearest wall and then my artists would celebrate because they would never have to manually place all of those things again in this case what I'm going to do is I'm gonna drop in my procedural mesh and I'm going to drag off static and I'm going to type in the word proc because this will just filter out and you can see that there's a nice function here called copy procedural mesh from static mesh component okay I click on that and this automatically has some functionality that's just set up there to get a reference to a procedural mesh copy all of its information into a procedural mesh and then I'm gonna hit create collision now the other thing that I'm going to do is I no longer want my static mesh to exist so I no longer want the 3d object to exist because it's there which copied its information into the procedural mesh and now we want to just remove that initial one from existence because it no longer matters to me do you know I'm coming from here great because otherwise we have two tables that are inside of one another which is just ain't no fun so what I'm going to do here is there's a cheeky way of handling this I'm just going to say if the static mesh still exists quickly run this code and copy the information into the into the procedural mesh and upon doing so destroy the static mesh component this way it actually only runs at once even if we're dragging it around it just kind of works itself out so now if I hit compile save and I was to drop this tropical mesh oh yeah I haven't hold the static mesh to be a table yet so really quickly static mesh again I don't expect people to a hundred percent follow stuff from here now there's going to be an issue when I do this which is why I kind of want to run you through this bit if I go table and I set this up as something that we're going to be copying data from from one to the other this is actually still not going to be work and this is the number one gotcha that's going to happen if anyone is trying to do this at home by default these assets don't have CPU access so what we actually need to do is tell the table that you are something that every now and then the CPU is actually going to need to open up and get some information from this is one of those sections of the engine that could be a little more streamlined a little bit but once you know it's a check box that you have to fill you don't forget because it frustrates you for 15 minutes the first time till you google it so I'm going to go here allow CPU access and now this time when I drag in my trouble mesh you can see that we now actually have a table so that this table itself is a procedural mesh okay it's not a it's not a static mesh so they look identical so I can't believe it's not table so I'm going to delete this table so we don't get confused by what's going on and all I'm going to do is I'm going to go back to my sword and as I said before it's going to use hit events but after you asked a question I'll show you overlaps instead this currently overlaps everything so all I'm going to do is in my sword I'm going to say yeah actually is a nice way for me to do this instead so I could right-click and I could just add the overlap myself but one thing that's worth showing you is that if you've added some sort on any sort of a component on the left-hand side to your object you can always scroll down and you can see every single event that can be created from that component so that make sense so this is a nice thing that if you don't know something exists you can have a quick scan over this if you don't want to just type in random words to see if functionality exists in this case we're just going to say on component begin overlap if the other component that we're overlapping is a procedural mesh we're going to call slice procedural mesh and slice just looks for two things slice looks for slice looks for position to slice from and a plane with which to slice so if it's trying to work out if you're cutting this way or cutting this way because it needs that information about where that rectangle would be in 3d space does that make sense so I'm quickly going to say we want to we want to cut from where I am at the moment and the direction that we want the slice to face is going to be the right vector of the object so and if you imagine an arrow ah no sorry we use the no right vector yeah you look confused yeah sorry I have someone in front doubting me which is just like making me just okay what could go wrong we might end up just cutting from the wrong direction but I guess we'll find out you can see that we have create other half is an option and I'm also going to tell it to add a cap which just means essentially means create so if you would cut a 3d model in half at any point typically there would just be empty space where you had cut this goes ahead and creates a nice flat surface for where the cut occurred I'm going to tell the other half to simulate physics this way when it's cut it falls off compile save yep oh one other thing I'm going to do okay this is also very important sorry before we go into that now how this works right now and this is the danger of using an overlap is if I was to cut it's when something enters the box does that make sense to everyone second something enters the box it cuts it what it's going to do is if it's instantly creating another half it's going to cut that half instantaneously does that make sense because it also is now entering the box which is then going to cut and create another half of that instantaneously everyone see where this conversation is going cool so what I'm going to do here is there's a couple of different ways that we can do this this is kind of like a cheap and dirty way that shows you a nice function as a function called do once and all I'm going to say is only cut one time I probably do the do one so after the procedural mesh component section actually all this is going to do is say do once and after we've done the cut I'm going to say set up a quick delay of 0.2 seconds hopefully no one realizes what's going on and reset the do once does that make sense also I can see some of you cringing because you're like oh my god blinds are going to go everywhere if I double click here I can create a reroute node and clean this whole thing up but in theory we should be fine yeah famous last words right okay so I felt the kick as it did it yeah yeah yeah do some more cuts okay yeah okay so what happened there was very simple in the procedural mesh you are generating overlap events oh I'm sorry I've suddenly missed something along the way I felt the initial kick as it went through so times like this it's a good idea for us to actually run debugging we'd hit f9 and what f9 does is when something happens it's going to throw in a breakpoint is anyone here familiar with breakpoints okay so there's a good chance here that I'm doing something like cutting in the wrong direction and I've just missed up my vectors I usually do this with a sword bash that is there we go okay so it's doing the cut it's doing it from where my sword is located and it's doing it in that direction so that's all correct immediately after it's simulating physics that is a good question no it doesn't by default but it should have still done it off the hey one second yeah so it's gone okay sorry about that sir okay I know it's going on we're okay now the sword that we created when I set things to have physics on them I didn't make the sword mesh the base component so when it started simulating physics it fell off the rest of the object that was then floating in space like it wasn't the parent that everything had to it so the reason he wasn't able to pick it up just then is that the sword no longer existed in that location it was separated sorry about that now we go through again and we'll see that you should be able to pick up the sword cut the moment it's okay so from here we go through and we quickly work out why my vector is completely utterly wrong and I'm sorry about that this was something that I tested before and everything was fine it should just fall off because it should be simulating physics yeah so what I'm going to do is very simply I'm just going to quickly tell you to because you could be right could be similarly because sorry about this I've run through this several times so I've missed something this time around I guess sure you got any suggestions yep awesome okay pick up the sword head back oh so we created the collision opponent copying all of the information to it separately labeled version enabled and set you to these complex just going to do real quick tests before I put him in okay this time the table doesn't fall through the world Hey there we go so everyone can see the functionality that's coming in okay it's getting a little bit embarrassed there for a second so you can see this functionality we just added something to the world that we can tinker with in different ways and if Jaden smacks something with the back of the sword it won't cut unless he overlaps it too much but doesn't understand how that's working now it's so if we're able to miss those extra quick things that I had to throw in say you feel number presentation so for every one that the miss what I did there quickly to save that sorry about that she can hit escape sorry Jaden is I when I created the slice I had to tell it as I want to created the initial mesh I had to tell it that it had to have collision turned on so it wouldn't fall through the world because again procedural measures are require a little bit more setup but you can see that you can get some really fun stuff out of this yeah so you could do that in a couple of ways it depends on how you want to smash the vase you could yes yeah look you could set up basic like fracture functionality I would use this more for when I want to have a very controlled cut so this is for when I want to like slice through something because I want to rip off Star Wars but not tell anyone the number king of Star Wars like not normally no if you if you if you want to do like fracture effects yeah that's that's to handle differently this is for more of controlled cuts so yeah at the moment I mean if you wanted to write something in you could the functionality that's built into unreal by default just as a straight cut so it's powerful when you use it but it also it kind of depends on how you want to use it and what the effect is I've seen it used I've seen this kind of stuff get used in some pretty weird wonderful ways like um events that you can laser cut would be done through we were done through a procedural mesh but it wouldn't be done through a something loss the would wouldn't be done through the slice functionalities built in by default you would do that on a lower level and tell it where the cuts are and which faces are getting separated so make sense yeah as I said so you can see that we can really quickly and easily extend functionality and the fact is is that like Jayden suddenly has a like when we give him something like this be our experiences by default are actually pretty straightforward like you develop them in the same way that you develop your regular games with a couple of hitches a quick thing that's actually I gotcha in VR that I'm going to point out here as well is that if I look at the VR player porn that exists I go back here and I look at the components the porn is nothing but two references to where two hands that exist a camera and an origin point for that camera now here's a big issue that you're going to come across if you are using VR stuff for enemies that are hunting you for instance typically when you get the actor location of an object you're getting its location that everything is parented from so if I say hey where in the world is Jaden as an object it would tell me where his feet are most likely okay now here's the trick is that while would tell me where his feet are normally in VR his camera isn't locked to the center of the object so if you think about this the room is his location and his head is floating around the room relative to that location does that make sense to everyone so this is a really funny issue that I keep seeing in a bunch of Unreal Engine titles that are using what I'm sure happens you might as well it's just something that spot because I keep seeing Unreal Engine titles is that often if people have like really strangely performing AI they're telling it to hunt the center of the room but their players end up running away from the dinosaur or whatever it is and they're a couple of meters that way so their enemies are running this way and all you need to do there is if you're telling an enemy where the location of something is tell at the cameras location instead of telling it the body's location so that make sense so everyone it's just a small gotcha but it's definitely one of those things now with that said we're coming to the end of the the presentation here so I just want to say I'm been working as an evangelist around Australia and I'm doing more sessions so if you have any questions you're more than welcome to contact me I just come up and ask me for a card I'll give you one if you have any recommendations for sessions any issues with your businesses that you're hoping to kind of ask some questions about and find out if youif or is right for your team or if VR is a good thing to get into for your project or anything like that just feel free to come up and talk to me I'm happy to answer emails as well like after the show if you want to harass me several weeks from now it's no problem so yeah come up talk to me let me know if as well what your city what you feel like your city could use so if you would like to see some art presentations for instance about developing a pipeline for art for ue4 that's interesting to know if you think that they need to have more programming tools and like discussions there then let me know so does anyone have any questions oh so the other thing that was worth pointing out was the Unreal meetups in each group I can see Josh pointing at himself in the back so within each city we have Unreal Engine meetups I think every capital so every state capital has one at the moment the Unreal Engine meetup groups are just areas that all of the Unreal devs can kind of meet up talk most recently we had everyone that's going to be presenting at pax Australia we brought everyone in in in the Melbourne scene to kind of like compare titles and rip apart everyone's games but in a friendly way but that means that we were able to kind of like say hey this is great but you could use effects here here here here and here here's how you could add them in a painless way or hey from our experience doing this was good but some camera lag was a really nice effect you can do that with this so as I said these meetups are a great place to learn if you're just beginning they're fantastic if you've been there for a while they're still pretty useful because you think you know things and then someone will just hit you with an obscure fact that you weren't aware of or feature in the engine so they're pretty powerful and feel free to get in contact with Josh who's at the back there waving his arm around he runs the the Melbourne Unreal Engine meetups so yeah any any questions yeah so that's a much bigger question for happy to answer that afterwards but essentially you would create either a pawn or a regular actor depending on if you wanted the player to ever control it and you would give it some some basic AI that would run around there's some super simple blueprint implementations it would probably take me about 10 minutes to set up something that was kind of fun that you could control as well yep so the movement that was being used here yeah I'm sorry so the standard movements that you get are looking and pressing a button to teleport to a location so that's in the other the other one the other template that all that is is literally binding where you're currently looking to a function called teleport which is built-in to actors so it literally just says here's where I am here's where I'm going so all you would need to do is find out what they're looking at and teleport them to that location upon a button press in the situation that we have here with this motion controller demo that we're using we have the functionality built in to the here's the update so essentially the hand sorry the body goes ahead and boys out a trace to a location finds a distance and it essentially just wherever you're aiming it sets the world location which is what I was talking about before you can use either teleport functionality or set world location the difference in there is that teleport includes your current physics so if I use the teleport functionality while falling I would teleport out falling at the same speed if you a time in so I could use that for like portal like behavior for instance there's a couple of different ways you could do this stuff but yeah it was a recipient oka motion that you wanted like yeah okay yeah no that's great so that's something that we can get into so if I happy this entire world is covered in green right now so see how forgetting valid locations and that was excellent question and I missed it I'm sorry so what we're essentially seeing here is that when we drop when we want to add AI to the world in most games we would typically add a navmesh and what a navmesh essentially is is just an area that says AI should work out how to run around these objects and if my navmesh actor is too small like in this case you see how there's this gap here now if I was to hit play and told Jaden to can you teleport to your left keep going okay so see how that's no longer applicable it's not letting him in there because what's happening so actually given your warning before I just ripped you out what is happening is it's by default to control the teleportation and keep it friendlier we're using the system that's built in therefore the navmesh which says simply here's what the AI can go so here's where I can go as well and we only teleport to locations that are on the navmesh does that make sense so you'd add some volumes to your map to say these are the regions players can teleport so that's a that's a really good question I mean at the moment if I got my nav mesh and I put it here and I hit play hey JD fragile body joke's on you but now try and teleport onto the top of those things yeah so now I'm only able to go up there so I've moved nav measures I can scale those as well so that if I grabbed the thing I just keep pulling him out without giving him any warning okay if I if I grabbed the thing and now hit play he would now have the ability to traverse across both the ground and the tops does that make sense so get out a bunch of those to my map and essentially that that's what controls your locomotion locomotion and what constitutes a valid teleportation location yep when he tries to walk away yeah so the okay so how it works by default is if he tries to walk outside of the chaperone he'll see the steamvr grid and he can continue walking by default you can't see the grid it actually only gets overlaid in the headset which is actually really useful for when you're recording demos and stuff you never see like visual grids and stuff popping up on screen but those are a thing that yeah it's handled on that layer so he could theoretically keep walking if you wanted if you wanted sue to go further with that you could just do a trace from the actors location to the cameras location and always check to see whether it's uninterrupted with there's no static geometry in the way and if there was you could then either give them a message popping up on their screen or you could kind of dull we fade it as they leave the area and go further and further out to try and persuade players to walk back into the the region that they should be going in so there's a couple of ways you would do that if you were doing a fade like that I'd recommend doing a fade but with like a spherical mask around where they should be so it'll go black until they turn around and then they can see their home and as they walk towards that it would be like a nice clean way to do that you can handle that in different ways but that's how I probably go about it any other questions in the case thank you very much your time I hope this was useful if you have anything else feel free to hit me up throughout throughout the conference or pax I'll be roaming around cool thank you very much you
Info
Channel: GCAP
Views: 15,253
Rating: undefined out of 5
Keywords: gcap16, game connect asia pacific, gcap, game development, game design, vr, virtual reality, programming, unreal, unreal engine
Id: RWIQVTB6km0
Channel Id: undefined
Length: 59min 51sec (3591 seconds)
Published: Tue Dec 20 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.