Scalar parameter driven by distance using Blueprint

Hi all,

I’m creating a material with two diffuse textures using a lerp to interpolate them; connected to the alpha on the lerp there is a scalar parameter, which allows me to “switch” between the two textures.

What I’m also doing is, using Blueprints,use the Get Socket transform on two of my character bones to get the distance between them; since my character has an animation applied the distance between the bones will vary when the animation is playing.
What I would like to do is to drive the Scalar Paramater of my material by the bone distance.

Better example: as soon as my scene starts I have a door in front of my character; when I start moving towards the door the distance between them will diminish; what I want to do is to use the distance at runtime between them to blend the two textures which are connected to the lerp node using the scalar parameter connected to the alpha.

Hope its clear

Cheers

This is the logic that I’m using to get the distance between the sockets
I’m trying to get the “visual” lenght shown using the Log message, but onscreen I can’t see anything and I don’t know where the Log Message out put will show me the distance between them…also, using vector lenght is correct, since I need the world distance between them?

A little help please? :slight_smile:

You need an Event Tick plugged to that Log Message node. Also you can try debugging with Print String as well.

Looks like that the Event tick, when connected to the Print string, cause the sockets to go nuts and I have an error…why?

Probably because there isnt anything triggering Add Skeletalmesh node?