UE4 Tutorial: Add spline-meshes procedurally

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys I'm Morton from playful synapse in this video I will show you how to make procedural spline meshes and how to control them with a spline this technique is really quite simple but very useful for creating complex bended shapes of many kinds what you see here on the screen is the pipe spline mesh from the example files that comes with the Unreal Engine I've created a construction script that adds this spline mesh between each point on the spline this makes it very easy to modify and create the shape that you want to make so for instance if I want to um make this a bit longer I just click on the spline point at the end like that if I want to add another spline point I can just click on the middle here and another spine point I can then bend the shape as I like like this if I want to to end the to change the direction of this bline I can just uh change it like this just be using the rotation tool so you see this is a very handy way of creating a lot of bended shapes you can use it for creating pipes like this roads uh and a lot of things I'm sure you have u a lot of things that you can think of yourself that you would like to use this for so I'm going to show you how to make this one in this tutorial so just lean back and enjoy to get get started we right click and add a blueprint actor and name it my my pipe mes for instant double click and here we need a a scene so this one top SC for instance add one more component we need the asine like that this is really all we need from this section so let's go to the graph and the construction script what we need first is to figure out how many points there are on our spline so let's get this bline get number of bline points we further make a for Loop like this our for Loop should start at the index zero now what we are going to do is that for each two spline points we are going to add a mesh between them so say if we have three points that will be two meshes so we have one less mesh than the number of points but since the first index start at zero we need to deduct one more so we need to to deduct two from the number number of spr points like this so let's deduct two so now we have a for Loop that start at zero and ends at the numb of blind points minus two for each uh run in the for Loop we are going to add our spline mesh so let's just this add oops add spine mesh component like that let's connect them and use the manual attachment and if we now click on this one and select the mesh that we're going to use let's type in pipe that's it's it called it's called s s pipe spline like that one important thing is uh when you have this spline you can see that the forward direction for it for the spline is in the set Direction upward so when you have uh selected the spine here you need to also select that uh its upward direction should be the forward direction should be the set axis in this case like this uh in in general if you're going to use some other spline it's quite useful if the spline Point um the the The Anchor Point of the spline if that one is uh in in the middle otherwise your spline is going to look a bit strange so just make sure of that so here having added the spline mesh component we are now going to attach it and uh so we take out the value like that attach to and what we're going to attach it to is the top scene like this we now need to set the start and end point for the mesh so let's just drag out this one let's set start okay oh sorry you need to to drag out from from this one the return value set start and end in local space this is the function we need it's connected now we just need to figure out the start position and the start tangent the end position and the end tangent and that's something we are going to get from our from our spline so let's just uh uh get this bline like this and U the function get local location and tangent at spline Point like that so the first one is going to be the the the index value so here we just figure out the the first spline point and connect it like that start point and start tangent so that's our from um front part the start position and the next position is then going to be the next point so let's just make a copy of this one L like that that's going to be the next index so here we have to add one like this here you go end position and the end tangent and that's really all you need to do save it and compile it now let's test that it works just drag it out here like that click on the point you can move it around click in right click in the middle add spline point this seems to work quite well see that we can uh also twist and turn the end points so this is it uh I hope you had a good time and thanks for watching
Info
Channel: Playful Synapse
Views: 158,018
Rating: undefined out of 5
Keywords: Unreal Engine (Video Game Engine Family), UE4, blueprint, procedural, spline, splinemesh, spline-mesh, tutorial, learn, help, Procedural Generation
Id: 7YUxM0NDWRY
Channel Id: undefined
Length: 7min 59sec (479 seconds)
Published: Tue Dec 16 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.