I Want to make some GameObjects that, say, increase a variable in another GameObject the closer and more they are.
Like magic mushrooms with a healing aura. The player's gameObject regenerates the variable "health" faster the closer a mushroom is, but also the more mushrooms there are.
How can I check for the proximity of my mushrooms in the Player character's game object? In my game, there are hundreds of aura-things affecting a maximum of 8 other objects so it needs to be efficient.
I also want to set an aura-range in the player's game object to determine the falloff radius of the mushroom's effect.
asked Feb 25 '12 at 04:36 PM
Yes, it wouldn't be very effective measuring distance to every mushroom, every frame. So, in my game I would add a trigger to my player. Create a script and check if a mushroom entered the trigger(I am sure you are familiar with triggers. If not, look them up in the Scripting Reference). Once a mushroom has entered the trigger, then measure distance to the mushroom(s) and add health accordingly. Remember, you don't have to measure distance every frame, maybe do twice a seconds. Then add more health the closer the mushroom is to the player.