value area around an item

Like demonstrate in my last post, you have 2 boundaries: *IN *and OUT, with a distance *d *between them (I used d=500). Once the player crosses the *OUT *boundary, a linetrace between the player and the center is done, which intercepts the *IN *boundary. From this trace we get the distance between the player and the *IN *boundary.

1.PNG

From that, is just a question of mapping that distance with the values you want. In my previous example, I used the mapping [0,500] -> [100,0], where 100 is when you reach the item and 0 when you are out of range.