Hi. Is it possible to use blueprint spline points to control the mesh scale? I want to reduce the scale, gradually, of a cylinder to model a whip using the spline.
You should be able to, yes:
Providing the cylider’s mesh is dense enough to deform. Due to the way the tangent data works, you will probably need 1 cylinder per each spline segment.
@Everynone thank you for your reply. Do you mean I just need to put “Set Scale at Spline Points”? I´m new to blueprints programming. I made my blueprint following a tutorial. Below, follows the node tree:
You need to scale the spline itself, yes. You can do it in the editor, in the level or with script. Think of the Spline Component
as of a data set, a clever container. When you add Spline Mesh Component
(the cylinder), you read the spline’s data and apply it to the mesh.
You are already doing it to the Location
and Tangent
, now you’d need to incorporate the Scale
as well:
You will only need 2 axis, because the stretching is already done with the node you’ve got up there.
Here’s an example of someone else doing it:
Note the +1 indexing, just like location and tangent. Do note that since you flip the orientation to Z, you will need to read the spline’s XY.
@Everynone , in this post (Linear scale with spline mesh - #2 by Sean_Parkin), Sean_Parkin shows exactly what I want, but I can´t find all nodes he used. I asked him about it. Hope he can answer me.
It’s just a new variable:
You can create it manually like any other variable or promote as above - by right clicking the return value pin. You can do it with ANY pin in the engine.
You only need that node if you want to refer to that particular component later on. You might as well just drag a wire around… It’s just less messy in this very case. You’ll run this in a tight loop, there’s no need for a hard ref.
You’d be better off by adding the SMCs to an array instead, in case you want to update the shape later on.
@Everynone Thank you so much!
Another question, how to create this node:
It seems to be a conversion node. The documentation says that it should be created automatically when connecting two different types of ports (Autocast). But it´s not been created when I connect:
You’re using UE5, there are major improvement regarding how pin type promotion works. You can right click pins and change their type.
The division node you used takes integers, the one from the other thread takes floats:
Note the colour.
Also, since you’re now using another method to scale, you will no longer be able to:
use blueprint spline points to control the mesh scale?
It may or may now work for you, but the spline point scale is now meaningless since the method uses simple math to calculate the necessary scale rather than take values from the spline.
Is there a reason why you cannot plug in those two nodes I suggested? In the end it’s up to you, of course.
@Everynone Thank you for your patience. I really appreciate your help.
I converted the in-port of the plus node, but when I connect the out port of the Return Value, the in-port converted, is re-converted to the Return Value port type, and I got an error message. I´ll make some research about it. Thank you so much, again!
@Everynone Sorry. I saw all your answer, now. Well, I´m trying to use the Sean Parkin solution because it´s exactly what I need. But I´ll try your suggestion.
In case you need to fiddle with this some more:
This would allow you to select any spline point and punch in the scale manually. Good luck!
This link is returning “Page not found”
I´m trying to follow your suggestion, but I´m noob in this. Sorry. I don´t know where and what to plugin in:
Beacuse I forgot to hit the publish button…
No need to add yet another spline mesh, you’ve already done that, we just need to scale it.
If you follow the link, you’ll be able to copy the script and paste it into the editor’s graph.
Man! Thank you!
Just one more adjustment:
How can I do make scale in all 3 axis?
Actually, it scales in one axis only… I´m trying to understand how to solve it.
@Everynone I got it! My bad. I got the script you posted here (Spline component points scaling spline mesh comps | Unreal engine Code Snippet), but I didn´t note the correct way to scale points. Thank you so much, again!