How to change color on the travel path unreal engine4

How to color on the cover path as shown in the picture.What to study for this. I do not get any painting tutorial in unreal engine 4 this. is it something else rather then paint or color.

Study splines, spline mesh components and materials.

Using Spline mesh i can create the track or path and using spline i can set the path of my actor but how to change the material of spline that is cover by actor.

The actor is moving along a spline so you know where your are on the path. Assigning a dynamic material to a spline mesh component allows you do modify the material in real time via an exposed parameter - in this case a UV coordinate.

it is not working if i give component variable to create dynamic instance target . static mesh variable is not acceptable by create dynamic instance.

I see you create a Dynamic Material Instance but never assign it to the Spline Mesh Component. As in:

Create 1 DMI if you want all the SMCs to share it. Or multiple instances if you need to modify the looks of each SMC independently.

The event actor begin overlap is not
called.

You need to look into collision then, how are we supposed to know the way you set it up and what collides with what…

The very minimum setup for this to work:

Ensure your spline mesh has collision:

Image from Gyazo

The above will allow you specify which particular SMC you interact with but OnActorBeginOverlap will here, too.

it is still not working. The event actor begin overlap is not called. That’s why the material of spline static mesh is not changed. I tried it with two way first by assigning road spline directly to player or second by create road spline different or player spline different on road spline. But both not working.

If I wanted to set it up for a spline track (closed spline) that has a single parametrised run-time material:

Image from Gyazo

Does this make sense?

i use spline instead of spline mesh that’s why collision option not provided. if i create static mesh then get location and tangent at spline point option not occurred.if i create blueprint using spline and follow

then only spline points shown not static mesh.

sorry. after click on add spline mesh component. the collision property shown.

As my player run on track spline using player spline it is not changing its color. The overlap event is not firing

317060-spline.png

317073-overlap.png

317071-player.png

You don’t have source material in the create dynamic material node. And again, I don’t think splines can have collision, it’s the spline mesh components that you’re colliding against.

Besides, you can’t make the spline mesh change colour the way you show it in the original pic with the train. You’d need to animate UV coordinates of the material as I mentioned before.

I’d never use collision for this to start with - or how is this supposed to work? You already know where you are on the spline since you’re moving the pawn on it - send this value to the material. The player’s progress on the spline is what changes the way the material looks.

I do not get any video for animate UV coordinates of the spline material . The panner use for making material movement. But there is no any video or google result for making spline material change color.

See if this gets you any closer:

  • Spline Mesh Component creation & Dynamic Material Instance assignment at the top

  • updating parameters of an array of Dynamic Material Instances at the bottom

The material:

And the result:

Image from Gyazo


To summarise, each SMC has its own material instance and we update how its gradient is distributed over the length of that particular spline segment. The offset is optional, depending on how the end result is supposed to behave.

Hope it helps a little.

1 Like

Thanks for user help. I create same as you shown. i take geometric static mesh but that is not shown in the spline.

I tick Use With Splines Meshes flag of material and scene as default root. I already have assigned static mesh to add spline mesh component as show in image 2.But still it is not show static mesh on spline if i place spline and add points.

i create that function in construction script then it create static mesh . but when changing offset then nothing happened. Where to call that custom events UpdatematerialGradients instance and ADDSMCs.

Ensure the material has the Use With Splines Meshes flag ticked and that you’ve assigned a static mesh in the Add Spline Mesh Component node’s details panel.

Can you show the Construction Script? If you want to see the changes in the editor, you need to run both in the Construction Script.