I am looking for a script that will scale an objects size based on its distance from a camera. One key thing it needs to do is only scale that said object after it enters a certain perimeter around the object being scaled. Also the camera must be able to control the spheres scale no matter what direction it is moving towards the sphere. For example:
sphere and camera are separated by 150 units.
sphere size is arbitrary but has a perimeter set at 100 units from pivot.
camera passes through 100 unit perimeter.
sphere will scale down relative to this distance that the camera moves. If the camera moves 50% into the perimeter the sphere will scale to 50%.
camera leaves the perimeter.
sphere will scale back up to its original size.
I am pretty lost on how to do this myself. I tried to use reaction manager but it did not work out. thanks.