Updating a value based off vector change.

Hey. I’m trying to update a float based on player movement. Basically, when the player moves up or down the y axis, I want my target variable to be adjusted by the same amount. Do I have to interp the value? I’m not really sure how to proceed. Here’s a diagram that better describes my situation:

Anyone know how I’d go about doing this?

It depends what the actual relationship between the target and your player is. Is it a fixed offset, e.g. always 600 below the player?
If so, you just need to find the offset and add or subtract it from the player value.
That will allow you to calculate the target value at all times.
If you didn’t want it going above 1000 or below -1000 you’d use a “clamp” as well.

But again, it really depends what the actual situation is.

Hello Benni.Lodge,

I have provided an example that will work in 3D. This example show how to set the distance between the player and it’s target. It also show how to then get that distance. I hope this information helps.

Example:

Make it a great day

Thanks Oak, this is absolutely perfect. Appreciate it.