TTK Studios

Bringing fun to your life!

Spline Chains with Blueprints

Little update at my “chain system” with splines in UnrealEngine.

Chains

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.

ChainBP01

The chain is an Actor based Blueprint, with all code in the Construction Script.

Image_01

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.

ChainBP02

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.

ChainBP03

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.

ChainBP04
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.

AddPoint  ChainsScene

Thanks a lot.

2 Comments

Leave a Reply to Maico Girardi Cancel reply

Your email address will not be published. Required fields are marked *

© 2019 TTK Studios

Theme by Anders NorenUp ↑