How to Spawn Meshes Along a Spline using PCG in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to New real Engine 5 tutorial today I am going to show you how to spawn meshes along a spline using PCG it's going to be a very easy to follow so let's get started all right so the first thing we need to do is enable the PCG plugin so let's go up into edit plugins and search for PCG and we can see the proced content generation framework let's go ahead and enable this and just restart the editor all right so the editor has restarted and now we should have PCG in our engine so if we now go to the content browser we can right click go into the PCG section and create a PCG graph let's call this something as PCG spline and we can go ahead and open this up all right so before actually going ahead and setting up the PCG code itself let's go ahead and set up the spline blueprint okay so let's go and right click create a new blueprint class and this will be an actor as we will be placing this spline in our world let's go ahead and name this something as bpor uh line with 1 s of course and let's go ahead and open this up cool so the first thing that I am going to do is add a spline component there we go and I'm going to leave it by default okay so I'm not going to touch any of these details or parameters or whatever okay and then I am going to be adding another component which is going to be PCG so that way we can have our PC graph directly in this blueprint and we don't need to you know drag it separately and this will also you know enable us to uh get our spline information from the PCG easier so here what we can do is go ahead and assign this new PCG spline that we just created and then go ahead and use compile save and close cool so now if we drag in our spline okay we can now just go and get the spline right click on the end hold alt and drag it and we can start to go ahead and create right different points so here looking pretty good all right so we have a simple spline over here so now of course we need to spawn some meshes along this right so let's go into the PCG spline and let's begin setting up some code so right click and search for spline and we can see the get spline data so this will go ahead and you know get all information about this spline so we can know the direction the position and all that stuff now in this case it is set as actor filter self and that's how we can go ahead and find it in the blueprint because as you can see it's in the same blueprint so we're good to go all right so now with that said we can use a uh spline sampler that way we can you know sample some points along the spline so if we change the mode from subdivision to distance we can you know add a mesh every so often so if we live by you know let's say um 500 is default right and I press D or right click and click on the bug I can now go and see that some points are being generated as you can see over here right you can see this point is being generated and so on and if you don't see this being generated you can just go into detail go to the child and click on generate all right that's how you can see it but if I now disable the sample we can see that this points go all right cool so now with that said what I can do is directly add a static mesh spawner and we can add meshes over here to be spawn so in this case I'm I'm going to be adding I don't know what let me find I don't know for example we could simply just get a camera right and now we have this camera as being you know through our spline which is really cool one thing that we can do is go ahead and add an offset outwards right so I can add a transform points node break this connection plug it in and then on the offset minimum and maximum I can simply in the Z add made like 100 and 200 and now as you can see they are basically randomly a bit uh upwards now it makes more sense that they are constant so let's go ahead and just put this to 100 now they're a bit elevated as you can see they follow kind of of this spine what I can do is just simply add more points how well maybe just reducing the distance and parameter maybe that's too much maybe 350 will be something a bit better there we go and we you know get this cameras along and if I were to go and select This Plane if I can right okay well this been a bit hard oh there we go I need to select this plan component here right select this point and overall is continue to do this right as you can see automatically all of the uh meshes will be starting to appear which is really really cool and we get kind of of this um you know thing over here which is pretty interesting as you can see right and we're basically you know just sampling meeses along the planine very simple using ptg and just this three notes really four Mones right um so that's it guys if you found this so helpful I would really appreciate it if you like video And subscribe to my channel five videos and so check them out uh your profiles are available in my patre you member so check that out join my Discord server me and deps follow me on my socials and now yes with all said byebye m [Music]
Info
Channel: Gorka Games
Views: 5,169
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5 pcg spline, tutorial, quixel, megascans, unreal engine spawn meshes along spline, spline spawn meshes with pcg in unreal engine 5, ue5 pcg spline sampler, sample meshes in spline tutorial, spline add meshes, unreal engine 5 how to add meshes to a pcg spline, unreal engine 5 pcg meshes on spline, unreal engine 5 pcg spline spawn meshes
Id: dMmZpycJqr8
Channel Id: undefined
Length: 5min 35sec (335 seconds)
Published: Wed May 01 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.