How do I tell the system what the maximum distance is from an object before it can be activated. For example, I have a door that is clickable which loads the next scene when you click it. However, weather I'm next to it, or 100yards away, i can still activate it. How do I set the maximum distance allowed to activate it?
asked Mar 08 '10 at 12:46 AM
Firstly, you would calculate the distance between player and door either using Vector3.Distance or better Vector3.sqrMagnitude and you would then add an if statement to your clickable object so that the functionality is only triggered when your distance is smaller than a certain amount.
answered Mar 08 '10 at 01:19 AM