Looking for a Node/Logic

Hi

I have a line trace with a distance of -y 2000 units (basically a trace down)

when the line trace is hitting at farthest distance I want to convert that number into the low end of a range.
when the line trace is hitting at its nearest distance I want to convert that number into the high end of a range.

so if distance a= 2000 then b= 0
if distance a=0 then b=2000

is their a node for this or math logic?

also why does my line trace with a distance of 2000 units start to report (via print) in the 2-3000 range when it first hits the floor.

many thanks

Hey, what you are looking for seems to be a Distance node plus a Substract node

Edit : Instead of using “Distance (Vector)” between “Trace start” and “Location”, you can simply take the “Distance” Output from the Break hit result.

Wow thank you very much - I would never of found it, most of this is like learning a new language by watching movies :slight_smile:

for anyone else I am actually trying to design a physics based flying ai which I realised that a PID controller is likely what i need.