Scale mesh based on distance. Help please.

Hi,

First, sorry for my english, i hope can understand my problem.

I want to change my the “plane” X scale based on the other overlap actor distance.

My mesh X value is 850.
When i go close to the other actor, i want to change “plane” scale parallel of distance.

If the other actor distance >= 850 then my “plane” mesh X scale is 1.0.
If the distance between overlap actor actor and me is 850/2, i need to get the X scale to 0.5
And when reach the other actor, distance 0 set scale to 0 too.

On the picture you can see how try this now, but my formula is wrong. (Circled with white on the picture)

I changed that float + float value from 0.05 to 0, not helped.

Tryed with line trace too, got similar result.

If you’re looking for a smooth curve rather than hardcoded values, range maping will help here:

map.PNG

Hello Everynone,

thank you for the answer. Little better result, but unfortunatelly got almost the same result.
As i see, the problem is, i get the distance from the overlap actor middle and not from the facing surface.

There is the new video.
In the first test, im use lane trace, but get distance from actor middle.
In the second test the yellow plane is the “Map range Clamped” version, the non material plane is the old version.

Anyone can help me, how to set my “plane” mesh to same long as the line trace until the hit actor?

Have a look at the node ‘Normalize to Range’, I think once you see this node it will help you

Also, if you get the world position of two actors/objects, then subtract one world position vector from another, on the result vector use node called ‘Vector Length’. This will give you a float value which is the distance between the vectors. (The length of the vector between the two actor location vectors)

These nodes I believe are what you are looking for, if you need a more detailed explanation ask.

EDIT: I should also add youre going to need a LERP node

Thanks, i check this out.