Download

Need Help - Multi-Spline Construction Script

Hello everyone,

at the moment i am working on a small project for which i created more than 20 different Lamps. I would like to use a Splinesystem for the Cable and Wire/Chain-Suspension. I am trying to get into Visual Scripting since a little bit more than one week now. Normaly i try to figure everything out on my own with success. But in this case i feel like a 80 Year old that is sitting the first time in front of a computer. So i realy hope that some one of you can give me his helping hand.

Everything that i found online, was regarding “single spline functions”. That some one is placing one or multiple objects along a spline. But what i did not found was a function with multiple splines in one construction script.

I was able to create a, (let me call it) “multi spline function”. Which is from the main functionality exactly what i need. But as you will see, it is a mess and unusable. As i searched for a solution, i found a Video with a very nice BP, but sadly again a “single spline function”. I would like to combine both, but here starts the trouble.

This is what i have (Dont pay attention to the lamp it is only for testing :smiley: ) :
The marked Meshes in the first picture are Static, the unmarked Meshes are for the Splines.

The ability to simply change the Cable (checked is Cable_01 / unchecked is Cable_02)


Check/Uncheck Cable_03

Here is whole function, i hope you can see everything:


What i did was using the Spline-Function that you find in nearly every Youtube Video about Splines. I copy pasted the function and added my Static-Cable (Lamp_01_01_02) with “Add Static Mesh Component”. Which i want to change together with Spline_Cable_01 to Spline_Cable_02.
I added Branches and two Boolean Variables to controle the Checkboxes.
Because i have two splines on the X Axis and two Splines on the Z Axis i added a Variable for the Axis_Orientation.

Short, the BP gives the Main functionality but it is a totally buggy mess :laughing:, also the Meshes along the spline are not instanced and so on.

What i would like to have:

  • 4 Splines on two different Axis, two on X and two on Z
  • The ability to change cables, same with the wire to a chain, simple with Checkbox
  • The ability to show or hide a Cable with a Checkbox
  • Everything condensed instead of a copy paste mess like i did
  • Instanced like in the function i will show you now down below

This is a function from the Youtuber “Pending Kill”:




I am not interessted in the “Color Scheme Function” but here is also a picture of this part

Here is the Link to his Video:

Now is the question, how can i get my Function into something like he showed?
Thank you for spending your precious time reading, i wish you a nice day.

Just to answer your 80-year-old statement: when I first stared learning the engine I likened the learning curve to driving a Ferrari into a cliff face at 100mph.

But… there is also another factor, don’t try and do things in a way the engine isn’t written for. You will end up pulling your hair out for no good reason. It’s good to do things it wasn’t designed for, IF, you are getting somewhere, otherwise, don’t bother…

Can you summarize in a couple of sentences what it is you’re trying to do?

If you want multiple splines with different kinds of lamps on, the easiest way is to make a lamp BP which is switchable between many variations and then make a single spline consisting of those lamps.

Then put multiple copies of that one spline in the map.

EDIT: If this is your target:

4 Splines on two different Axis, two on X and two on Z
The ability to change cables, same with the wire to a chain, simple with Checkbox
The ability to show or hide a Cable with a Checkbox
Everything condensed instead of a copy paste mess like i did
Instanced like in the function i will show you now down below

All of this is fine with one spline, then put 4 in the level.

2 Likes

Thank you very much for your response Clockwork.

Oh i wasnt knowing that the engine wasnt disgned for that. But how could i know, i made a big bow around Blueprints in the last Years :smile:

My primary goal is to sell my Lamps on the Marketplace. Like those two:

If it would be only for me, i would jump in to my 3D Modelling Programm adjust everything how i need it and done. But if i want to sell the lamps i need a way to give a customer the ability to change, for example the length of each cable.

What i want to archive is to place a Lamp with already pre fitted cables (splines) that the customer then can manipulate or change as he want it. Like in my example that i created, but where you also are able to change from Cable_01 to Cable_02 with an easy checkbox.

I want the splines attached to the lamp not the lamp attached to a spline. Like you see in my first pictures with the blue testlamp.

For sure, you can have multiple splines in one blueprint, but I don’t think that’s the way to go here.

If you want the user to be able to lay out a chain of various lamps and cable types, that would actually be one spline with mesh instances attached.

You can set the blueprint up to change cable types and lamp types.

The most common spline tutorial on YT is spline meshes, which is how you do the cable, the cable part is the mesh in this case. The lamps are not actually part of the spline, but are positioned at the spline points.

PS: Find looking lamps.

No i dont want the user to be able to lay out a chain of various lamps.
I am sorry if i was possible missleading with my first post, asking multiple questions at once.

I want the user to be able to change the length of the cables. Because i dont have only one Cable i need a way to make multiple cables manipulateable. Thats why i came up with multiple splines.

The Video you are referring to is the function that is shown in nearly every video. This is the function that i used for my example in my first post.

Would it be easier if i make a short video?

Thanks for your compliment

Using splines for cables is pretty much the only thing on youtube. The user can make a cable of any length and shape with that.

If you think I’m missing the point, by all means, make a quick vid.

To be honest i don’t really understand your issue. I think a video would probably help. If i understood your issue, i am pretty sure i could help you, i recently built a Rail-System using an algorithmically built network of Splines.

1 Like

Two hints that may be useful:

  1. Put everything you do with a SplineComponent into Functions that take a SplineComponent Object Reference as an input, that should help to reduce the copy and paste.

  2. The “Local” option of the Coordinate Space selection on the SplineComponent nodes relates to the Component Transform. So you either have to make sure that all your SplineComponents have the same Component Transform or use World Locations / Rotations instead.

One additional tip: I posted about an inconsistency in what spline InputKeys are in those nodes here Spline Component: InputKey inconsistency so just know about that…

1 Like

I had some rough nights without enough sleep, i think the problem is on my side. :smiley:

Thanks for your response Heinor
Wow this sounds realy awesome.

Recordet a video now, but it will take some time before i can upload it.
Importing into Vegas lead to heavy pixelation, i wasnt recording for a long time and assume that my settings got messed up. I will recut it in a different programm and upload it.

Edit:

Here is the Video:

I wish every one a good night

Ahhhh! - got you. Yes, I did misunderstand! ( and you me! :slight_smile: )

This is very easy with the stand spline mesh setup, I will get back shortly with the details…

So this is the standard mesh spline setup:

As you can see, I’m using it for a pipe here, but you can use it for your cable:

spline mesh

You ( and the end user ) can set the mesh to be used in the details of the spline mesh node:

Excuses for the confusion, I thought you were talking about daisy chains of lights…

EDIT: To further answer your original question: Yes, you can have multiple splines in the blueprint, because each one is for something different. One is for the cable, one for the chain etc. That’s fine.

Once the user drags an instance of your lamp into the map, they can drag out the various splines to make things look right.

You will need a piece of code like I showed above for each spline.

Yes, it is a bit fiddly for the end user to adjust the splines, but the only alternative, is checkboxes, as you have already shown in your vid.

1 Like

Well if all splines work in the same way, he will need only one piece of that code:


@Bloodfighter77 That ending was comedy gold, but also true. Your problem are not splines, but programming skills. But nothing you can’t learn, just keep at it.
Regarding the instanced meshes: You can use them, but

  1. You will have to do more stuff manually: You will have to calc the correct scaling and rotation.
  2. You will loose the option for setting Tangents, so to avoid gaps will become harder to do.

Regards, Heiner

1 Like

This is fantastic guys and very helpfull.
Thanks for all your help, effort and patience with me.

I will come back and post the final result here after i got everything running.

1 Like