Populating Meshes Along a Spline | Tips & Tricks | Unreal Engine

Поділитися
Вставка
  • Опубліковано 26 гру 2024
  • Ігри

КОМЕНТАРІ • 146

  • @Dominic0flex
    @Dominic0flex 3 роки тому +137

    For rotation use "Get rotation and tangent along spline", that already gives you needed rotation which is actually more accurate.
    Also you can just select code, RMB it and select "collapse to function" so it will also auto create needed pins.

    • @SurviveOnlyStrong
      @SurviveOnlyStrong 2 роки тому +1

      there's no such node as of ue5

    • @irenenaya7644
      @irenenaya7644 2 роки тому +6

      @@SurviveOnlyStrong : GetRotationAtDistanceAlongSpline works fine for me in UE5. You need to pass the index * spacing just as we do to find the location

    • @RobertGameDev
      @RobertGameDev Рік тому +5

      I gave the 100th like! This is so much better! Also confirming (and correcting) the node you want is "Get Rotation at Distance Along Spline" and it works so well!
      Wish I could post pics in this message to show how its being used.
      So, basically you want to replace the "Get Location at Distance Along Spline", inside of the "Get Location at Index" function (the one that we made pure following this video), with the "Get Rotation at Distance Along Spline" node. Don't forget to provide the Distance into the "Get Rotation at Distance Along Spline" node.

    • @JP-eo2pb
      @JP-eo2pb 8 місяців тому

      @@RobertGameDev Do you connect the Get Rotation at Distance Along Spline node to the multiply output and Get Location at Index? Is the Return Value auto creating a Get Rotation X Vector node before connecting its return value to the Return Node? You still using A input for Get Location at Index?

    • @RobertGameDev
      @RobertGameDev 8 місяців тому

      @@JP-eo2pb I don't remember! It's been too long. I'll say probably to all of them and ask you to respond here with the results of what you found!

  • @tonykim8244
    @tonykim8244 2 роки тому +27

    For those who want to rotate the meshes with custom values and populate them along the spline with more accurate angles, I would use 'Get Tangent at Distance Along Spline', connect the return value to 'RotationFromXVector', split struct pin of its return value (by clicking the return value pin with RMB and selecting 'split struct pin'), attach 'Add' node to 'Return Value Z', promote the B value of the 'Add' node to a variable and use it as a custom rotation controller for your meshes along the spline, split struct pin of 'Make Transform' node's 'Rotation', connect 'Return Value X' and 'Return Value Y' of the 'RotationFromXVector' to 'Rotaton X' and 'Rotation Y' of the 'Make Transform' node, connect the return value of the 'Add' node to 'Rotation Z'. If you want to control the rotations along X and Y axis as well, do the same for them too like Z.

    • @musikalniyfanboichik
      @musikalniyfanboichik 2 роки тому

      thank you so much

    • @DocCube
      @DocCube 2 роки тому

      What do you plug into the Distance for the "get Tangent at distance along spline"?

    • @tonykim8244
      @tonykim8244 2 роки тому +2

      @@DocCube Same with what's connected to 'Distance' of 'Get Location at Distance Along Spline", which is 'Index' of the For Loop multiplied by 'Spacing' variable in the video.

    • @elstinopacino
      @elstinopacino Рік тому

      Saved my day

    • @gabrielepardi5178
      @gabrielepardi5178 Рік тому

      Thanks!

  • @gabrielepardi5178
    @gabrielepardi5178 3 роки тому +16

    Clear, short and straight to the point: that's the kind of video I appreciate a lot!
    Hope more from this from Epic!
    Thanks guys for your work!!

  • @vahida6146
    @vahida6146 3 роки тому +28

    It's safer to add the 'ClearInstances' node of the 'InstancedMeshComponent' at the beginning just right after the OnConstruction node.
    Otherwise, it will create so many meshes on the level while moving the blueprint actor.

  • @Hung_Nguyen_90
    @Hung_Nguyen_90 2 роки тому +5

    This is one of those 10 minutes tutorial that take me 1 hour to follow 😅 But I did it thank you very much

  • @ChrisCohen
    @ChrisCohen 3 роки тому +4

    Really useful and as others have said, straight to the point, but more importantly, very clear as well. Please keep these up as I'm sure I'm not the only one learning a great deal here!

  • @yusrighouse
    @yusrighouse 3 роки тому +5

    This is exactly what I was looking for! I wanted to instance random meshes along the spline so had to adapt the code a bit to suit that. No idea if what I did was the most optimal solution, but it works on my semi-potato so this brings joy. Also really great explanation. Good speed, clear and concise.

    • @Wishersid
      @Wishersid 2 роки тому

      Would you mind sharing the approach you used to adapt it to using random meshes?

    • @yusrighouse
      @yusrighouse 2 роки тому +2

      @@Wishersid create array parameter and have the blueprint randomly pick from array. Use the length of array into a random range node and use that output to choose from array by index.

    • @Wishersid
      @Wishersid 2 роки тому

      @@yusrighouse I ended up doing some other solution since the issue here is that i couldnt figure out a way to use the instanced meshes as well as have them be randomly selected. I will have to look into it some more, thanks!

    • @ananya.s
      @ananya.s Рік тому

      Hey! Could you share a snippet of this? Would be really helpful.
      Thanks

  • @busesart
    @busesart Рік тому +1

    This is one of the best tutorials you guys put ouut. Just. Perfect! Thank you. Thank you. You are inspiring and supporting indie devs and artists so much

  • @jynxbot352
    @jynxbot352 10 місяців тому

    Adding this for any troubleshooters out there that may need this too while I was fiddling with it, as I'm pretty new to Blueprints.
    If you wanna Make your mesh follow the orientation of the spline but want your mesh to always point upwards, for instance I was making Spindles for a staircase and they should point upwards as they follow the spline up. To make them point upwards while following the spline, after the "get location at index" is added and you have that minus to subtract the first from the last, left click and split struct pin so you see X, Y, Z. On the "make Rot from X" do the same on the input, split struct pin, so you see XX, XY, and XZ. Connect the "-" output X to the XX input, and the output Y to the XY output. Compile. Your assets should be point up in world space while following the curve. Took a little fiddling to figure it out.

  • @zacharoninoodle
    @zacharoninoodle Рік тому +2

    For those, like me, who are trying to use this code as the base for a chain-link spline, make the following changes to the blueprint you have set up:
    1. Drag from the Index output of the For Loop node and connect it to a % (Integer) modulo node and set the other value to 2.
    2. Drag from the % (Integer) modulo node output and connect to an Equals node. Leave the other value at zero.
    3. Add a Select Rotator function.
    4. Connect the output of the Equals node into the Pick A condition of the Select Rotator node.
    4. Plug the Make Rot from X node into option A.
    5. Drag out from the Make Rot from X node and connect it to a Break Rotator node.
    6. Add a Make Rotator node and connect the Y and Z from the Break to the Make.
    7. Create an Add node and connect the X from the Break Rotator into it. Set the other value to 90, or a Random Float in Range node with a min and max set somewhere around 90 (if you want randomness).
    8. Connect the result from the Add node into the X for the Make Rotator.
    9. Connect the Make Rotator result into the B option of the Select Rotator node.
    10. Connect the Select Rotator Return Value into the Make Transform Rotation input.
    11. Compile! Ensure that your chain link mesh is properly oriented to follow along the mesh length-wise for best results. Tweak as necessary.
    This method uses a modulo function to determine which instances are indexed as odd. If odd, it will select a secondary rotator which takes the default rotation (as acquired in the tutorial) and simply adds 90 degrees of rotation along the X (roll) axis. As a result, every other instanced mesh is rotated 90 degrees.

    • @h3llspreader
      @h3llspreader Рік тому +1

      Thank you so much, this is exactly what I was trying to do!

  • @himanshudas9042
    @himanshudas9042 3 роки тому +6

    Can you please continue this type of tips and tricks series

  • @MagnumN117
    @MagnumN117 10 місяців тому

    This was a spectacular step-by-step tutorial, thank you so much!

  • @Fafmagic
    @Fafmagic 3 роки тому +7

    Love this tips & trips series

  • @andrewinireland
    @andrewinireland 2 роки тому +5

    For things such as fences, they dont quite line up, but if you add another "get location" where you add to the distance along the spline half the length (X) of the asset then the corners line up better. requires adding another parameter to the function which is an offset float. then plugging the return value into the location on the make transform.

    • @Highcastle_of_Geek
      @Highcastle_of_Geek 2 роки тому +1

      Any chance you could show this step by step? I'm not sure where to plug in the "get location" and offset float parameters like you describe. I have the same issue with a fence and it lines up fine when the spline is straight, but I get too large of a gap when I curve the spline.

  • @Kevoin_
    @Kevoin_ 6 місяців тому

    If you want rotation per instance you can place a "Combine Rotators" node before the "Make Transform" node and promote the "B" section to a variable to make it controllable from the editor.

  • @Flowrazornapalm
    @Flowrazornapalm 2 роки тому

    Fast, on point and way too confusing for me.. but you are a LEGEND, works like a charm

  • @williamlacrosse9389
    @williamlacrosse9389 3 роки тому +2

    Straight to the point. I want more...

  • @DragonplayerDev
    @DragonplayerDev 3 роки тому +2

    Oh wow this is exactly what I was looking for a few days ago.

  • @fleurbird
    @fleurbird 3 роки тому +3

    This is so clean and helpful.
    In less than 12 minutes I learned so many things.
    Thanks!

  • @glenortiz8419
    @glenortiz8419 Рік тому +1

    Awesome video! very helpful and easy to follow!
    Wondering if you could do a follow up video with splines on how to add a function that will bend geometry along the curve together with the already existing elements on this blueprint. Again, awesome video can’t wait for the next ones

  • @jomesias
    @jomesias 2 роки тому +3

    Any way we can get a tool like blender’s array modifier? 🤞🤞🤞🤞

  • @MoinkAndKilo
    @MoinkAndKilo 2 роки тому

    This was very well done. Very clean blueprints.

  • @wilismatrix9847
    @wilismatrix9847 Рік тому +1

    I want to add an option where I can change or customize the rotation of a selected instance in the spline.3 because at some places the follow rotation puts some assets in not exact rotation that I need at at that specific place in the map ?

  • @michaelvaughan2986
    @michaelvaughan2986 2 роки тому +7

    can you instance blueprints along a spline?

  • @routeone4790
    @routeone4790 Рік тому +1

    I only get one mesh when I drag into the scene, how does he get multiple ones?

  • @PhilHarland-hz1pm
    @PhilHarland-hz1pm 5 місяців тому

    Awesome, just EXACTLY what I needed for my game as Construction Script in game is sooooo SLOW for stuff that never changes position!

  • @Staglaitor
    @Staglaitor Рік тому +1

    Thanks - maybe I overlooked it - but are there primitives from splines - such as: circle, square, ellipse, triangle?

  • @gaming4K
    @gaming4K Рік тому +1

    But if you do it with a fence ar rail it doesn't connect the end points it's just following the line without connecting the meshes

  • @aiarch
    @aiarch 2 роки тому +2

    it helped a lot. thanks. How can we add multiple meshes to it?

  • @nodezero9828
    @nodezero9828 3 роки тому +2

    I needed this so much!!

  • @keshavharipersad2024
    @keshavharipersad2024 Рік тому

    finally, a tutorial that isn't a zoom meeting and 3 hours long

  • @Atl3m
    @Atl3m Рік тому +3

    How to snap them to landscape?

  • @MuhammadFazrulMuhammadNadzri
    @MuhammadFazrulMuhammadNadzri 4 місяці тому

    Hello. Is this possible to be made dynamically? I intend to make a crane cable that can be extended or retracted using the same method, but i can only manipulate the spline distance during editor mode and not in game mode. I have created a lever where its input will be used to manipulate the spline so that the static mesh can be spawned when spline extended or removed when spline shortened - givin the visual of cable extending and retracting. However, I still do not understand on how to do it.

  • @foxxxtheworst
    @foxxxtheworst Рік тому +1

    This is brilliant! HOWEVER: how could we implement a public variable to control the scale or size of the instanced mesh?

  • @justinboyd202
    @justinboyd202 11 місяців тому

    Am I missing something, I followed step by step, but after placing the BP into the scene (viewport), I cant see the spline and therefore cant extend it or curve it etc. Please help. At 6:57 something must be pressed in the video as the spline suddenly appears in the video?

  • @ianburke5867
    @ianburke5867 3 роки тому +2

    More tips like this, please.

  • @planet_asylum9059
    @planet_asylum9059 3 роки тому +1

    Thanks alot this is a great tutorial! Is there a way to keep the pivot point on the BP centered? Mine seems to be very far from the instanced static mesh center and the spline.

  • @techgnosis3693
    @techgnosis3693 2 роки тому +1

    Excellent work thank you for sharing..!!

  • @ReverseAltruism
    @ReverseAltruism 2 роки тому +2

    2:05 Now what if you want to use more types of static meshes? :(

  • @CreativeGraham
    @CreativeGraham Рік тому

    Excellent video! Thank you!

  • @artadecram_9624
    @artadecram_9624 Рік тому

    Thanks for solution! As we know -in common 3d-editor - like maya or 3ds max - we can smooth spline or rebuild it that means that instead 5 point inside we will get 10 ones - can we do it in Unreal engine? What operations can i do with spline in UE?

  • @FabioHartFernandes
    @FabioHartFernandes Рік тому +1

    Hi... i am trying to use this technique to distribute some light poles over a highway... the instanced mesh worked perfect, but i cant figure out how to instance thee spotlights that ive attached to the pole... any hints how to do that? thanks a lot

  • @chadgtr34
    @chadgtr34 Рік тому

    can it be camera actor for every 50 meters in the race track? camera actor instead of the tires, and through the camera actor, we can watch the car goes around the race track as a spectator or 'replay' after the race is finish.

  • @harrygeorge3665
    @harrygeorge3665 Рік тому

    im following this in ue5 and its just not working, do i need to do something with my mesh ?

  • @joshuakop
    @joshuakop 2 роки тому

    How do you rotate the static mesh on the spline? I need to rotate it 90 degrees but cannot figure it out. I'm a newbie.

  • @moshmoshpitpit
    @moshmoshpitpit 3 роки тому +1

    Amazing! Great job!!!

  • @TheWinterShade
    @TheWinterShade Рік тому

    Hi,
    is it possible to import your own splines and use them for the same outcome? So instead of drawing it out, you import the spline and populate the mesh from the spline?

  • @neonbeachgames
    @neonbeachgames Рік тому +4

    How do you get splines (fences, walls, etc.) to stick to the landscape? Not every road is perfectly flat ya know :)

    • @stargazestudios
      @stargazestudios Рік тому +1

      It's been 3 months but for posterity: line trace under each mesh and set its location at the impact point. You can even use the Normal hit to set the rotation to follow terrain.

  • @martinbalogh8768
    @martinbalogh8768 5 місяців тому

    Great vid. Thanks

  • @ISDISNJH
    @ISDISNJH 3 роки тому +1

    I am trying to model a theater style seating where one mesh has arm rest then the next one between it does not have armrest, I want to know how can I set it up so the spline uses two type of instanced meshes it spawns along the spline..

    • @mattoztalay5713
      @mattoztalay5713 3 роки тому +2

      Yup! You'd use the sample spline, but you'd have two Instanced Static Mesh Components, one for the ArmRest and one for Armless. Then in the for loop you'd use the same transform each time, but FlipFlop between AddInstance to the ArmRest ISM and AddInstance to the Armless ISM.
      Alternately, you could model your chairs so they all have one armrest on the left side, then then you get to the final instance you can add an "end cap" single static mesh that's just the armrest.

    • @kenalpha3
      @kenalpha3 2 роки тому

      @@mattoztalay5713 Whats the code to add [beginning and ] End cap meshes - calculated to match the end length of the last mesh?

  • @BingGeaux
    @BingGeaux Рік тому

    Thanks I found the correct node.

  • @tutumannyAQUE
    @tutumannyAQUE 8 місяців тому

    Life saver, thank you!

  • @maurofiamma
    @maurofiamma 2 роки тому +1

    How to use more then one static mash to do the same? Thanks

  • @X-mordred-X
    @X-mordred-X 3 роки тому +1

    Hey guys, I have this newbie problem. I've made a very similar system. My problem is that I can't mesh paint across all the instanced meshes. Can you help me?

    • @kenalpha3
      @kenalpha3 2 роки тому

      Did you find an answer? We need the code for using regular meshes and not Instance. When I set my Instance mesh and place in world.. my editor gets super laggy. Idk if it's the polys or because it has a WorldAligned texture and 3 vertex layers.
      But this mesh + mat doesnt lag when I use another spline that uses non-instance mode.
      But his code has offset I need.

    • @X-mordred-X
      @X-mordred-X 2 роки тому

      @@kenalpha3 No, I still can't paint across freely. The workaround is to expose components in the Details Panel... I don't know how I did that, and I can't find the guy who posted this solution. If you can expose each SplineMeshComponent in the Details Panel, you can just click one by one and paint them... this is far from being a solution but with a lot of patience you can get away with it. I'm using BP and SetStaticMesh per instance. Sorry I am not of much help.

  • @davidramis-us
    @davidramis-us 2 роки тому

    Is it possible to draw the line with your cursor at run time?

  • @rudenzu
    @rudenzu 3 роки тому

    Hi! I am trying to move these meshes during gameplay by changing the shape of the spline, but all of the meshes move the same amount, even though I only move one spline point.
    How should I go about it?

  • @allieholmes2192
    @allieholmes2192 2 роки тому

    Im new to ue5 and following along has been amazing I was wondering how I would go about added something that bends the object along the spline but still allows me to add offset to the instances any help would be amazing :)

  • @gamedevstanislove
    @gamedevstanislove 3 роки тому +1

    Thanks a lot! Very useful! Awesome!

  • @shakaama
    @shakaama 3 роки тому

    can I use this principle for a endless runner to both keep the spline going, and to put random street elements along the spline?

    • @_FLOROID_
      @_FLOROID_ 2 роки тому

      Theoretically you could use randomization in the for loop to randomly select a mesh that is instanced.

  • @hamzakilic7844
    @hamzakilic7844 10 місяців тому

    Hi everyone, How can I merge splines in different landscapes?

  • @_FLOROID_
    @_FLOROID_ 2 роки тому

    Is there any way to add more control points to the spline, similarly to the way you can add new control points to splines in a spline layer in the landscaping tool?

    • @shouzhanma4416
      @shouzhanma4416 2 роки тому +1

      关卡中 右键点击样条线,有一个在此处添加新样条点的按钮。Right click on a spline in the level and there is a button to add a new spline point here.

  • @squadukraine111
    @squadukraine111 2 роки тому

    Is it somehow possible to use blueprints in splines instead of static meshes? For example, I have a razorwire blueprint that slows users down and inflicts damage. I want to draw a spline where this BP will work all the way.

    • @gelubra44
      @gelubra44 Рік тому

      Im wondering aswell did you find out anything? Im trying to add box triggers along a spline.

  • @Radwalls
    @Radwalls Рік тому +1

    this video gave me a nosebleed. but im not going to give up

  • @artdrawing6682
    @artdrawing6682 11 місяців тому

    oh men thank you very much one thing if find somthing to the mesh deforme withe spline when rotation you k'now what i mean like spline landscape if do'it i this go to other levels any way thnk you

  • @gaming4K
    @gaming4K Рік тому

    Can you make the things overlap? There are some meshes that an overlap is needed to look good.

  • @cosminzeic
    @cosminzeic 3 роки тому

    How can you resize the spline so the meshes fit right?

  • @aaronhesse
    @aaronhesse Рік тому

    Rotation of the meshes doesnt work for me in UE 5.2

  • @DaroxxFR
    @DaroxxFR 3 роки тому +1

    Are nanite meshes working with spline please ?

    • @Madamealexandria1
      @Madamealexandria1 3 роки тому

      Yes definitely working as per Instanced Static Mesh in this video. They dont work as a spline mesh, as that deforms the geometry (not supported in Nanite)

    • @DaroxxFR
      @DaroxxFR 3 роки тому

      @@Madamealexandria1 Thanks, you even answered my future question X)

  • @cosmotect
    @cosmotect 3 роки тому

    Are splines not really intended for single object, multi mesh solutions? (Like a plant generated along a spline)
    Because I run into issues with spline behavior in those cases

    • @Fafmagic
      @Fafmagic 3 роки тому

      The spline system just isn’t robust enough to manage branching. I’m sure it can be done but you’d probably have to extend the spline class in C++ or do some serious faffing about with multiple spines on a parent class. Frankly, I’d still use Blender to do plant and tree meshes.

    • @cosmotect
      @cosmotect 3 роки тому

      @@Fafmagic not even going as deep as branching… The splines break down when you try to move them vertically. I can't get them to behave properly. I have tried a spline based waterfall and pipes

  • @wasimsaifi7684
    @wasimsaifi7684 2 роки тому

    Time 3.39 what node you used?

  • @NicoleSummer8
    @NicoleSummer8 Рік тому

    Awesome!

  • @nxwn9144
    @nxwn9144 2 роки тому

    Nice tutorial,

  • @hageby123jean1
    @hageby123jean1 3 роки тому +1

    If someone can answer... Should I learn and work with the C++ for Unreal?
    Or just stay with Blueprints?

    • @qq-pf9pn
      @qq-pf9pn 3 роки тому

      with blueprints you can do most of the stuff but if you want to work in a game studio or you probably will need to learn c++

    • @haroldseven8675
      @haroldseven8675 3 роки тому

      You never lose learning something new.

  • @ryanjstever
    @ryanjstever Рік тому

    What about adding a light to the spline?

  • @FromWithin526
    @FromWithin526 2 роки тому

    there is no float+float in ue5?
    so what would it be

    • @Mittzys
      @Mittzys 2 роки тому +1

      Just +. It decides the variable type based on what variables you put into the inputs.

    • @Jet7Wave
      @Jet7Wave 2 роки тому +1

      Just +. It doesn't require you to specify that it's float anymore.

  • @well.8395
    @well.8395 3 роки тому

    Video on how to perfectly use MetaHuman on mobile platforms?

  • @mo880
    @mo880 2 роки тому +1

    Imagine a Hendrix in the comnt section said he was struggling and niggas said give up lmao.

  • @hardway777
    @hardway777 3 місяці тому

    Thanks!

  • @BizzareArchAngel
    @BizzareArchAngel Рік тому

    great thanks!

  • @wasimsaifi7684
    @wasimsaifi7684 2 роки тому

    I can't find that node in UE5

    • @CamilleMeehan
      @CamilleMeehan 2 роки тому +1

      If you are referring to the float + float node, it is no longer variable specific. You can just use +

  • @klexxsy
    @klexxsy Рік тому +1

    How i can make a new point 😅

    • @buster5661
      @buster5661 Рік тому

      You probably just extrude it

  • @rifat.ahammed
    @rifat.ahammed 2 роки тому

    Thank you

  • @allashama
    @allashama 7 місяців тому

    being someone with mathematical issue, this is overwhelming lol.

  • @Perry-wy2fc
    @Perry-wy2fc Рік тому

    😂😂😂 oh my god.. you do that in 3 clics in cinema 4D 😮

  • @borisstengele5389
    @borisstengele5389 Рік тому

  • @buster5661
    @buster5661 Рік тому

    Feel like this is outdated with pcg's

    • @Bulborb1
      @Bulborb1 Рік тому

      They sort of work in conjunction, just depends on your needs

  • @jaybills4695
    @jaybills4695 2 роки тому

    I'm kinda lost but i'm getting there. I'll try to motivate myself to learn all the complex tNice tutorialngs on tNice tutorials program and make so soft i'd like.

  • @LordLuigi_Rigs
    @LordLuigi_Rigs 3 роки тому +1

    ✅✅✅

  • @ImadoPullupz
    @ImadoPullupz 2 роки тому

    It's too complicated there should be a simpler way to do this

  • @soundkaiser
    @soundkaiser 3 роки тому +1

    Oi!

  • @coffeediction
    @coffeediction Рік тому +1

    those barriers are not really lining up tho, if its a pipe or cable then RIP, im stuck, again.

  • @I_Stern
    @I_Stern 2 роки тому

    yup, got it, thanks. :D

  • @apollogt5506
    @apollogt5506 3 місяці тому

    how can i use a spline to bend an object to make a pipe or staircase handrail? thanks

  • @wildhearts9006
    @wildhearts9006 8 місяців тому

    Thank you