Little update at my “chain system” with splines in UnrealEngine.
Basically now I’m can chose between colored or chrome chains, and also chose their 2 colors and the numbers of knots that are colored.
For those who like to learn, here’s how it works.
The chain is an Actor based Blueprint, with all code in the Construction Script.
The spline actor spawn instances of chain knots based on a division of the spline length and some variable that will be the space between the instances.
Using Instanced Meshes prevents additional draw calls since the mesh is instanced.
After that, it rotate and position the mesh based on the distance that object is along the spline.
Next, with the modulo (%), we determine if the object must be rotated 90° or not based on “Even and odd”. One is rotated, another is not.
The branch defines if the chain has color or is chromed. Here the things got a little confused… and this was the only way I could make it work.
If it has color, the chain need to paint every color based on the number defined in the variable Stripe Units. So, with a greater than (>), we change the material’s vector parameter of the first block until it reaches the number defined in Stripe Units.
After that, with the “Do N”, we change the other block of knots with the another color. After that, it performes a reset of the “Do N” and reset the temporary “Stripe N” variable.
Probably there is another (and better) solution for this part of the BP, but as long its working, I’m good with that.
With the actor blueprint in scene, you just need do right click anywhere over the spline do add a spline point and change the tangents to make the chain look as you need.
Thanks a lot.